I am trying to write a loop and having some issues. What I am trying to do is evaluate if the ADX had a specific value within the last X number of bars. If it does then continue with the rest of the code. Below is a sample of what I am trying to do but not with much luck. What I am trying to do is if the first statement is true then the ADX is evaluate on period ADXPeriod for ADXLookback bars to see if it is >= ADXThreshold. If at any time it is then I want it to go onto the next piece with Bollinger. The other problem I run into is if I just want to evaluate the current bar [0] there is no way to enter 0 in a parameter in the indicator if I have OnBarClose = false. It auto saves as 1.
if (DM(DM5Period).DiPlus[0] >= DM(DM5Period).DiMinus[0])
for ( int i=0; i < ADXLookback; i++)
{
if (ADX(ADXPeriod)[i] >= ADXThreshold);
}
if (Bollinger(NumStdDev,PeriodB).Upper[0] >= KeltnerChannel(OffsetMultiplier, PeriodKel).Upper[0])
Comment