Need help in AFL coding, want to highlight an area based on a certain criteria

Have written a code to paint the candles in custom colors.
Blue candle: If candles body (abs(open-close)<50% of the range (high-low).
Red candle: Body>50% of range and open<close
This is working fine.
Now I want to highlight an area where system finds two consecutive RED candles and one Blue candle.
I want to draw an area where bottom is lower body of the blue candle and top is the High of the Blue candle. This particular area needs to start from the Blue candle and will extend till the current candle.
I am pasting the code here. Please have a look.

function ctype(o1,h1,l1,c1) // function for determining Candle type, 1: Body less than 50% of the range 2: Down candle, 3: Up candles
{ body=abs(o1-c1);
  typ = IIf(rati<=.5,1,IIf(o1>c1,2,3));

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
color = IIf(col==1, colorBlue, IIf(col==3,colorGreen,colorRed));
Plot(C,"Price",color,styleCandle ); 
// Till this point it works fine.

// now from current candle I want go thru the candles, if system finds two consecutive RED candles and one BLUE candle just prior to that,
// System needs to draw an area from that blue candle, bottom line is the minimum(close, open) of the Blue candle and top line is high of the blue candle. 

lbk=50; // System to look back 50 previous candles
    for( i = 0; i <lbk; i++ ) 
     sig1=IIF(b1==2 AND b2==2 AND b3==1,1,null);
     // system to draw red area only when it finds combination of Red => RED => Blue candles when going backward.
     // if (sig1=1) {  .......} could not be used as system asking it to be an array.
     colo=IIF(b1==2 AND b2==2 AND b3==1,colorred, null); //workaround onlt to draw with red for the intended criteria and conlor is none when criteria not met.- not efficient way.
     Line=Linearray(-2,lb, 0,lu);
     Plot( Line, "Trend line", colorBlue ); 

Hi All,
This can be closed.
Thank you for viewing.