Percentage Price Oscillator (PPO)

The Percentage Price Oscillator (PPO) is similar to the MACD in that it calculates the difference between two moving averages, but the key difference is that the PPO calculates the percentage difference, not the MACD’s absolute difference.

We can create this as a custom tool, using the following formula for a 12/26/9 PPO:

//Calculate the Moving averages
MA1 = MA(BARS=12, STYLE=Exponential, CALC=Close);
MA2 = MA(BARS=26, STYLE=Exponential, CALC=Close);

//Calculate the output plots
Plot1 = ((MA1 - MA2) / MA2)*100;
Plot2 = MA(Plot1, BARS=9, STYLE=Exponential);
Plot3 = Plot1 - Plot2;

//Define the output line/colours
Plot1.Linestyle = Solid;
Plot1.Color = Green;

Plot2.Linestyle = Solid;
Plot2.Color = Red;

Plot3.Plotstyle = Histogram;
Plot3.Color = Blue;

Once created, save as an indicator in a New Tool View so that when applied to a chart it appears in it’s own panel below the price chart:

Capture

Capture

Because these are percentage values it makes it easy to compare momentum between securities, rather than MACD. In this example the ASX Telecoms sector has the highest PPO Histogram value (ie momentum) at 0.87%. Compare that to Health Care which has a MACD Histogram value of 165 points, but that only represents 0.52% of the value of the index.

Capture

 

Darren, what script are you using for the MACD-H in this example? Can the bars in the PPO histogram be coloured red for negative and green for postive.

Thanks Peter

Hi Peter,

The MACD-H is a tool from the toolbox so no need to script it. For the PPO histogram colours it may be easier to remove the Plot3.Colour = Blue from the script. Then apply the PPO tool and change the Plot3 colour properties to Positive/Negative, and then click Save Settings as Default under Actions. The next time you use the PPO tool those colours will be remembered.

Capture

Hi Darren,

thanks for the note. There are now so many post on the forum you can get overwhelmed.

A last question: Can you change the script using bar variables as you have explained in your video (Scripting with Bar Variables)? Ok, it is not so difficult but you are surly faster than I.

Thanks

Thomas

Hi,

I now had the time to make the script changes to have the possibility to change the MA values of the PPO in the Properties Panel.

//Setting the values of the Moving averages for the Properties Panel
#$MA1= 12;
#$MA2= 26;
#$MA3= 6;

//Calculate the Moving averages
MA1 = MA(BARS=$MA1, STYLE=Exponential, CALC=Close);
MA2 = MA(BARS=$MA2, STYLE=Exponential, CALC=Close);

//Calculate the output plots
Plot1 = ((MA1 - MA2) / MA2)*100;
Plot2 = MA(Plot1, BARS=$MA3, STYLE=Exponential);
Plot3 = Plot1 - Plot2;

//Define the output line/colours
Plot1.Linestyle = Solid;
Plot1.Color = Blue;

Plot2.Linestyle = Solid;
Plot2.Color = Red;

Plot3.Plotstyle = Histogram;
Plot3.Color = Green;

 

Very simple. There are some helpful information on the Optuma web site to learn how to add Bar Variables to the Properties Panel.

https://help.optuma.com/kb/faq.php?id=964

https://www.optuma.com/videos/scripting-with-bar-variables/

https://www.optuma.com/videos/how-to-edit-view-tool-titles/

 

One issue I have not get solved is the tools title. For the above PPO example the tools title should read like “PPO 12, 26, 6”. Unfortunately I am able to “create” only the following tool title “PPO 12” (see my screen shot).

tools title

I appreciate any suggestion about how to get the “right” tool title.

Thanks for reading and thank you.

Thomas

Hi Optuma team,

I run into some issues about the PPO script.

I made some small changes to the script as described in the Knowledgebase article “Custom Scripted Tool - Percentage Price Oscillator (PPO)” (https://help.optuma.com/kb/faq.php?id=900).

So the script looks like the following:

//Setting the values of the Moving averages for the Properties Panel
#$MA1= 12;
#$MA2= 26;
#$MA3= 6;

//Calculate the Moving averages
MA1 = MA(BARS=$MA1, STYLE=Exponential, CALC=Close);
MA2 = MA(BARS=$MA2, STYLE=Exponential, CALC=Close);

//Calculate the output plots
Plot1 = ((MA1 - MA2) / MA2)*100;
Plot2 = MA(Plot1, BARS=$MA3, STYLE=Exponential);
Plot3 = Plot1 - Plot2;

//Define the outputs
Plot1.Linestyle = Solid;
Plot2.Linestyle = Solid;
Plot3.Plotstyle = Histogram;

Now my issues:

  1. When I change the color settings of the lines and save the changes as Save Settings as Default under Actions and close the workbook and than reopen it all the changes are gone and all line are green. What did I made wrong? This is described in this way in the knowledgebase article mentioned above.
  2. When I change the parameters under Properties the changes are calculated and displayed as they should. But again when I close the workbook and than reopen it all the changes are gone and the standard parameters in the script are used again. Is this as it should be or did I made something wrong?
Concerning the output settings, is there a Knowledgebase article about all the possible output setting available with all the color names in the standard color palette and not only green, red, blue.

Also all the line settings that are available in a script would be helpful too and not only “Linestyle = Solid”.

Last but not least, would it be possible that you take the PPO in the standard Outuma tools list as the MACD under the category “Averages”? Like the MACD all three options “MACD Combo”, “MACD Histogram”, and “MACD Line” would be very helpful. I think the programming efforts are not really great. There are a lot of more or less useless tools available but the PPO is in my opinion not a useless tool. Especially since the PPO allows the creation of some sort of ranking system between indices, stocks, and ETFs, a great issue!

Thanks as always a lot.

Thomas

 

Thanks Thomas. We’ll look at why the default settings aren’t being remembered for custom tools. For more information on multi-output scripts and setting the colours in the formula see here:

https://help.optuma.com/kb/faq.php?id=722

We’ll look at adding PPO as a tool in 1.7.

Finally, when posting formulas please use the <>Code button in the format bar which removes all formatting when copying and pasting in to Optuma [I updated your original post]. See this pinned post for instructions:

How to Add Code to Forum Posts

Thanks!

Hi Daren,

I’m trying to create a system as practice for the CMT 3 exam
The system will try to look for instances where the MACD is below zero and then the slope turns positive and then gives a buy signal. As an example of where the MACD must be, I have attached a chart of AMZN with the PPO.

I would need two columns in a watchlist. (a) PPO and (b) Histrogram
If PPO<2 and Histogram >0, then buy

Something like that.

The issue is that I can find the MACD Histogram in the TOOLS but when I go to add it to the watchlist, I cannot. When I right click on the chart and select the wrench icon and “search for tools” the MACD-H does not show up.
Any suggestions would be appreciated!
Thanks
AMZNPPO

Hi Michael,

The MACD script function has 3 output values, with the Histogram being the default. So just using MACD() in a watchlist will display the histogram value by default. Does that answer your question?

Capture