The problem is that the ExitLong does not take the condition in to account. The places where the system exits does not even change when I comment the "if (Close[0] < LLstop) condition out. The trades are ALWAYS closed out after 1 bar (i.e. on the second bar) even if the condition is nor true.
I have inserted print statements to check the values of the variables and all looks fine
Any input would be appreciated.
// Buy trigger
if (Position.MarketPosition != MarketPosition.Long)
{
HighestHighforlong = 0;
LLstop = 0;
if (MyDmipp[0] > MyDmimm[0] && MyDmipp[1] > MyDmimm[1])
{
HighestHighforlong = MAX(High,3)[0];
if ((Close[0] + TickSize) > HighestHighforlong)
EnterLong();
}
}
if (Position.MarketPosition == MarketPosition.Long)
{
LLstop = MIN(Low,4)[BarsSinceEntry()];
if (Close[0] < LLstop);
ExitLong();
}

Comment