Hi!
I have the Slow Stochastic indicator from TradingView coded in PineScript.
Is it possible convert it in ProBuilder language, please?
Thank you in advance,
A.
study(title="Slow Stochastic", shorttitle="Slow Stochastic")
length = input(10, minval=1), smoothK = input(6, minval=1), smoothD = input(3, minval=1)
// Get the real OHLC (useful in not standard chart - like Heikin Ashi)
t = tickerid(syminfo.prefix, ticker)
realO = security(t, period, open)
realH = security(t, period, high)
realL = security(t, period, low)
realC = security(t, period, close)
//palette = realC >= realO ? lime : red
//plotcandle(realO, realH, realL, realC, color=palette)
// Calculation
low_n = lowest(realL, length)
high_n = highest(realH, length)
k = sma(100*((realC-low_n)/(high_n-low_n)), smoothK)
d = sma(k, smoothD)
plot(k, color=green)
plot(d, color=red)
h0 = hline(75)
h1 = hline(25)
JSParticipant
Senior
Hi,
Hereby the conversion of the Slow Stochastic from TV:
Length=14
SmoothK=3
SmoothD=5
hi = highest[Length](high)
lo = lowest[Length](low)
oscillator = (close - lo) / (hi - lo) * 100
ProcentK = average[SmoothK,0](oscillator) // 0=SMA, 1=EMA, 2=WMA
ProcentD = average[SmoothD,0](ProcentK) // 0=SMA, 1=EMA, 2=WMA
RETURN ProcentK AS "%K MA" Coloured("Green"), ProcentD AS "%D MA" Coloured("Red"), 25, 75