Stop robot on expiring date

Created at 20 Jan 2014, 17:50
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
kricka's avatar

kricka

Joined 13.03.2013

Stop robot on expiring date
20 Jan 2014, 17:50


Is there a way to stop the robot when a specific date occurs?


if( Server date is => month-day-year)
{
    Stop();
}

This will stop the robot on that date and trying to start the robot again after the expired date, would not be possible.


Thanks..


@kricka
Replies

atrader
21 Jan 2014, 16:43

You mean like this:

DateTime stopDate = new DateTime(2014, 01, 31);
if (Server.Time.Date == stopDate)
{
    Stop();
}

Add this in the beginning of the OnStart method so that it will prevent it from starting.


@atrader

kricka
21 Jan 2014, 18:42

Hi atrader,

thanks for the code, works just fine.


@kricka

tanakorn5905
07 Nov 2015, 21:59

RE:

atrader said:

You mean like this:

DateTime stopDate = new DateTime(2014, 01, 31);
if (Server.Time.Date == stopDate)
{
    Stop();
}

Add this in the beginning of the OnStart method so that it will prevent it from starting.

 


@tanakorn5905