_SECTION_BEGIN("Flower_HA_Normal Candle");
Show_color = ParamToggle("Display CandleColor", "No|Yes", 1);
r1 =5; //Param( "ColorFast avg", 5, 2, 200, 1 );
r2 =10; //Param( "ColorSlow avg", 10, 2, 200, 1 );
r3 =5; //Param( "ColorSignal avg", 5, 2, 200, 1 );
Prd1=4; //Param("ATR Period",4,1,20,1);
Prd2=7; //Param("Look Back",7,1,20,1);
green = HHV(LLV(L,Prd1)+ATR(Prd1),Prd2);
red = LLV(HHV(H,Prd1)-ATR(Prd1),Prd2);
HaClose =EMA((O+H+L+C)/4,3); // Woodie
//HaClose =(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
//HaClose = ( HaClose + HaOpen + HaHigh + HaLow )/4;
Temp = Max(High, HaOpen);
Temp = Min(Low,HaOpen);
//////////
m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 AND m1>s1, ColorRGB(230,230,0),IIf(m1>0 AND m1>s1,colorWhite,IIf(m1>0 AND m1<s1,colorOrange,colorDarkRed)));
if(Show_color)
{
ColorHighliter = mycolor;
SetBarFillColor( ColorHighliter );
}
barColor=IIf(C>Green ,colorWhite,IIf(C < RED,colorRed,colorYellow));
barColor2=IIf(Close > Open, colorWhite, colorRed);
if( ParamToggle("Plot Normal Candle", "No,Yes", 1 ) )
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, " " , barcolor, styleCandle | styleThick );
else
PlotOHLC( Open, High, Low, Close, " " , barcolor2, styleCandle | styleThick );
_SECTION_END();