DIVERGENZA MOMENTUM/PREZZO

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #111925 quote
    lng123
    Participant
    New

    Buongiorno,

    vorrei programmare un indicatore che segnali le divergenze fra il prezzo ed il Momentum,

    impostato come l’indicatore già presente sulla piattaforma “Divergence RSI/PRIX”, è possibile?

    Io non sono in grado di programmarlo.

    Grazie

    #111927 quote
    robertogozzi
    Moderator
    Master

    Dovrebbe essere possibile, nei prossimi giorni faccio qualche prova.

    #111991 quote
    robertogozzi
    Moderator
    Master

    Prova questo, l’ho adattato da uno sull’RSI che ho trovato qui sul forum (ho lasciato la variabile DSRI, senza modificarne il nome in quanto è ininfluente, puoi variarla tu se vuoi):

    /// Detector of divergences
    /// Version by TempusFugit based on an original idea of jose7674
    
    ///The variable "N" is the number of bars backwards that we use to find a divergence
    ///The variable "a" is the number of bars used to calculate RSI
    ///The variable "b" is the number of bars checked backwards to detecte swing highs or lows
    ///The variable "c" is the aditional increase/decrise in price required to get a divergence
    defparam calculateonlastbars=500
    //N = 29
    //a = 14
    //b = 5
    //c = 0
    //
    DRSI = Momentum[a](close)
    cero = 0
    ////Searching for swing highs or lows
    IF (BarIndex > 10+N) THEN
    IF (DRSI[1]>DRSI AND DRSI[1]>highest[b](DRSI[2])) THEN
    RSISwingHigh=DRSI[1]
    RSIPreviousSwingHigh=highest[N](DRSI)
    
    PriceSwingHigh=close[1]
    PricePreviousSwingHigh=Highest[N](close)
    ENDIF
    IF (DRSI[1]<DRSI AND DRSI[1]<lowest[b](DRSI[2])) THEN
    RSISwingLow=DRSI[1]
    RSIPreviousSwingLow=lowest[N](DRSI)
    
    PriceSwingLow=close[1]
    PricePreviousSwingLow=lowest[N](close)
    ENDIF
    
    ////Detecting Divergences between RSI and Price
    IF(RSISwingHigh<RSIPreviousSwingHigh AND PriceSwingHigh>(PricePreviousSwingHigh[1]*(1+(c/100)))) THEN
    signal = -1
    ELSE
    signal = 0
    ENDIF
    IF(RSISwingLow>RSIPreviousSwingLow AND PriceSwingLow<(PricePreviousSwingLow[1]*(1-(c/100)))) THEN
    signal = 1
    ENDIF
    ENDIF
    Return cero as "0", signal as "Divergence"
    /// If Divergence = 1, there is bullish divergence. if D =-1, bearish divergence
    ///END

    prova a cambiare i parametri dalle proprietà (o nelle variabili commentate) per adattarlo ai tuoi strumenti e grafici.

    x-2.jpg x-2.jpg Divergence-Momentum.itf
    #112156 quote
    lng123
    Participant
    New

    Grazie mille!!!

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

DIVERGENZA MOMENTUM/PREZZO


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
lng123 @lng123 Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 11/03/2019
Status: Active
Attachments: 2 files
Logo Logo
Loading...