I am trying to build out a PPO but first I’m trying to base that on the MACD being replicated in the last panel of the attached chart.

Can someone please let me know why the lines are not matching the MACD tool in the second panel when I have tried to code it in the third panel. It is important that I get this to work first before I tailor the coding to make it a percentage etc – all I need help with is the exact code I need to use to replicate the MACD tool. Thanks and I look forward to hearing from you.

Kind regards,


Sent-to-Optuma-15.06.2020.owb (22.9 KB)


If i’m reading your post right you’re trying to manually calculate a MACD rather than use the function prebuilt in Optuma Scripting? If that’s the case you can use the following:

//Set Moving Averages
V1 = MA(STYLE=Exponential, CALC=Close, BARS=12) ;
V2 = MA(BARS=26, STYLE=Exponential, CALC=Close) ;
//Calc Difference bettwen V1 and V2
V3 = V1 - V2;
//9EMA of V3
v4 = MA(V3, STYLE=Exponential, CALC=Close, BARS=9) ;
//Dif Between V4 and V3
V5 = V3 - v4 ;
//Output both lines and Histogram
plot1 = v3;
plot2 = v4;
plot3 = V5;
plot3.Plotstyle = Histogram;

This matches the MACD Combo applied to the chart (workbook attached).

MACDManual.owb (11.8 KB)

That’s perfect, thank you.

Hi Karen,

If you search for PPO in the forum you will find this post: