I'm trying to create a strategy to close any open positions at a certain time of day, but I can't get it to work. I'm using the strategy builder and I have the following conditions:
// Condition set 1
if (ToTime(Time[0]) == ToTime(9, 0, 0)
&& Position.MarketPosition == MarketPosition.Long)
{
ExitLong("", "");
}
// Condition set 2
if (ToTime(Time[0]) == ToTime(9, 0, 0)
&& Position.MarketPosition == MarketPosition.Short)
{
ExitShort("", "");
}
What am I doing wrong?
Thanks.
Comment