Conversion Slow Stochastic From TradingVIew

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #238157 quote
    Alera15Alera15
    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)

    2024-09-27-21_29_41-SPX-5.74178-▼-−0.06-Base.png 2024-09-27-21_29_41-SPX-5.74178-▼-−0.06-Base.png
    #238179 quote
    JSJS
    Participant
    Master

    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
    Alera15Alera15
    Participant
    New

    Thank you!

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

Conversion Slow Stochastic From TradingVIew


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Alera15 @alera15 Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/27/2024
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...