Conversion Slow Stochastic From TradingVIew

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #238157 quote
    Alera15
    Participant
    New

    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)

    #238179 quote
    JS
    Participant
    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
    Alera15 and Iván González thanked this post
    #238182 quote
    Alera15
    Participant
    New

    Thank you!

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

Conversion Slow Stochastic From TradingVIew


ProBuilder support

New Reply
Author
author-avatar
Alera15 @alera15 Participant
Summary

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

Topic Details
Forum: ProBuilder support
Language: English
Started: 09/27/2024
Status: Active
Attachments: 1 files
Logo Logo
Loading...