Intraday Momentum Index

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #87513 quote
    Gianluca
    Participant
    Master

    Buongiorno e’ possibile avere questo indicatore già presente su altre piattaforme anche in PRT?

    @nicolas
    @robertogozzi Grazie in anticipo.
    Allego qualche link che spiega il funzionamento:
    https://library.tradingtechnologies.com/trade/chrt-ti-intraday-momentum-index.html
    http://www.traderpedia.it/wiki/index.php/Formula_Intraday_Momentum_Indicator

    qui il codice preso da tradingview:

    //@version=2
    study("Intraday Momentum Indicator")
    
    // Get traditional OHLC values
    tOpen = security(tickerid, 'D', open)
    tClose = security(tickerid, 'D', close)
    
    // Inputs
    imiPeriod = input(defval = 14, title = "IMI Period Length", type = integer, minval = 1)
    
    //Calculate IMI
    imiGain = tClose > tOpen ? nz(imiGain[1]) + (tClose - tOpen) : 0 // Open Higher than Close, Gain day
    imiLoss = tClose < tOpen ? nz(imiLoss[1]) + (tOpen - tClose) : 0 // Close Higher than Open, Loss day
    imiGainSum = sum(imiGain,imiPeriod) // Sum total of all Gains in specified period
    imiLossSum = sum(imiLoss, imiPeriod) // Sum total of all Loses in specified period
    imiTotal = 100 * (imiGainSum / (imiGainSum + imiLossSum))
    
    plot (70, title = "Overbought", style = circles, color = green, transp = 10, join = true)
    plot(30, title = "Oversold", style = circles, color = red, transp = 30, join = true)
    plot(imiTotal, title = "Intraday Momentum Indicator", style = line, color = yellow, transp = 0) // Plot the indicator
    #87514 quote
    Gianluca
    Participant
    Master

    ho anche provato un poco a farlo ma senza riuscirci:

    //@version=2
    //study("Intraday Momentum Indicator")
    
    // Get traditional OHLC values
    tOpen = Open
    tClose = close
    
    // Inputs
    imiPeriod = periodi
    
    //Calculate IMI
    if  tClose > tOpen then
    imigain=(imiGain[1]) + (tClose - tOpen)
    endif
    
    // Open Higher than Close, Gain day
    if tClose < tOpen then
    imiloss=(imiLoss[1]) + (tOpen - tClose)
    endif // Close Higher than Open, Loss day
    
    imiGainSum = summation[imiPeriod](imiGain) =imiPeriod// Sum total of all Gains in specified period
    imiLossSum = summation[imiPeriod](imiloss)=imiPeriod // Sum total of all Loses in specified period
    imiTotal = 100 * (imiGainSum / (imiGainSum + imiLossSum))
    
    return imitotal
    
    
    
    #87519 quote
    Nicolas
    Keymaster
    Master

    Penso che dovrebbe essere codificato in questo modo:

    //@version=2
    //study("Intraday Momentum Indicator")
    
    // Get traditional OHLC values
    tOpen = dOpen(0)
    tClose = dclose(0)
    
    // Inputs
    imiPeriod = 14
    
    if barindex>imiPeriod then 
    //Calculate IMI
    if  tClose > tOpen then
    imigain=(imiGain[1]) + (tClose - tOpen)
    else
    imigain=0
    endif
    
    // Open Higher than Close, Gain day
    if tClose < tOpen then
    imiloss=(imiLoss[1]) + (tOpen - tClose)
    else
    imiLoss=0
    endif // Close Higher than Open, Loss day
    
    imiGainSum = summation[imiPeriod](imiGain)// Sum total of all Gains in specified period
    imiLossSum = summation[imiPeriod](imiloss)// Sum total of all Loses in specified period
    imiTotal = 100 * (imiGainSum / (imiGainSum + imiLossSum))
    endif
    
    return imitotal,70,30
    #87520 quote
    Nicolas
    Keymaster
    Master

    L’indicatore che hai pubblicato usa il quotidiano Apri e Chiudi. Ma la formula originale usa invece il tempo corrente Apri e Chiudi, quindi in base a questo puoi cambiare le variabili con:

    tOpen = open//dOpen(0)
    tClose = close//dclose(0)

    praticamente simile a una RSI, ma invece di usare Close / Close [1], utilizza Open / Close

    #87526 quote
    Gianluca
    Participant
    Master

    grazie mille

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

Intraday Momentum Index


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Gianluca @altares Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 12/20/2018
Status: Active
Attachments: No files
Logo Logo
Loading...