Traduzione codice TW Stochastic RSI + Heikin Ashi
Forums › ProRealTime forum Italiano › Supporto ProBuilder › Traduzione codice TW Stochastic RSI + Heikin Ashi
- This topic has 2 replies, 2 voices, and was last updated 1 month ago by
Msport71.
-
-
05/02/2025 at 8:42 AM #246681
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”)05/02/2025 at 12:03 PM #246691ecco:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455//------------------------------------------------////PRC_Stochastic RSI//version = 0//28.06.24//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//------------------------------------------------////-----Inputs//------------------------------------------------//src=close//---Stochastic RSI inputslengthRSI=14 //RSI lengthlengthStoch=14 //Stochastic LengthsmoothK=8 //KsmoothD=3 //D//------------------------------------------------////-----Stochastic RSI Calculation//------------------------------------------------//rsi1=rsi[lengthRSI](src)maxrsi=highest[lengthStoch](rsi1)minrsi=lowest[lengthStoch](rsi1)osc=(rsi1-minrsi)/(maxrsi-minrsi)*100k=average[smoothK](osc)-50d=average[smoothD](k)//------------------------------------------------////-----Stochastic Heikin-ashi//------------------------------------------------//haopen=(k[1]+d[1])/2haclose=(k+d+d+k)/4hahigh=max(k,max(haopen,haclose))halow=min(k,min(haopen,haclose))//------------------------------------------------////-----Candles and Colors//------------------------------------------------//if haclose>=haopen thenr=0g=255b=0elser=255g=0b=0endifdrawcandle(haopen,hahigh,halow,haclose)coloured(r,g,b)ob1=50ob2=40os1=-50os2=-40colorbetween(ob1,ob2,255,82,82,50)colorbetween(os1,os2,122,255,82,50)//------------------------------------------------//return 0 as "zero" style(dottedline)1 user thanked author for this post.
05/02/2025 at 1:37 PM #246697 -
AuthorPosts
Find exclusive trading pro-tools on