Traduzione codice TW Dtosc MTF support

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #245873 quote
    Msport71Msport71
    Participant
    Senior

    Buongiorno,

     

    mi piacerebbe testare indicatore in oggetto, ovvero una versione Dtosc (presente in libreria) a cui è stato implementato un indicatore a istogramma che sembra molto utile a filtrare i vari incroci, essendo se ho capito bene settato su un timefrime diverso .

     

    Grazie come sempre.

    https://www.tradingview.com/script/Buc4eho6-Dynamic-Time-Oscillator-W-MTF-Support/

    //@version=3
    study(title = “Dynamic Time Oscillator”, shorttitle=”DTosc”)
    
    // Traditional Candlestick Values
    sClose = security(tickerid, period, close)
    
    // Inputs
    // RSI – Current Timefram
    int_RSIPeriod = input(type = integer, defval = 13, title = “Current Timeframe RSI Period”)
    // Stoch – Current Timeframe
    int_StochPeriod = input(type = integer, defval = 8, title = “Current Timeframe Stoch Period”)
    int_SmoothK = input(type = integer, defval = 5, title = “Current Timeframe SmoothK Period”)
    int_SmoothD = input(type = integer, defval = 5, title = “Current Timeframe SmoothD Period”)
    
    // MTF Switch and Timeframe Selection
    bool_MTFUse = input(type = bool, defval = true, title = “Use MTF Timeframe Overlay?”)
    resolution_MTFPeriod = input(type = resolution, defval = “D”, title = “Higher Timeframe Resoltion (Use higher timefram than your main chart)”)
    // RSI – Higher Timeframe
    int_HTFRSIPeriod = input(type = integer, defval = 13, title = “Higher Timeframe RSI Period”)
    // Stoch – Higher Timeframe
    int_HTFStochPeriod = input(type = integer, defval = 8, title = “Higher Timeframe Stoch Period”)
    int_HTFSmoothK = input(type = integer, defval = 5, title = “Higher Timeframe SmoothK Period”)
    int_HTFSmoothD = input(type = integer, defval = 5, title = “Higher Timeframe SmoothD Period”)
    
    // Calculations
    // Current Chart Period
    int_RSI = rsi(sClose, int_RSIPeriod)
    int_StochRSI = stoch(int_RSI, int_RSI, int_RSI, int_StochPeriod)
    ma_StochK = sma(int_StochRSI, int_SmoothK)
    ma_StochD = sma(ma_StochK, int_SmoothD)
    // HTF Chart Period
    HTF_Close = security(tickerid, resolution_MTFPeriod, close)
    int_HTFRSI = security(tickerid, resolution_MTFPeriod, rsi(HTF_Close, int_HTFRSIPeriod))
    int_HTFStochRSI = security(tickerid, resolution_MTFPeriod, stoch(int_HTFRSI, int_HTFRSI, int_HTFRSI, int_HTFStochPeriod))
    ma_HTFStochK = security(tickerid, resolution_MTFPeriod, sma(int_HTFStochRSI, int_HTFSmoothK))
    ma_HTFStochD = security(tickerid, resolution_MTFPeriod, sma(ma_HTFStochK, int_HTFSmoothD))
    
    // Draw Out
    hline(75, color = red, title = “Overbought Level”)
    hline(25, color = green, title = “Oversold Level”)
    
    // Current Chart Period
    plot(ma_StochK, color = aqua, transp = 0, title = “Stoch Fast”)
    plot(ma_StochD, linewidth = 2, color = purple, transp = 0, title = “Stoch Slow”)
    // HTF Chart Period
    plot(bool_MTFUse == true ? ma_HTFStochK : na, style = columns, color = ma_HTFStochK > ma_HTFStochD ? green : red, transp = 70, title = “Higher TimeFrame”)
    //plot(ma_HTFStochK, style = linebr, color = white, transp = 0)
    Screenshot-2025-04-14-at-11-07-09-Dynamic-Time-Oscillator-W_-MTF-Support-—-Indicator-by-jasondhadley-—-TradingView.png Screenshot-2025-04-14-at-11-07-09-Dynamic-Time-Oscillator-W_-MTF-Support-—-Indicator-by-jasondhadley-—-TradingView.png
    #246062 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Ecco qui:

    // Traditional Candlestick Values
    sClose = close
    // Inputs
    // RSI - Current Timefram
    intRSIPeriod = 13//"Current Timeframe RSI Period"
    // Stoch - Current Timeframe
    intStochPeriod = 8//"Current Timeframe Stoch Period"
    intSmoothK = 5//"Current Timeframe SmoothK Period"
    intSmoothD = 5//"Current Timeframe SmoothD Period"
    // MTF Switch and Timeframe Selection
    boolMTFUse = 1//"Use MTF Timeframe Overlay?"
    intHTFRSIPeriod = 13//"Higher Timeframe RSI Period"
    // Stoch - Higher Timeframe
    intHTFStochPeriod = 8//"Higher Timeframe Stoch Period"
    intHTFSmoothK = 5//"Higher Timeframe SmoothK Period"
    intHTFSmoothD = 5//"Higher Timeframe SmoothD Period"
     
    // Calculations
    timeframe(daily,updateonclose)
    // HTF Chart Period
    HTFClose = close
    intHTFRSI = rsi[intHTFRSIPeriod](HTFClose)
    maxHTFrsi=highest[intHTFStochPeriod](intHTFRSI)
    minHTFrsi=lowest[intHTFStochPeriod](intHTFRSI)
    
    intHTFStochRSI=(intHTFRSI-minHTFrsi)/(maxHTFrsi-minHTFrsi)*100
    maHTFStochK=average[intHTFSmoothK](intHTFStochRSI)
    maHTFStochD=average[intHTFSmoothD](maHTFStochK)
    
    if maHTFStochK>maHTFStochD then
    r=0
    g=255
    else
    r=255
    g=0
    endif
    timeframe(default)
    // Current Chart Period
    intRSI=rsi[intRSIPeriod](sClose)
    maxrsi=highest[intStochPeriod](intRSI)
    minrsi=lowest[intStochPeriod](intRSI)
    
    intStochRSI=(intRSI-minrsi)/(maxrsi-minrsi)*100
    maStochK=average[intSmoothK](intStochRSI)
    maStochD=average[intSmoothD](maStochK)
    
    return maHTFStochK as "Higher TF"style(histogram)coloured(r,g,0,255*boolMTFUse),25 as "Oversold level", 75 as "Overbought level", maStochK as "Stoch Fast"coloured("aqua"),maStochD as "Stoch Slow" coloured("purple")style(line,2)
    #246067 quote
    Msport71Msport71
    Participant
    Senior

    Grazie!!!

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Traduzione codice TW Dtosc MTF support


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Msport71 @carlo-pasca Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Msport71Msport71
1 year, 5 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 04/14/2025
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...