Ed
You assisted me with the following code (your code) on March 23rd.
The background to our discussion was that I wanted to understand how
to hold for a number of periods.
I wondered if I could ask you a couple
of questions on your code (at
end):
SetBarsRequired(10000,10000);
triggerPercentage = 1.03;
waitPeriod = 15;
Setup = C <
BBandBot(C,20,2);
for (i = 0; i < BarCount - waitPeriod; i++)
{
if (Setup[ i ]) {
for (j = i + 1; j < i + waitPeriod;
j++) {
Setup[ j ] = 0;
}
i = j;
}
}
1. Is it correct to refer to the j loop as being "nested" in the i
loop? I'm wondering whether the j loop completes its internal loop
for
the 15 or so bars and then re-enters the i loop at the end or
whether both
i and j loops run the 15 or so times?
2.
"i<BarCount-waitperiod" ? can you explain how the code translates
that please? I thought that would have meant you terminate once the
current bar is less than the total number of bars less 15, whereas
it
seems to me an you terminate at 15.
3. You mentioned when we previously
discussed this issue that Setup
has a "1" wherever C < BBandBot. Is
that why in other codes,
sometimes the values of an array are set to 0
before a loop (to
remove any previous arrays triggered)?
Thanks for
your assistance,
Bernard