I would like to assign past 8 bars of array BB
with false
value when current bar of array AA
is true
. This is the code I wrote;
for( i = 8; i < BarCount; i++)
{
if (AA[i] == True)
{
BB[i] = False;
BB[i-1] = False;
BB[i-2] = False;
BB[i-3] = False;
BB[i-4] = False;
BB[i-5] = False;
BB[i-6] = False;
BB[i-7] = False;
BB[i-8] = False;
}
}
The code works fine but it uses the loop approach. Loop approach is slow and is not suitable for Amibroker. How can this AFL code using loop be converted into a faster, more elegant array approach?