if (ToTime(Time[0]) >= 160000 || ToTime(Time[0]) < 90000) {
if (Position.MarketPosition == MarketPosition.Long) {ExitLong(); return;}
if (Position.MarketPosition == MarketPosition.Short) {ExitShort(); return;}
//ExitShort();ExitLong();
return;}
It works correctly in that it never takes trades before 90000, however, it doesn't always exit at 160000. I'd say about 90% of the time, it executes correctly and exits any position at 160000, but the rest of the time, it leaves the position open and never closes or changes it in any way (it doesn't take trades based on the rest of the strategy logic following the above snippet). Using prints, it clearly registers the if statements as true and then registers the return. It appears the strategy does not recognize it's own position and theirfore will not ExitLong() or ExitShort(). How can I fix this?

Comment