Plotting MACD as it is displayed in typical charting programs
Author: Haggis
Creation Date: 3/6/2012 7:09 PM
profile picture


Not a programmer, sorry. Trying to plot MACD on a chart as it appears in normal trading programs...with the histogram, and then the two EMA lines that cross. I realize that a cross of the 2 lines causes the zero line to be crossed, but how do I display MACD properly in the MACD pane? Tried to find a forum on this one, but to no avail.


profile picture


Hi Phil,

Copy this code into a new Strategy window and Execute:

Standard Indicators > MACD

As an alternative, standalone MACD Histogram indicator exists in the Community Indicators library (follow this installation how-to and restart WLP for the change to apply).
profile picture


There's actually a "how-to" drag and drop a MACD with histogram in the Divergence Indicator wiki.
profile picture


Sorry for the simple question here as I know little about programming.

Like the original poster, I want to apply just a normal two lines plotted for a standard MACD.

I clicked this link provided and get error messages when I compile:

error CS0103 @ (3.924) : The name 'macdbar' does not exist in the current context
error CS0103 @ (3.1006) : The name 'macdbar' does not exist in the current context

This does not need to buy or sell. I'm just looking to plot two lines. In the program I only see one line of what I presume is the difference.

Thanks in advance

profile picture


Please copy/paste the code again. You happened to visit the Wiki in one of those very rare unfortunate moments when it failed to deliver the code formatted properly, hence the syntax error. This has been fixed.
profile picture


i have the following code and it compiles but i am not able to plot macd leader on the chart please help thanks.

Please log in to see this code.

i would like to view the crossover signal and macd leader on the same chart, thanks
profile picture


Please log in to see this code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).