PriceOscillator

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #85138 quote
    othello
    Participant
    Senior

    Salve,

    vorrei sapere come indicare, a questa funzione, che le due medie mobili devono essere di tipo esponenziale.

    Il manuale riporta:

    PriceOscillator                                              PriceOscillator[S,L](price)                                Indicatore Percertage Price oscillator

    ma da questa sintassi non mi sembra sia possibile dire se le due medie mobili sono semplici, esponenziali, o altro ancora.

    Grazie.

    #85148 quote
    robertogozzi
    Moderator
    Master

    No, infatti non è possibile.

    Se sai programmare è facile crearlo, qui c’è la formula

    https://www.investopedia.com/terms/p/ppo.asp

    http://www.traderpedia.it/wiki/index.php/Price_oscillator_(DOA)

    #85156 quote
    luxrun
    Participant
    Master

    Comunque in piattaforma è disponibile l’oscillatore di prezzo tra gli indicatori di default e puoi selezionare le medie di qualsiasi tipo, nei periodi che preferisci (il default è 12 e 26).

    #85158 quote
    robertogozzi
    Moderator
    Master

    L’ho creato, questo è il codice, con i riferimenti delle fonti, sia per il calcolo in differenza di prezzo che in percentuale.

    Decidi tu i periodi delle medie, il tipo di media e se vuoi la differenza in prezzo o in percentuale.

    Una volta messo sotto il grafico puoi decidere, dalle proprietà, di colorarlo come vuoi e di visualizzarlo come linea o istogramma tipo Macd:

    //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.
    //
    //  Here is the PPO calculation:    ((12-day EMA - 26-day EMA) / 26-day EMA) x 100
    //
    // https://www.investopedia.com/terms/p/ppo.asp
    // http://www.traderpedia.it/wiki/index.php/Price_oscillator_(DOA)
    //
    // 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
    //
    DEFPARAM CalculateOnLastBars = 1000
    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
    SlowAvg    = Average[SlowP,AvgType](close)
    FastAvg    = Average[FastP,AvgType](close)
    Difference = FastAvg - SlowAvg
    IF Percentage THEN
       Difference = (Difference / SlowAvg) * 100
    ENDIF
    RETURN Difference,0
    Price-Oscillator-PPO.itf x-8.jpg x-8.jpg
    #85161 quote
    robertogozzi
    Moderator
    Master

    Ti allego anche la versione tipo MACD (è molto simile):

    //Percentage Price Oscillator - PPO (with Histogram)
    //
    //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.
    //
    //  Here is the PPO calculation:    ((12-day EMA - 26-day EMA) / 26-day EMA) x 100
    //
    // https://www.investopedia.com/terms/p/ppo.asp
    // http://www.traderpedia.it/wiki/index.php/Price_oscillator_(DOA)
    // https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:price_oscillators_ppo
    // http://www.forexwiki.it/PPO
    //
    // 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
    //
    DEFPARAM CalculateOnLastBars = 1000
    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
    RETURN Ppo AS "Ppo",SignalLine AS "Signal",Histo AS "Histogram",0
    x-9.jpg x-9.jpg Price-Oscillator-PPO-Histo.itf
    #85176 quote
    luxrun
    Participant
    Master

    bellissimo lavoro, Roberto, grazie!

    #85200 quote
    othello
    Participant
    Senior

    Grazie Roberto e grazie a tutti del contributo offerto.

    Spero, quanto prima, di poter ricambiare.

    Buon trading.

    🙂

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

PriceOscillator


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
othello @othello Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by othello
7 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 11/18/2018
Status: Active
Attachments: 4 files
Logo Logo
Loading...