News Robot free

by algotrader in category Other at 12/11/2012

Robot places buy and sell STOP orders at specific time. Supports TP, SL, OCO and expiration time.


  • News Hour - Hour when news will be published (your local time)
  • News Minute - Minute when news will be published (your local time)
  • Pips away - The number of pips away from the current market price where the pending buy and sell orders will be placed.
  • Take Profit - Take Profit in pips for each order
  • Stop Loss - Stop Loss in pips for each order
  • Volume - trading volume
  • Seconds before - Seconds Before News when robot will place Pending Orders
  • Seconds timeout - Seconds After News when Pending Orders will be deleted
  • One Cancels Other - If "Yes" then when one order will be filled, another order will be deleted

News Robot PRO with Trailing Stop and Slippage Control





How to install
Warning! Executing the following cBot may result in loss of funds. Use it at your own risk.
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgo
using System;
using System.Linq;
using System.Text;
using cAlgo.API;

namespace cAlgo.Robots
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewsRobot : Robot
        [Parameter("News Hour", DefaultValue = 14, MinValue = 0, MaxValue = 23)]
        public int NewsHour { get; set; }

        [Parameter("News Minute", DefaultValue = 30, MinValue = 0, MaxValue = 59)]
        public int NewsMinute { get; set; }

        [Parameter("Pips away", DefaultValue = 10)]
        public int PipsAway { get; set; }

        [Parameter("Take Profit", DefaultValue = 50)]
        public int TakeProfit { get; set; }

        [Parameter("Stop Loss", DefaultValue = 10)]
        public int StopLoss { get; set; }

        [Parameter("Volume", DefaultValue = 100000, MinValue = 10000)]
        public int Volume { get; set; }

        [Parameter("Seconds Before", DefaultValue = 10, MinValue = 1)]
        public int SecondsBefore { get; set; }

        [Parameter("Seconds Timeout", DefaultValue = 10, MinValue = 1)]
        public int SecondsTimeout { get; set; }

        [Parameter("One Cancels Other")]
        public bool Oco { get; set; }

        [Parameter("ShowTimeLeftNews", DefaultValue = false)]
        public bool ShowTimeLeftToNews { get; set; }

        [Parameter("ShowTimeLeftPlaceOrders", DefaultValue = true)]
        public bool ShowTimeLeftToPlaceOrders { get; set; }

        private bool _ordersCreated;

        private DateTime _triggerTimeInServerTimeZone;

        private const string Label = "News Robot";

        protected override void OnStart()
            Positions.Opened += OnPositionOpened;

            var triggerTimeInLocalTimeZone = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, NewsHour, NewsMinute, 0);
            if (triggerTimeInLocalTimeZone < DateTime.Now)
                triggerTimeInLocalTimeZone = triggerTimeInLocalTimeZone.AddDays(1);
            _triggerTimeInServerTimeZone = TimeZoneInfo.ConvertTime(triggerTimeInLocalTimeZone, TimeZoneInfo.Local, TimeZone);

        protected override void OnTimer()
            var remainingTime = _triggerTimeInServerTimeZone - Server.Time;

            if (!_ordersCreated)
                var sellOrderTargetPrice = Symbol.Bid - PipsAway * Symbol.PipSize;
                ChartObjects.DrawHorizontalLine("sell target", sellOrderTargetPrice, Colors.Red, 1, LineStyle.DotsVeryRare);
                var buyOrderTargetPrice = Symbol.Ask + PipsAway * Symbol.PipSize;
                ChartObjects.DrawHorizontalLine("buy target", buyOrderTargetPrice, Colors.Blue, 1, LineStyle.DotsVeryRare);

                if (Server.Time <= _triggerTimeInServerTimeZone && (_triggerTimeInServerTimeZone - Server.Time).TotalSeconds <= SecondsBefore)
                    _ordersCreated = true;
                    var expirationTime = _triggerTimeInServerTimeZone.AddSeconds(SecondsTimeout);

                    PlaceStopOrder(TradeType.Sell, Symbol, Volume, sellOrderTargetPrice, Label, StopLoss, TakeProfit, expirationTime);
                    PlaceStopOrder(TradeType.Buy, Symbol, Volume, buyOrderTargetPrice, Label, StopLoss, TakeProfit, expirationTime);

                    ChartObjects.RemoveObject("sell target");
                    ChartObjects.RemoveObject("buy target");

            if (_ordersCreated && !PendingOrders.Any(o => o.Label == Label))
                Print("Orders expired");

        private void DrawRemainingTime(TimeSpan remainingTimeToNews)
            if (ShowTimeLeftToNews)
                if (remainingTimeToNews > TimeSpan.Zero)
                    ChartObjects.DrawText("countdown1", "Time left to news: " + FormatTime(remainingTimeToNews), StaticPosition.TopLeft);
            if (ShowTimeLeftToPlaceOrders)
                var remainingTimeToOrders = remainingTimeToNews - TimeSpan.FromSeconds(SecondsBefore);
                if (remainingTimeToOrders > TimeSpan.Zero)
                    ChartObjects.DrawText("countdown2", "Time left to place orders: " + FormatTime(remainingTimeToOrders), StaticPosition.TopRight);

        private static StringBuilder FormatTime(TimeSpan remainingTime)
            var remainingTimeStr = new StringBuilder();
            if (remainingTime.TotalHours >= 1)
                remainingTimeStr.Append((int)remainingTime.TotalHours + "h ");
            if (remainingTime.TotalMinutes >= 1)
                remainingTimeStr.Append(remainingTime.Minutes + "m ");
            if (remainingTime.TotalSeconds > 0)
                remainingTimeStr.Append(remainingTime.Seconds + "s");
            return remainingTimeStr;

        private void OnPositionOpened(PositionOpenedEventArgs args)
            var position = args.Position;
            if (position.Label == Label && position.SymbolCode == Symbol.Code)
                if (Oco)
                    foreach (var order in PendingOrders)
                        if (order.Label == Label && order.SymbolCode == Symbol.Code)

