Change Colors - Histogram

#1
Hello everybody!

Does anyone know if it is possible to have Metastock 9.0 change the colors of an histogram if values are going up or down?

Thanks for the help!
traderbrazil
 

THETRADER

Active Member
#2
You can use a trick to achieve that. Use 2 indicators, one for positive & another for negative, and, use 2 different colors for the 2 indicators! Plot them both on the same window, same scaling, etc.,
 
#3
You can use a trick to achieve that. Use 2 indicators, one for positive & another for negative, and, use 2 different colors for the 2 indicators! Plot them both on the same window, same scaling, etc.,
Im not sure I understand what you mean. If I plot them in the same window, one indicator will just overlap the other and I will just see the last one plotted...
 

THETRADER

Active Member
#4
You've to write (modify) 2 indicators corresponding to the indicator that you want to plot. The new indicators (1 & 2) will have positive value and negative value respectively, viz., Indicator 1 will be zero if the original indicator is below zero (-ve). This indicator will plot positive side only. Indicator 2 will be zero if the original indicator is above zero (+ve), ...
You will have to write these indicators, and, color them. If your indicator is x, say, then the following formula will calc the 2 indicators as explained above.

x1:=if(x >= 0, x, 0);
x2:=if(x <= 0, x, 0);
x1;
x2;

Now you can color x1 & x2 differently.
 
#5
Hi THETRADER,

Thank you for your input.
Unfortunately I'm not really familiar with MS language.
Below is the formula for the histogram I'm using:

SMI (13,25,2)

q:=Input("Lookback Periods?",1,1000,13);
r:=Input("First EMA Periods?",1,100,25);
sm:=Input("Second EMA Periods?",1,100,2);
100 *
(Mov(Mov(C-(0.5*(HHV(H,q)+LLV(L,q))),r,E),sm,E) /
(0.5*Mov(Mov(HHV(H,q)-LLV(L,q),r,E),sm,E)))

I would really appreciate if you could apply your formula to it.

Best regards and thank you once again!
traderbrazil
 

THETRADER

Active Member
#6
The new indicator is given below, which will plot 2 lines, x1 & x2. x1 is above 0, and, x2 is below 0. Select these separately, and, change style to histogram and required color for each. Hope this is helpful.


SMI (13,25,2)

q:=Input("Lookback Periods?",1,1000,13);
r:=Input("First EMA Periods?",1,100,25);
sm:=Input("Second EMA Periods?",1,100,2);

x:=100 *
(Mov(Mov(C-(0.5*(HHV(H,q)+LLV(L,q))),r,E),sm,E) /
(0.5*Mov(Mov(HHV(H,q)-LLV(L,q),r,E),sm,E)));
x1:=if(x >= 0, x, 0);
x2:=if(x <= 0, x, 0);
x1;
x2;
 

Similar threads