RMI – Relative Momentum Index

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #118063 quote
    Mickeleo
    Participant
    Junior

    Buongiorno,

     

    è possibile convertire questo indicatore RMI per prorealtime?

    https://www.tradingview.com/script/UCm7fIvk-FREE-INDICATOR-Relative-Momentum-Index-RMI/

     

    study(title = "TheLark Relative Momentum Index (RMI)",overlay=false)
    
    //•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//
    // //
    // RMI BY THELARK //
    // ~ 2-19-14 ~ //
    // //
    // •/• //
    // //
    // https://www.tradingview.com/u/TheLark //
    // //
    //•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//
    
    // Relative Momentum Index (RMI)
    // "... The Relative Momentum Index was developed by Roger Altman
    // and was introduced in his article in the February, 1993 issue of
    // Technical Analysis of Stocks & Commodities magazine. "
    // "... While RSI counts up and down days from close to close, the Relative
    // Momentum Index counts up and down days from the close relative to a
    // close x number of days ago. "
    
    // Requested by glaz @ TradingView
    
    // inputs
    len = input(20, title="Length")
    mom = input(4, title="Momentum",minval=0)
    ob = input(70,title="Overbought")
    os = input(30,title="Oversold")
    c = close
    docol = input(true,title="Change Color?")
    dosignal = input(true,title="Show Signal Line?")
    sig = input(6,title="Signal Length")
    dohist = input(false,title="Show Hist?")
    //calc
    up = ema(max(c - c[mom],0),len)
    dn = ema(max(c[mom] - c,0),len)
    rmi = dn == 0 ? 0 : 100 - 100 / (1 + up / dn)
    signal = sma(rmi,sig)
    
    //plots
    hline(ob)
    hline(os)
    plot(dohist?(rmi-signal)+50:na,color=#FF006E,histbase=50,style=histogram,linewidth=2)
    plot(dosignal?signal:na,color=#D87A68)
    col = docol ? rmi > rmi[1] ? #0094FF : #FF006E : #0094FF
    plot(rmi, color=col,linewidth=2)
    #118065 quote
    Nicolas
    Keymaster
    Master

    Potresti seguire le regole la prossima volta quando chiedi una conversione di codice? Richiedi una conversione gratuita di codice L'RMI è già disponibile qui: Relative Momentum Index (RMI)

    #118072 quote
    Mickeleo
    Participant
    Junior

    Buonasera Nicolas, avevo già verificato l’indicatore RMI che mi hai inviato e che era già disponibile. Quello che ho chiesto io è diverso a mio parere, da un risultato che presenta oltre al RMI una signal lenght (6). Non le risulta? Mi è fondamentale per usare questo indicatore

     

    Grazie per la risposta

    #118097 quote
    robertogozzi
    Moderator
    Master

    Prova questa versione modificata, dove, oltre al segnale RMI è stata aggiunta una sua media (segnale) ed un RSI.

    Le linee che non t’interessano puoi renderle invisibili tramite le proprietà dell’indicatore:

    // "... The Relative Momentum Index was developed by Roger Altman
    // and was introduced in his article in the February, 1993 issue of
    // Technical Analysis of Stocks & Commodities magazine. "
    // "... While RSI counts up and down days from close to close, the Relative
    // Momentum Index counts up and down days from the close relative to a
    // close x number of days ago. "
    //
    // https://www.prorealcode.com/prorealtime-indicators/relative-momentum-index-rmi/?utm_source=ReviveOldPost&utm_medium=social&utm_campaign=ReviveOldPost
    //
    // inputs:
    //     Period   = 20
    //     Lookback = 3
    //     ob       = 70
    //     mm       = 1     (average type)
    //     MA       = 20
    //     AvgType  = 1     (average type)
    //
    //DEFPARAM CalculateOnLastBars = 1000
    
    period   = max(1,min(999,period))       //0 - 999
    lookback = max(1,min(999,lookback))     //0 - 999
    Ob       = max(0,min(100,Ob))           //0 - 100
    Os       = 100 - Ob
    mm       = max(0,min(6,mm))             //0 - 6
    MA       = max(1,min(999,MA))           //0 - 999
    AvgType  = max(0,min(6,AvgType))        //0 - 6
    momup    = max(close-close[lookback],0)
    momdown  = max(close[lookback]-close,0)
    up       = average[period,mm](momup)
    dn       = average[period,mm](momdown)
    rm       = up / dn
    //rmi      = 100 * rm / (1+rm)
    rmi      = 100 - (100 * rm / (1+rm)) //rmi = dn == 0 ? 0 : 100 - 100 / (1 + up / dn) at https://www.tradingview.com/script/UCm7fIvk-FREE-INDICATOR-Relative-Momentum-Index-RMI/
    Avg      = Average[MA,AvgType](rmi)
    return rmi as "RMI",Rsi[Period](close) AS "Rsi",Avg AS "MA",ob AS "Ob",os AS "Os",50 AS "Middle"

    la terzultima riga è quella che io ho modificato secondo l’interpretazione che ho rilevato dal sito indicato. Se preferisci puoi commentarla e togliere i commenti da quella ancora più sopra ed usare quella formula (che è il codice che hai postato).

    Nicolas and Gianluca thanked this post
    x-11.jpg x-11.jpg RMI-Relative-Momentum-Index.itf
    #118145 quote
    Mickeleo
    Participant
    Junior

    Grazie mille, gentilissimo

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

RMI – Relative Momentum Index


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Mickeleo @mickeleo Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by Mickeleo
6 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 01/27/2020
Status: Active
Attachments: 2 files
Logo Logo
Loading...