Chaikin moneyflow color afl (help need)

#1
I am trying to modify chaikin money flow afl like following picture where upward bar will green color and downed bar will red color in histogram. here is the code where it shows same color for up and down. please help me out.

function CMF(r1)
{
//Graph0=(AD(C,H,L,V,r1)*V)/ Sum(V,r1);
Graph0=Sum(IIf( H>L && V>0,((( C-L )-( H-C )) / ( H-L ))*V,0),r1) / Sum
(V,r1);
dynamic_color = IIf( Graph0> 0, colorGreen, colorRed );
Plot(Graph0, "Chaikin Money Flow ("+r1+")", ParamColor( "Color",
colorCycle ), styleHistogram | styleThick);

}
r1=Param("Periods", 21);
CMF(r1);
 

Attachments

Thread starter Similar threads Forum Replies Date
V Technical Analysis 1

Similar threads