Here is my code for exit:
if(this.iUseEOBExit)
{
if(
// Exit after set number of bars
BarsSinceEntry() == this.iBARSSINCEENTRY ||
// Exit if bar closes below entry price + some offset
Close[0]<Position.AvgPrice - this.iTICKSIZE*TickSize
)
{
if(this.iQuantity1 != 0 && tVars.iOrder[1] == null)
tVars.iOrder[1] = ExitLong("eob", string.Empty);
return;
}
}
If I comment out the 'BarsSinceEntry' portion, the other exit which is based on bar close below entry price works. What am I doing wrong? Thanks in advance

Comment