MACD histogram color

#1
Is it possible to color the MACD histogram bars red when above zero and green when below zero.

I am able to color the price bars based on MACD by creating an Expert Advisor. But how do I color the MACD histogram bars?
 
Last edited:
#2
Anyone know for if color coding of indicators on a general basis is possible in Metastock. I have done this in AmiBroker, but I can't figure out how to do it in Metastock.
 
#3
Also if someone could throw some light on how to color the rising histogram bars green and falling bars red.

This will be beneficial for other oscillators too.
 

THE LORD

Active Member
#4
'have very nice trading

r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
ml = MACD(r1, r2);
dd= Signal(r1,r2,r3);
ColorT=IIf(ml>0 AND ml>Ref(ml,-1),colorRed,colorGreen);
Plot(ml-dd ,"MACD Histogram",ColorT,styleHistogram|styleThick);
Plot(0,"",colorWhite,styleLine+styleThick);
 
#6
Thank you Mortenso.

As you rightly said we need Metastock Code for coloring MACD Histogram bars!!

I'm trying another thread also on the same subject, if I get the answer I'll put it over here.
 
#9
This is the AmiBroker AFL code.
The question is how to do it in Metastock.

create 2 indicator

indicator 1:

If(Mov(C,12,E)-Mov(C,26,E)-Mov(Mov(C,12,E)-Mov(C,26,E),9,E)<0,Mov(C,12,E)-Mov(C,26,E)-Mov(Mov(C,12,E)-Mov(C,26,E),9,E),0)


========
indicator 2:

If(Mov(C,12,E)-Mov(C,26,E)-Mov(Mov(C,12,E)-Mov(C,26,E),9,E)>0,Mov(C,12,E)-Mov(C,26,E)-Mov(Mov(C,12,E)-Mov(C,26,E),9,E),0)

========
put both in same window. set color 1 for red, color 2 for blue

you can make this idea with volume and anything, have fun
 

Similar threads