AFL Syntax Error

#1
Hi
I am trying to run CBL code in AmiBroker 6.20.1 but it is showing Multiple error messages.

Code:
#Indicator

#Param "HighDays", 13
#Param "LowDays", 13

Dim CBLhi, CBLlo as single

CBLhi = IIF (H < HHV(HighDays), CBLhi[1], _
IIF(L[2]<L[1] and L[2]<L and L[1]<L, L[2], _
IIF((L[3]<L[2] and L[3]<L[1] and L[3]<L) and (L[2]<L or L[1]<L), L[3], _
IIF((L[4]<L[3] and L[4]<L[2] and L[4]<L[1] and L[4]<L) and (L[3]<L or L[2]<L or L[1]<L), L[4], _
IIF((L[5]<L[4] and L[5]<L[3] and L[5]<L[2] and L[5]<L[1] and L[5]<L) and (L[4]<L or L[3]<L or L[2]<L or L[1]<L), L[5], CBLhi[1])))))

CBLlo = IIF (L > LLV(LowDays), CBLlo[1], _
IIF(H[2]>H[1] and H[2]>H and H[1]>H, H[2], _
IIF((H[3]>H[2] and H[3]>H[1] and H[3]>H) and (H[2]>H or H[1]>H), H[3], _
IIF((H[4]>H[3] and H[4]>H[2] and H[4]>H[1] and H[4]>H) and (H[3]>H or H[2]>H or H[1]>H), H[4], _
IIF((H[5]>H[4] and H[5]>H[3] and H[5]>H[2] and H[5]>H[1] and H[5]>H) and (H[4]>H or H[3]>H or H[2]>H or H[1]>H), H[5], CBLlo[1])))))

PlotPrice("CBLhi", CBLhi, Red, 1)
PlotPrice("CBLlo", CBLlo, Green, 1)

Return 0
Can someone please rectify this error.
Thank you
 
#5
Yup it does.
I have another code for that. but it is not procuding Accurate Results.

Code:
nR=2;
Cbl[nR]=Null;
 bCBL=False;
 
     for( i=nR; i < BarCount; i++)
     {
         if( (High[i-2]>High[i-1]) && (High[i-1]>High[i]) )
         {
             Cbl[i] = High[i-1];
             bCBL = True;
         }
         else if (bCBL)
         {
             if (High[i] > Cbl[i-1])
             {
                 Cbl[i] = Cbl[i-1];
                 bCBL = False;
             }
             else
             {
                 n = nR;
                 maxval[i] = High[i];
                 breakloop= False;
                 for (j = 1; NOT(breakloop) && j <= i; j++)
                 {
                     if (High[i-j] > maxval[i])
                     {
                         if (n>1)
                         {
                             maxval[i] = High[i-j];
                             n--;
                         }
                         else
                         {
                             Cbl[i] = High[i-j];
                             breakloop=True;
                         }
                     }
                 }
                 if (Cbl[i] > Cbl[i+1])
                 Cbl[i] = Cbl[i+1];
             }
         }
         else
         {
             Cbl[i] = Cbl[i-1];
         }
     if (Cbl[i]==0)
     Cbl[i] = Cbl[i-1];
     }
 
 Plot(Cbl,"",colorRed,1);
 Plot(C,"",-1,64);
Please someone help me solve this
 

Similar threads