Best way to not open position after trading hours
Created at 06 Aug 2020, 11:02
Best way to not open position after trading hours
06 Aug 2020, 11:02
private bool IsTradingHours()
{
if (Server.Time.DayOfWeek == DayOfWeek.Friday && Server.TimeInUtc.TimeOfDay > new TimeSpan(20, 0, 0))
{
return false;
}
return true;
}
Hi,
I don't want my robot to trade near closing hours every friday both in live and backtesting. Is the code above the best way to deal with it where after 8PM Friday, no trade will be executed?
I find that when I'm back testing time is UTC +3. I trade with IC Markets.
Thanks,
PanagiotisCharalampous
06 Aug 2020, 11:06
Hi ac15x,
Seems fine to me. Did you run into any issues?
The cBot timezone is defined in the Robot attribute
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous