# Help me coding this AFL plzzzz

#### Isabella

##### Member
Hey Guys,
Can any one help me out codeing this;-

1.Bar colour = Green if 5 SMA > 15 SMA AND 5 SMA > 30 SMA.
2.Bar colour = Red if 5 SMA < 15 SMA AND 5 SMA < 30 SMA.
3.Bar colour = Yellow if 5 SMA < 15 SMA AND 5 SMA > 30 SMA OR
5 SMA > 15 SMA AND 5 SMA < 30 SMA.

Oh ya the option of line, candle or OHLC should be available .
Thank ya all

IsA

Last edited:

#### colion

##### Active Member
Hey Guys,
Can any one help me out codeing this;-

1.Bar colour = Green if 5 SMA > 15 SMA AND 5 SMA > 30 SMA.
2.Bar colour = Red if 5 SMA < 15 SMA AND 5 SMA < 30 SMA.
3.Bar colour = Yellow if 5 SMA < 15 SMA AND 5 SMA > 30 SMA OR
5 SMA > 15 SMA AND 5 SMA < 30 SMA.

Oh ya the option of line, candle or OHLC should be available .
Thank ya all

IsA
color = iif( ma(c, 5) > ma(c, 15) and ma(c,5) > ma(c,30), colorgreen, iif( ma(c,5) < ma(c,15) and ma(c,5) < ma(c,30), colorred, iif(( ma(c,5) < ma(c,15) and ma(c, 5) > ma(c, 30) ) or (ma(c,5) > ma(c,15) and ma(c, 5) < ma(c, 30)), coloryellow, colorwhite ) ) ); //colorwhite if none of the conditions met

plot( c, "", color, paramstyle("price style", styleline , maskall ));

#### SHREENATHJIINVESTMENT

##### New Member
color=SetBarFillColor( IIf( MA(C, 5) > MA(C, 15) AND MA(C,5) > MA(C,30), colorGreen, IIf( MA(C,5) < MA(C,15) AND MA(C,5) < MA(C,30), colorRed, IIf(( MA(C,5) < MA(C,15) AND MA(C, 5) > MA(C, 30) ) OR (MA(C,5) > MA(C,15) AND MA(C, 5) < MA(C, 30)), colorYellow, colorWhite ) ) )); //colorwhite if none of the conditions met

PlotOHLC( O,H,L,C, "", color, ParamStyle("price style", styleCandle , maskAll ));

TRY THIS