Hello all,
So I have been studying this loop over and over again and have a problem. It
is used for sigscaleout. I am not sure what i=j does in the code. I should
say why it does what it does. When I remove the i=j in the code, then the
chart plots multiple short signals for that short. WHen the i=j is
put back in the code then only one signal is plotted. Kind of like what
EXREM does. MY question is WHY????
can anyone help??
if ( Short [ i ] )
{
priceatshort = ShortPrice[ i ];
LowsinceShort = 0;
lowsinceshort = Min( Low[ i ], lowsinceshort );
shortAdjusted[ i ] = 1;
shortPriceAdjusted[ i ] = ShortPrice[ i ];
FirstProfitTargetArrayS[ i ] = priceatshort - FirstProfitTargetS;
for (j = i + delay; j < BarCount; j++)
{ LowsinceShort = Min( Low[ j ], LowsinceShort );
lowSinceshortArray[ j ] = lowsinceshort;
FirstProfitTargetArrayS[ j ] = priceatshort -
FirstProfitTargetS;
if( High[ j ] >= TrailStopArrayS[ j ] )
{ Cover[ j ] = 1;
CoverPrice[ j ] = Max( Open[ j ], TrailStopArrayS[ j ] );
i = j;
break; }
if( exitType == 0 AND Low[ j ]<= (priceatshort -
FirstProfitTargetS) )
{
// first profit target hit - scale-out
exitType = 1;
ShortAdjustedScale[ j ] = sigScaleOut;
ShortPriceAdjusted[ j ] = Min( Open[ j ], (priceatshort -
FirstProfitTargets) );
}
if (j == BarCount - 1)
{ i = BarCount; }
}
}