else if (Close[0] < emaLow)
{
if (Position.MarketPosition == MarketPosition.Long)
{
ExitLong("Below EMA", "");
}
EnterShortPositionsIfAllowed();
}
EnterShortPositionsIfAllowed() checks that marketposition.flat is true. But because the exit and entry code is basically executed at the same time, marketposition always returns not flat. If i don't check for marketposition.flat, it will double my entry in the other direction due to exiting the position, and at the same time reversing the position in the EnterShortPositionsIfAllowed method.
I know that i could get it to work by simply allowing it to reverse my position and not callign ExitLong, but for analysis of my trades i really want to rename that exit. Is there anyway to run the statements in sequence, waiting for one to complete before executing the other?

Comment