odomike - November 19, 2012 @ 16:11

This is what I have been waiting for so long. You really dont know how grateful I am to you for this robot. Time to start trading the news on my cAlgo. Thanks a million buddy :)

odomike - November 20, 2012 @ 00:06

I always get this error while the News bot is trying to place the buy stop order "YOUR REQUEST TO BUY STOP ORDER FOR 10K OF EURUSD WAS NOT SENT DUE TO TECHNICAL ERROR" What could be causing this? It places the Sell stop order successfully all the time though.

Zenner - November 23, 2012 @ 15:29

Hi I do not know if this has been fixed but in the issue is in the call to CreateBuyStopOrder because the takeprofit price is the same as the BuyStop and that is not possible. So if you change the code to: Trade.CreateBuyStopOrder(Symbol, Volume, buyOrderTargetPrice, buyOrderTargetPrice - StopLoss * Symbol.PipSize, buyOrderTargetPrice+ TakeProfit * Symbol.PipSize, expirationTime); it should work

algotrader - November 24, 2012 @ 21:45

Thank you Zenner, I've changed it and it is waiting for moderation.

odomike - December 03, 2012 @ 01:12

Thanks Zenner. Corrected and working properly now.

Jompa - December 07, 2012 @ 04:18

Have anyone used this robot? Would be nice to share experiences of results and ideas about changes. Please email to

MaXeY - February 06, 2013 @ 17:07

Hello 1st thanks for sharing this EA, am still testing on demo i have a note.. can you please ADD Trailing Stop option on the robot

algotrader - February 06, 2013 @ 23:15

Updated. Now it reacts on changing of DOM, because such event is more frequent than tick.

Eddie_Morra - July 17, 2013 @ 20:36

Hi @algotrader , the bot isnt working anymore, since yesterday this isn't working anymore, I don't know why, can you help me please?

Eddie_Morra - July 17, 2013 @ 21:08

Oh no, sorry, was my fault, working properly, thank you for the robot

AdrianC52 - July 27, 2013 @ 16:08

Sorry for a noob question. For the news time, is it follow UTC+0 or broker server UTC+3, or my user time UTC+8. thanks in advance to any kind heart who reply!

algotrader - July 30, 2013 @ 14:40


mrlilkkk - September 03, 2013 @ 05:32

does the take profit set the specified amount of pips away from the market price  at the time the orders are placed or the specified amount of pips from the order price?

algotrader - September 03, 2013 @ 22:00

mrlilkkk, I've updated the description. Please look at the first image. Also now it is possible to specify time zone for the robot.

Mocean - October 03, 2013 @ 04:18

Is time calcualted from Ticks or Server/Local time?

algotrader - October 03, 2013 @ 21:00

