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
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 ...
haseluis Hello, who can help me why the screener does not work // Der folgende Code bezieht sich auf...
Nicolas Hello, please ask your question with a new forum topic, this is not the place to ask for sup...
Lotech123 Thanks for this indicator. Working on a 3 M timeframe with the DJI, it can produce some inte...
JSTAR PRODUCTIONS Hi there, I downloaded the Indicator but the indicator does not show up on my charts. Am...
JSTAR PRODUCTIONS Hi, Worked it out. Thanks
Jean-Pierre Poulain When I buy and when I sell ?
Nicolas The featured image of the post do not deserve the indicator you are right, I attached other ...
Nicolas It is described in the post already :) The BUY/SELL signals are quite similar of what you ca...
Nicolas We do not offer free assistance for TOS. However, you can send demand for private paid codin...
phanz Hi community. May I know how you use this indicator please? Is it on the zero cross over? ...
sydney43025 Hello, I'm digging up this topic because I uploaded the code on a PRT v11.1 but the indicato...
finplus Thanks for the job. Which variables do you suggest for timeframe 1 hour? 
Maz Depends massively on your market and the volatility. I suggest using the variable optimizer ...
1Randy This a great momentum filter! I would like to see volume momentum incorporated into the indi...
Jodal Bonjour Nicolas, Merci pour cet indicateur! Est-ce possible de configurer une alerte pou...
Nicolas Merci pour le post dans le forum en respectant les règles de publication énoncées dans le ca...
Dron De lo mejorcito
Swingforfortune
8 years ago
gatarayihajp Hi swingforfortune, Thanks a lot about your interesting posting. Let ask you to explain mor...
Swingforfortune Hello. Basically they are a twist of the MACD histogram and can be used as such. They visua...
gatarayihajp Hi again Thanks for the explanation. Have a good day
Nicolas All conditions under parenthesis for the c1 to c4 conditions should be inverted. 
tomus Can you give an example of the overbought codes please? Thanks.
ams123 Frank Merci Nicholas -:)
Wilko And not only readable.... makes it much easier to iterate different entry/exit-conditions, d...
IGOSNELL Hi Interesting strategy, when I used $ M-R Dif EURUSD M15 Long if does not enter any positi...
ilvillans HI, I modified the system, from good results but from this error: Replace the variables wit...
gabri
8 years ago
Marcel Thank you for this one. I played around with this indicator with Bollinger Bands around it i...
Nicolas
8 years ago
supertiti bonjour à tous J'utilise cet indicateur depuis plusieurs mois, une fois règlé "K" à sa conv...
Nicolas
8 years ago
T3 Velocity
T3 Velocity
16
Indicators
tatankayotanka As you can do to set a marker directly in the price property page and then view it such as m...
Nicolas It may be a good idea to discuss this in the forum instead. Please open a new topic in probu...
Wester Hi, is this more or less the same as the TTM Squeeze indicator (john carter)
rpreviteri Hi Nicolas, thanks a  loto for sharing your knowliedge, Wasn't the original momentum pinball...
air Thank you!  
elanoa Buonasera sig. Nicolas......sarebbe possibile far in modo che quando l'indicatore raggiunga ...
Doctrading I forgot to write at the beginning :  a = 50 b = 50 These are intermediate levels Sorry
DerPat Thank you. This one could be an aid in my current research on stochastics.
Pelayo it is possible that in line 12 we should put seuilinf=-b, thaks for all
lglmrc Can't make it work, says: "Define p variable"
Ezio Hi Xel and thanks, do you know if there is a way in PRC of reading/counting intraday ticks?...
inadis ive just discovered this, i must say very nice thanks.
phili711 Bonjour Si la moyenne 100 est au dessus de la moyenne 20 le trend est baissier zlors pourqu...
Nicolas La comparaison se fait entre la valeur de la moyenne actuelle et telle qu'elle était il y a ...
Thomas007 we should definitely open a new thread for intraday trading - can we post the link once it's...

Top