Traduzione codice TW Stochastic RSI + Heikin Ashi

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

    Buongiorno,

    chiedo cortese traduzione codice in oggetto, che mi piacerebbe testare   e che trovo piuttosto interessante.

    Grazie per il consueto aiuto.

     

    https://www.tradingview.com/script/PbJeJTH4-The-Stocashi-Stochastic-RSI-Heikin-Ashi/

    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    //This is just a fun script to give a different representation to the ever popular Stochastic RSI
    //Even for me over the years the stochastic has been a difficult one to use in trading mearly beause of its choppy look.
    //Since Heikin-Ashi Candles do such a powerful job in smoothing out the look of choppy markets,
    //I decided to test it out on the look of the Stochastic RSI.
    //From an initial visual standpoint it worked out WAY better than I thought but it seemed to need something more.
    //I decided to use the PineScript “Color.From_Gradient” feature to give the Stochastic a more 3 dimentional look, which really brought the “old-school” indicator to life.

    // © CoffeeshopCrypto

    //@version=5

    indicator(“Stochastic RSI + Heikin-Ashi”, shorttitle=”Stocashi”, overlay=false)

    // Calculate the Stochastic RSI
    src = input(close, title=”Source”)
    smoothK = input.int(8, minval=1, title=”Stochastic %K Smoothing”, group = “Stocashi Inputs”)
    smoothD = input.int(3, minval=1, title=”Stochastic %D Smoothing”, group = “Stocashi Inputs”)
    lengthRSI = input.int(14, minval=1, title=”RSI Length”, group = “Stocashi Inputs”)
    rsi1 = ta.rsi(src, lengthRSI)
    lengthStoch = input.int(14, minval=1, title=”Stochastic Length”, group = “Stocashi Inputs”)
    k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK) – 50
    d = ta.sma(k, smoothD)

    // Calculate the Stochastic Heikin-Ashi candles
    ha_open = (k[1] + d[1]) / 2
    ha_close = (k + d + d + k) / 4
    ha_high = math.max(k, math.max(ha_open, ha_close))
    ha_low = math.min(k, math.min(ha_close, ha_open))

    // Plot the Heikin-Ashi Stochastic RSI
    down_colorbottom = input.color(#086e05, title=”Bullish Move Start”, inline = “Bullish / Bearish Momentum”, group = “Bullish / Bearish Movement”)
    down_colortop = input.color(#8dc474, title=”Bullish Move End”, inline = “Bullish / Bearish Momentum”, group = “Bullish / Bearish Movement”)
    up_color_top = input.color(#af0505, title=”Bearish Move Start”, inline = “Bullish / Bearish Momentum”, group = “Bullish / Bearish Movement”)
    up_color_bottom = input.color(#e08e8e, title=”Bearish Move End”, inline = “Bullish / Bearish Momentum”, group = “Bullish / Bearish Movement”)
    up_color_ob = input.color(color.rgb(255, 82, 82, 95), title=”Overbough Level”, inline = “OB/OS Levels”, group = “Overbough / Oversould levels”)
    up_color_os = input.color(color.rgb(122, 255, 82, 95), title=”Oversold Level”, inline = “OB/OS Levels”, group = “Overbough / Oversould levels”)

    gradientColourup = color.from_gradient(k, -50, 50, up_color_bottom, up_color_top)
    //gradientColouruptop = color.from_gradient(k, -50, 30, up_color, down_color)
    gradientColourdn = color.from_gradient(k, -50, 50, down_colorbottom, down_colortop)
    //gradientColourdntop = color.from_gradient(k, -30, 50, up_color, down_color)
    bar_color = ha_close >= ha_open ? gradientColourdn : gradientColourup

    // Use the up and down colors in your script
    //////////////////////////////////////////////
    plotcandle(ha_open, ha_high, ha_low, ha_close,title= “Stochatic Heiken Ashi Gradient”, color=bar_color, wickcolor = bar_color)
    mindline = hline(0, color=#d47305a1)
    line80 = hline(40, color=color.rgb(247, 143, 143, 66), linestyle = hline.style_dotted, editable = false)
    overbought = hline(50, color=color.rgb(247, 143, 143, 66), linestyle = hline.style_dotted, editable = false)
    linem10 = hline(-40, color=color.rgb(122, 255, 82, 66), linestyle = hline.style_dotted, editable = false)
    oversold = hline(-50, color=color.rgb(122, 255, 82, 66), linestyle = hline.style_dotted, editable = false)
    fill(line80, overbought, color = color.rgb(255, 82, 82, 95), title = “OB”)
    fill(linem10, oversold, color = color.rgb(122, 255, 82, 95), title = “OS”)

    Screenshot-2025-05-02-at-09-42-12-The-Stocashi-Stochastic-RSI-Heikin-Ashi-—-Indicator-by-CoffeeshopCrypto-—-TradingView.png Screenshot-2025-05-02-at-09-42-12-The-Stocashi-Stochastic-RSI-Heikin-Ashi-—-Indicator-by-CoffeeshopCrypto-—-TradingView.png
    #246691 quote
    Iván GonzálezIván González
    Moderator
    Legend

    ecco:

    //------------------------------------------------//
    //PRC_Stochastic RSI
    //version = 0
    //28.06.24
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //------------------------------------------------//
    //-----Inputs
    //------------------------------------------------//
    src=close
    //---Stochastic RSI inputs
    lengthRSI=14 //RSI length
    lengthStoch=14 //Stochastic Length
    smoothK=8 //K
    smoothD=3 //D
    //------------------------------------------------//
    //-----Stochastic RSI Calculation
    //------------------------------------------------//
    rsi1=rsi[lengthRSI](src)
    maxrsi=highest[lengthStoch](rsi1)
    minrsi=lowest[lengthStoch](rsi1)
    osc=(rsi1-minrsi)/(maxrsi-minrsi)*100
    k=average[smoothK](osc)-50
    d=average[smoothD](k)
    //------------------------------------------------//
    //-----Stochastic Heikin-ashi
    //------------------------------------------------//
    haopen=(k[1]+d[1])/2
    haclose=(k+d+d+k)/4
    hahigh=max(k,max(haopen,haclose))
    halow=min(k,min(haopen,haclose))
    //------------------------------------------------//
    //-----Candles and Colors
    //------------------------------------------------//
    if haclose>=haopen then
    r=0
    g=255
    b=0
    else
    r=255
    g=0
    b=0
    endif
    
    drawcandle(haopen,hahigh,halow,haclose)coloured(r,g,b)
    
    ob1=50
    ob2=40
    os1=-50
    os2=-40
    
    colorbetween(ob1,ob2,255,82,82,50)
    colorbetween(os1,os2,122,255,82,50)
    //------------------------------------------------//
    return 0 as "zero" style(dottedline)
    robertogozzi thanked this post
    #246697 quote
    Msport71Msport71
    Participant
    Senior

    Grazie e mille!!!

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 Stochastic RSI + Heikin Ashi


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, 4 months ago.

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