/// In State == State.SetDefaults)
Calculate = Calculate.OnEachTick;
/// In OnBarUpdate()
double pAP = Position.AveragePrice;
bool loss10Ticks = Close[0] <= ( pAP - (10 * TickSize) );
if ( loss10Ticks )
{
ExitLong();
}
I noticed at first it did not execute the ExitLong() order despite conditions met.
Then I tested adding prints before the Exit statement like this and it now works:
/// In State == State.SetDefaults)
Calculate = Calculate.OnEachTick;
/// In OnBarUpdate()
double pAP = Position.AveragePrice;
bool loss10Ticks = Close[0] <= ( pAP - (10 * TickSize) );
Print(" ");
Print("pAP: " + pAP);
Print("loss10Ticks: " + loss10Ticks);
if ( loss10Ticks )
{
ExitLong();
}
Why didn't the 1st version work without intermediary prints?
Is there some best practice missing?
Why does the prints prompts work better?

Comment