Percentage Price Oscillator (PPO)

v10.3
Percentage Price Oscillator (PPO)

The percentage price oscillator (PPO) is a technical momentum indicator that shows the relationship between two moving averages. To calculate the PPO, subtract the 26-period exponential moving average (EMA) from the 12-period EMA, and then divide this difference by the 26-period EMA. The result is then multiplied by 100. The indicator tells the trader where the short-term average is relative to the longer-term average.

 

I am also attaching the MACD type version (it is very similar):

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. juanj • 12/07/2018 #

    Haven’t been on this forum for ages! Just logged in to see what is happening and since this caught my eye I decided to quickly write it into a strategy 🙂

    For some reason, the Add PRT Code doesn’t work so here is the unformatted code:

    //EURUSD 1Hr

    Defparam cumulateorders = False

    possize = 1
    SlowP = 26 //Periods of Slow Average
    FastP = 12 //Periods of Fast Average
    AvgType = 1 //Average Type (0=sma, 1=ema, 2=wma,…)
    Percentage = 1 //1=calculate Percentage 0=no percentage
    SignalP = 9 //Periods of Signal Average
    //
    SlowP = max(1,min(999,SlowP)) //1 – 999
    FastP = max(1,min(999,FastP)) //1 – 999
    AvgType = max(0,min(6,AvgType)) //0 – 6
    Percentage = max(0,min(1,Percentage)) //1=Percentage 0=NO Percentage
    SignalP = max(1,min(999,FastP)) //1 – 999
    SlowAvg = Average[SlowP,AvgType](close)
    FastAvg = Average[FastP,AvgType](close)
    ppo = FastAvg – SlowAvg
    IF Percentage THEN
    ppo = (ppo / SlowAvg) * 100
    ENDIF
    SignalLine = Average[SignalP,AvgType](ppo)
    Histo = Ppo – SignalLine

    If longonmarket and histo < 0 or ppo 0 or ppo > SignalLine Then
    Exitshort at market
    EndIf

    If ppo > 0 and signalLine SignalLine Then
    If shortonmarket Then
    Exitshort at market
    EndIf
    Buy possize contract at market
    ElsIf ppo 0 and ppo < SignalLine Then
    If longonmarket Then
    Sell at market
    EndIf
    Sellshort possize contract at market
    EndIf

  2. robertogozzi • 12/07/2018 #

    Welcome back Juanji, why don’t you post your strategy in the ProOrder support, it’s a better place to talk about strategies and improve them.
    Thank you.

  3. SB-FO • 12/07/2018 #

    Nicolas, I am trying to replicate Price Oscillator of PRC (PO NOT PPO) using manual programing to make sure i have it correct. I thought I had it correct but a comparison backtest of the two has very different results. Can you please define the calculation for PRC PriceOscillator as i clearly have something wrong below and PRC does not specify the calculation.

    xClose = Close
    AvgType = Average // weightedAverage //ExponentialAverage //
    Fastp = A
    Slowp = B
    TriggerAve = C

    ShortAvg = Average[Fastp,AvgType](xClose)
    LongAvg = Average[Slowp,AvgType](xClose)
    PPO = ShortAvg – LongAvg

    PPO = PriceOscillator[A,B](Xclose)
    Trigger = Average[C](PPO)

    • robertogozzi • 12/07/2018 #

      Hi, I am not Nicolas.
      Where is the formula of the Oscillator you want to code?

    • robertogozzi • 12/07/2018 #

      It’s just the difference of two averages:
      PO = Fast Moving Average – Slow Moving Average

  4. SB-FO • 12/07/2018 #

    Robertogozzi, I agree with it being the difference of the two MA’s, however when i compare that to “PriceOscillator[A,B](Xclose)” in PRT it get different backrest results. Thus my question is, what is the code for “PriceOscillator[A,B](Xclose)” so that i can compare why the results are different.

    Thanks for your help.

    • robertogozzi • 12/07/2018 #

      Sorry, I can’t find any built-in PPO in PRT, so I cannot tell.

  5. SB-FO • 12/07/2018 #

    Look up Price Oscillator, that is the prebuilt in am referring to, PO not PPO.

    • robertogozzi • 12/07/2018 #

      I have plotted 4 similar indicators on mty chart: PPO, PO (built-in), MACD (built-in) and APO, all with a 12-period fast MA and a 26-period slow MA, all with the same type of moving average, EMA, applied to CLOSE.
      They all show the same result. It can’t be any different since it’s the same expression in all of them!
      The only difference can only be spotted when using different types of Moving Averages.
      If you still have issues I suggest that you start a new topic in the ProBuilder support so that we can attach pics.

  6. SB-FO • 12/07/2018 #

    Do you mind looking at my code to see if i ma doing something wrong?

    xClose = Close
    AvgType = Average
    Fastp = A
    Slowp = B

    ShortAvg = Average[Fastp,AvgType](xClose)
    LongAvg = Average[Slowp,AvgType](xClose)
    PO = ShortAvg – LongAvg

    When I code this, i get a different back test than using the standard PO from PRT.

    • robertogozzi • 12/07/2018 #

      AvgType = 1 //0 to 8, but is usually o=sma or 1=ema
      This is the only thing that may cause an error.

  7. SB-FO • 12/07/2018 #

    Ah ha. I will check that and report back. Thank you.

  8. SB-FO • 12/07/2018 #

    Robertogozzi,

    I have backtested the two following PriceOscillator code, which I thought would result in the same returns, alas they do not. Do you have any insights? I will say that using WeightedAverage is closer to the built in PriceOscillator, yet still not the same. Of course using the same parameters and time period. Do you have any insights as to why this would happen?

    ShortAvg = WeightedAverage[A] (Close)
    LongAvg = WeightedAverage[B] (Close)
    PO = ShortAvg – LongAvg

    PO = PriceOscillator[A,B](Close)
    Trigger = Average[C](PO)

  9. robertogozzi • 12/07/2018 #

    Please post the full working code, otherwiose I can’t replicate it.
    Tellme what you compared it to.

  10. SB-FO • 12/07/2018 #

    Code below. Comparison is to PRT standard PO which is // out.

    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    DEFPARAM FLATBEFORE = 093000
    DEFPARAM FlatAfter = 154500
    capital = 100000 + strategyprofit
    Equity = capital / close
    myCurrentProfit = STRATEGYPROFIT

    ShortAvg = Average[22] (close)
    LongAvg = Average[7] (close)
    PO = (ShortAvg – LongAvg)

    //PO = PriceOscillator[22,7](Close)

    Trigger = Average[2](PO)

    // Draw indicator
    Graph PO COLOURED(34,139,3) AS “SBFO PO”
    Graph Trigger COLOURED(225,0,0) AS “Trigger”

    // Conditions to enter long positions

    IF NOT LongOnMarket AND PO Crosses Over Trigger THEN
    BUY Equity SHARES AT MARKET
    ENDIF

    // Conditions to exit long positions
    If LongOnMarket AND PO Crosses Under Trigger THEN
    SELL AT MARKET
    ENDIF
    //
    //Conditions to enter short positions
    IF NOT ShortOnMarket AND PO Crosses Under Trigger THEN
    Sellshort Equity SHARES AT MARKET
    ENDIF

  11. robertogozzi • 12/07/2018 #

    Firstly you need to make the correct calculation, you need to swap 22 and 7.
    Secondly PRT’s POI uses to return a percentage, so you need to replace the calculation with:
    PO = (ShortAvg – LongAvg) / LongAvg * 100

  12. SB-FO • 12/07/2018 #

    Sorry, i did forget to change the 7/22, I have run it both ways.
    PRT is calculating PPO and not PO, that make sense now.

    Thanks. Have a fantastic weekend.

  13. RubberToe • 12/07/2018 #

    I believe there is an error in line 23 of the MACD version. It points to the FastP. Should be SignalP I think….

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Jean2139 Bonjour Yvan, Merci pour ton indicateur que je trouve très intéressant. Je suppose que tu ...
Suffi Hier eine kleine Korrektur: //-----Inputs-----------------------------------------// MALengt...
Gio56 Super idée. j'ai juste un souci. j'ai pas de barre verte mais plusieurs lignes de couleurs.....
DeathMetal change line in histgram, (click on indicator name, click on tool (
Gio56 Super merci.
Gianluca Amazing, thank You for your contribution!
Alex Spioglou Thank you for featuring my work, and I hope you found it useful. Mind the paper was publ...
Madrosat I Have not see a fully functioning automated strategy on your site?? Really have you???
juanj Hi Madrosat, why would it be on my site? I have developed it for my personal use and also to...
Madrosat ok I understood you are using prorealcode to hack the fish
jaginho Bonjour Vivien, je n'arrive pas à comprendre ce screener... En tout cas merci pour tes contr...
avatar
Anonymous Superb, merci!
Nicolas Ask on an Excel website?!
JJMR HOLA NICOLAS, TENGO LA ULTIMA VERSION ACTUALIZADA DEL INDICADOR TTM SQUEEZE PRO EN LA VERSIO...
imokdesign @nicolas ,if in want to "call" this indicator, which values i have to write down?
illenza
5 years ago
ribes65 Buongiorno Illenza, Il tuo indicatore è molto efficace, ma non funziona su tutte le azion...
robertogozzi
6 years ago
M-Oscillator
M-Oscillator
10
Indicators
robertogozzi Sorry for my late reply. I’ll make it and open a new topic quite soon.
swapping ah ah ! je n'avais pas vue celui-ci, excellent robert ;)
robertogozzi Thank you swapping.
Didouqc Bonjour Nicolas, Merci pour cet indicateur, encore génial! Je souhaite faire une suggest...
Exalaxe Hey, i just noticed you optimized this strategy. Could i see your new version, please?
Andrea.1981 sorry i add my code but it not enter why i dont know
Andrea.1981 this is code simply stop , and you can see another version for stop / Codice principale...
Nicolas Thanks for the update David!
sublime06 quelle parametre utilisé vous pour obtenir ces resultat ? merci
ullle73 you still use tihs one David?
fisiotrancos Hola, seria posible añadir una línea horizontal en el nivel 0? Me gustaría hacer un screener...
Nicolas cambiar la última línea por ésta: return val coloured(r,g,b) style(line,2), levelu style(do...
MaoRai54 Hi, first of all Happy New Year. Well, I've inserted your indicator in DAX 1h but I cann...
Vinks_o_7 Hi Mao Happy New Year ! This is just an improved RSI where you plot a standard price momen...
Nicolas Formule de l'indicateur Momentum: Le Momentum se calcule avec une simple soustraction pour ...
Roberto1 Hi, can this code be converted for the Nanotrader Platform or for the MT4 Platform?
Nicolas This website is dedicated for PRT programming, but you can still ask for private coding with...
ERICM en copiant collant : erreur de syntaxe apparaît le popup demande de définir length1, length2...
Nicolas En téléchargeant le fichier itf et import dans la plateforme, vous n'aurez pas ces problèmes.
Bateson Bonjour Nicolas un grand merci pour ce travail que je souhaiterai faire évoluer. Je n'arrive...
guillermus69 is this " a= log(close/close[1])" better than a = ((close/close[1]) -1) *100 . I ...
gildaslm Hi gabri, thanks very much for your work, it helps me a lot. Have you ever tried to make the...
gandolfi thanks for your screener. Do you have the code for original Sharp ratio in order to compare ...

Top