If an indicator can be displayed as a histogram, you can easily plot it with multiple colors using conditional statements. This allows you to specify different colors for different conditions. The following examples demonstrate how this is done with the MACD and the Volume, using MetaStock for Windows.
The first example shows you how to display the MACD as a multi-colored plot. The conditions are; if today's MACD is greater than yesterday's, plot a green histogram, or if today's MACD is less than yesterday's, plot a red histogram. To create the formulas, choose the Indicator Builder from the Tools menu in MetaStock and enter the following formulas. Note: each formula needs to be added as a separate formula.
Name: MACD +
Formula: If(MACD()>=Ref(MACD(),-1),MACD(),0)
Name: MACD -
Formula: If(MACD()<ref(MACD(),-1),MACD(),0)
Name: MACD Signal Line
Formula: Mov(MACD(),9,E)
Then to display the indicators in MetaStock:
<lI>Drag the MACD + from the Indicator QuickList to a new inner window.
<lI>Double-click on it and change the style to a histogram and change the color to green.
<lI>Next, drag the MACD - from the Indicator QuickList to the same inner window.
<lI>Double-click on it and change the style to a histogram and change the color to red.
<lI>Next, drag the MACD Signal Line into same inner window and change the color to black.
The conditions for the second example are; today's volume is greater than yesterday's volume, or today's volume is less than yesterday's volume. Follow the same steps as above to create and plot the formulas.
Name: Volume +
Formula: If(V>=Ref(V,-1),V,0)
Name: Volume -
Formula: If(V<ref(V,-1),V,0)
The conditions for the last example are; today's volume is greater than its 10 day Moving Average, or today's volume is less than its 10 day Moving Average. Again, follow the steps from example one to create and plot the formulas.
Name: Moving Average Volume +
Formula: If(V>=Mov(V,10,S),V,0)
Name: Moving Average Volume -
Formula: If(V<mov(V,10,S),V,0)
Use the above examples and modify them for your favorite indicator and preferred conditions to create your own multi-colored indicators.