You can specify desired timezone in the code (see image #2)

bukk530 - November 03, 2013 @ 00:52

Nice done! Can you please explain me if there is a particular reason why you are using the MarketData Update event instead of the OnTick function? Thanks!

algotrader - November 03, 2013 @ 14:10

bukk530, MarketDepth.Updated event happens more often than OnTick event

chiripacha - November 29, 2013 @ 10:35

New Trading API#1

Spotwareposts: 185since: 23 Sep 2013

In the new version of cAlgo we added a new trading API. The main advantage of this new trading API is the ability to choose between Synchronous and Asynchronous trade methods. The previous API allowed asynchronous methods only and although it is rather flexible, it is difficult to deal with on occasion, because one needs to implement more methods in order to handle some situations.

Question: Is the "News Robot" updated referring to this news?

qweqwe96 - December 02, 2013 @ 13:31

Beijing time Chinese, should be in "EEuropeStandardTime" fill in what, please enlighten. Thank you.


Sathiya_Cool - December 04, 2013 @ 09:25

all robots are working properly. but news trading robot not working. plz help me ;-(

chiripacha - December 07, 2013 @ 11:54

Hi, how can I correct the following 4 errors ("ist veraltet" means = "is outdated")

Please can you help me?

Error CS0618: "cAlgo.API.Internals.ITrade.CreateSellStopOrder(cAlgo.API.Internals.Symbol, int, double, double?, double?, System.DateTime?)" ist veraltet: "Use PlaceStopOrder instead"

Error CS0618: "cAlgo.API.Internals.ITrade.CreateBuyStopOrder(cAlgo.API.Internals.Symbol, int, double, double?, double?, System.DateTime?)" ist veraltet: "Use PlaceStopOrder instead"

Error CS0618: "cAlgo.API.Internals.ITrade.DeletePendingOrder(cAlgo.API.PendingOrder)" ist veraltet: "Use CancelPendingOrder instead"

Error CS0618: "cAlgo.API.Internals.ITrade.DeletePendingOrder(cAlgo.API.PendingOrder)" ist veraltet: "Use CancelPendingOrder instead"

algotrader - December 14, 2013 @ 21:11

News Robot is updated

drewski - January 20, 2014 @ 23:21

Hi there. Hey we are in New Zealand so time zone is UTC+13. It wont work when I place this in the bot. Any ideas on the correct time zone configuration? Cheers

algotrader - January 21, 2014 @ 08:48

put TimeZone = TimeZones.NewZealandStandardTime

drewski - January 21, 2014 @ 23:56

Cheers :)

huyanji - March 26, 2014 @ 00:44

Hi , I really want to say this is a really good EA code. 

Thank you.


However, I just transferred  from MT4, so I have got 2 questions:

1. If someone entered the WRONG time-to-run this robot, How could they cancel this appointment in cTrader platform?

2. Where is the Trailing Stops (Which means: If the news is NOT QUITE important , the candle - bar will moved-back. So I suppose  we change the  take-profit to as low as 30 pips, if the candle-bar of GBPUSD dropping-down quickly from 1.5830 to 1.5820 after news released, then come back to 1.5830; but now the position is still open, so what should we do without the Trailing Stops Parameter?

Thanks again for this EA.

I like this EA sooooo much!



You can reply me via Email:

aisaac - April 08, 2014 @ 10:43

How to get news about ctrader? I use a demo account.


  • News Hour - Hour when news will be published
  • News Minute - Minute when news will be published


tilo10 - April 24, 2014 @ 20:31

please help, when i add my local time UTC+1 ,This is error message, Error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

algotrader - April 26, 2014 @ 17:30

Instead of UTC+1 you need to specify the time zone name. For instance, CentralEuropeStandardTime.

kestkam - May 08, 2014 @ 13:38


I suppose some traders used this News Robot in their real account for quite long time. Please provide any comments on the reliability of this bot. Thanks.

kestkam - May 09, 2014 @ 20:54

Dear algotrader,

Could you please change the Code adding a new Parameter there? When economical events come a market volatility is quite high thus the Slippage is a very important parameter in the News trading. So, in my opinion the Max. Slippage should be set. I suppose if the Slippage exceeds 3 or 4 pips the order shouldn't be filled. At least it would be fine to have such a possibility.

I used this bot with NZD/USD pair and got the slippage of 11 pips.

kestkam - May 11, 2014 @ 13:15


If anyone knows programming language #C please let me know how to add a new parameter "Slippage" into the code. Unfortunately, I am not familiar with codes. As I wrote above the ''Slippage" parameter was extremely important in the news trading. Please guys help me. Thanks in advance.

kestkam - May 13, 2014 @ 16:56

Hi guys,

Let  me ask you, why are you proposing the cbots which are not finished. Just take the News Robot and try it in your demo account and you will see that without resolving the slippage problem it's absolutely unuseful and even harmless. I tried it just a few times and one time I got the slippage of 11 pips another time the slippage was 6 pips. Any trader knows that in the news trading a trade opened with more than 2 pips slippage usually (with probability of 90%) went against you.

Guys, please work out the News Robot adding the slippage parameter in or take it out from here. The News Robot as it stands is just seducing traders. Sorry for saying that but it's true.

tete13 - June 10, 2014 @ 14:46

Hi algotrader,


Can you add Modify open price function to Robot?

Let's assume we want to open an order with 10pips away from current price, however there is not too much volatility and price just moves less than 10 pips. I think it'll better if we can modify our open price. I mean the open stop order price will constantly be modified and be 10 pips away from current market price, and our order will be filled in case PRICE MOVES EXCEED 10 pips.


tilo10 - June 28, 2014 @ 14:18

Can you please tell me how I can add "Trailing Stop" to this Robot ,Thanks

you can reply to   " " .

1023881 - July 08, 2014 @ 04:54

Hi there,

I'm from Australia (Sydney) and tried your robot but didn't trigger the trade. I tried to change the time zone to Australia and Eastern Australia time zone in the parameter but there is an error coming up which say "does not contain the definition for Australia or Eastern Australia".



algotrader - July 08, 2014 @ 10:11

In Australia you need to specify one of these time zones: CenAustraliaStandardTime, EAustraliaStandardTime, WAustraliaStandardTime.

1023881 - July 09, 2014 @ 10:18

Thanks a lot...I will let you know the outcome



jeed2424 - July 09, 2014 @ 19:14

Hey, I tried different ways to write my time zone, but it doesn't seems to work.

*I live in Canada: Eastern Canadian time zone

jeed2424 - July 09, 2014 @ 19:22

Sorry, but I don't see it working... Is this normal?


megamemo - July 17, 2014 @ 06:18

hi to everyone im neewbie on the bot side and 2 years of trading wich i love it and i can tell you how great work you got here this is beautyfull people sharing there passion one cuestion about changing the time zone i know where to put it but i dont know what shut i write im form venezuela and is caracas time i will really thanks if someone cut helpme and else what framework and pair do you people of here find it more profitable thanks again 

algotrader - July 17, 2014 @ 11:06

News Robot has been updated. Now you don't need to specify TimeZone. Robot also prints remaining time to chart.

barrenwuffett - July 21, 2014 @ 17:18

Could you please add a custom label field to this?

barrenwuffett - July 21, 2014 @ 17:27

it's also missing the day to trade field 

megamemo - July 23, 2014 @ 04:42

hi great im startimg to really love it but would be grat if you put a trailing stop or breakeven 

tosabrown - September 04, 2014 @ 17:01


What's the purpose of it when it hedges in two directions? You should have separated the buy and sell into separate robots. Or you could have made it into one robot but allowed the buy and sell to be changed by the user. I really don't see the purpose of a robot that initiates a trade in opposite directions by the same number of pips. The least you could have done is make the take profit pips adjustable on each side. I'm surprised no one one this thread brought these things up.

kaffum - September 10, 2014 @ 23:11

Hello, algotrader, how do I set up this robot, it seems it unable to execute orders during news times

kaffum - September 10, 2014 @ 23:27

the only lines showing is the pip away lines, 

BigStackBully - September 12, 2014 @ 14:26


Hey Guys,

Jompa asked Dec 2012 for results. Would be my #1 question, too.

MyFXBook real money account? Or at least demo? Backtests?




L0pg - September 15, 2014 @ 03:46



You are missing the point, they are PENDING orders, waiting for the initial move so you don't have to pick buy or sell. It sets both orders, and whichever is triggered gets the pips.

L0pg - September 15, 2014 @ 03:49


I am running this on a SUPER micro account, I took 3$ up to 35$, then got a 22 pip slip on stop loss, and went back to 3$. One trade after that massive loss and it is back to 6$. So, I will continue my experiment until I am rich beyond my dreams (lol) or until I implode the account trading as much as I can at 1:500. Either way, I only risk 3$.

9541321 - September 26, 2014 @ 17:31

I need help... The system makes the orders, but then deletes them immediately. What is up? How can I solve this problema?

9541321 - September 26, 2014 @ 18:17

Hi there. I´m in Portugal so time zone is UTC+1. It wont work when I place this in the bot. Any ideas on the correct time zone configuration? Kind regards

kestkam - October 08, 2014 @ 12:03

Anybody tell me please if I can use the News Robot on my MT4 platform? If it's possible how can I do that?

megamemo - October 28, 2014 @ 02:29

hi one question again man this robot shoot the orders until it gets a server confirmation or do not?

have a nice day!

megamemo - October 28, 2014 @ 02:30

by the way man thanks the other time for the help with the bot i when the 3th place on that contest thanks to your bot!!

moneyfred2014 - November 06, 2014 @ 16:03

Installed on two pairs and it executed a few buy and sell orders, none of which were successful. The log message is that they "expired". I use the default settings. Any hints?

9570316 - December 19, 2014 @ 09:58


First, thanks for your job. :)

Then, can I ask you something...What and where should I write in your source code to have a daily repeat of the action?

For example, if I want the same parameters repeat every day at 7pm? Like if I have the same news every day at the same hour?

I know it s sound unusual, but you can imagine that I have my reason. And I will share it if it works.

Thanks in advance.

David - December 30, 2014 @ 14:14

kestkam - October 08, 2014 @ 12:03

Anybody tell me please if I can use the News Robot on my MT4 platform? If it's possible how can I do that?

no. cTrader bots cannot be used with mt4.



SwapBridgeCapital - May 03, 2015 @ 00:56

You can use trade copier from ctrader to your mt4, but I don't see the reason to do so because this platform is better for news trading.  

akkoakko - July 19, 2015 @ 16:37

Hi Im New to Ctrade Can Anyone tell me what should I do to setup this Bot because Im back testing it and showing no results for almost 2 H 


8088297 - August 07, 2015 @ 08:29

Thank you sir

jsulus - August 09, 2015 @ 14:14

Thank you man!!!!!

Timmi - November 17, 2015 @ 23:36

Is it possible, to set both, a move to break even (+pips), and thereafter have a trailing stop after specified number of minutes?  the parameters would not be the same for the two.  in cTrader you can only set one or the other, but most of the time I have to go back and set a trailing (with different parameters) once break-even has been locked in. 

Because of high volatility, I would not want a trailing stop in the first few minutes, so I am not thrown out prematurely. Once things settle down, than let it trail.  For example, after 3 minutes, or 5 minutes, commence a trailing stop. 

For example: Move to break-even plus 10 after a 50 pip gain, then trail for 10 after the 5 minutes mark.  (that would allow for the fast fluctuations while protecting against a loss, and later capture an additional move)


bhagya3udana856 - April 13, 2017 @ 12:08


I love this cbot.

Can you please add this to trailing stop.


Marek.Hurkens - August 28, 2017 @ 16:43

Hey Algotrader,

I love this bot it works smooth and perfect.

How much do i need to pay you to offer us the same one with money management and trailing Stop?

nice greeds

bulatsergiu83 - September 08, 2017 @ 00:57


Great work!

Can you help me, please , to change this bot to work just for BUY or SELL orders , NOT for BOTH in the same time!?

Thank you for your time and help!!!

Have a nice day and STAY GREEN!!!

luis_q - October 10, 2017 @ 20:55

What can I do to buy the News Robot PRO with Trailing Stop and Slippage Control?



mert.19.04 - October 12, 2017 @ 01:06

Hi.I have 2 questions about your EA first one is How can i change UTC for my Republic of Turkey(we are using UTC+3)And seconde question is when i tried to use this code the system gave eror how can i fix ?

 Trade.CreateBuyStopOrder(Symbol, Volume, buyOrderTargetPrice, buyOrderTargetPrice - StopLoss * Symbol.PipSize, buyOrderTargetPrice+ TakeProfit * Symbol.PipSize, expirationTime);PlaceStopOrder(TradeType.Buy, Symbol, Volume, buyOrderTargetPrice, Label, StopLoss, TakeProfit, expirationTime);

mert.19.04 - October 12, 2017 @ 01:32

ALGO Turn to me its urgent 

EA is not work it starts take order 5 secondes later 

it was closed all orders

how can be possible 

Also why we are waiting every time allmost 21 hours ?

HELP ME - October 22, 2017 @ 02:45

Can someone help me to add a Slippage control. Like to set maximum negative slippage allowed for a triggered order.


skuza.tomasz - November 11, 2018 @ 16:22

hi it is posible to place this order by hand ???not on specific time ?

tgjobscv - April 25, 2019 @ 20:41

New ver ?

freyrthegreat - May 13, 2021 @ 09:00

how to change to amount of lot to be open?