Help with conversion of Pinescipt code

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #199405 quote
    denmar
    Participant
    Veteran

    Hi

    Could someone please help with the conversion of the second line of code ….. I can convert the first line

    rsi14 = rsi(src, 14)
    // => rsi14 = RSI[14](close)
    k14 = sma(stoch(rsi14, rsi14, rsi14, 14), smoothK1)

    Thanks Denmar

    #199406 quote
    denmar
    Participant
    Veteran

    .oops .sorry … smoothK1 is just a value

    #199421 quote
    JS
    Participant
    Senior

    I think this is the right conversion:

    smoothK1 = 5

    rsi14 = RSI[14](close)

    xStoch = 100 * (rsi14 – Lowest[14](rsi14)) / (Highest[14](rsi14) – Lowest[14](rsi14))

    k14 = Average[smoothK1](xStoch)

    Return k14

    #199438 quote
    JS
    Participant
    Senior

    A little explanation:

    In TradingView / PineScript, the Stochastic is a built-in formula that is calculated with:

    Stoch = 100 * (Close – Lowest (Low, Length)) / (Highest(High, Length) – Lowest(Low, Length)

    De syntax is: Stoch (source, high, low, length)

    As you can see, the original script uses Stoch (rsi14, rsi14, rsi14, 14)

    So the source = rsi14, the high of rsi14, the low of rsi14, length = 14

    xStoch = 100 * (rsi14 – Lowest[14](rsi14)) / (Highest[14](rsi14) – Lowest[14](rsi14))

    denmar thanked this post
    #199448 quote
    denmar
    Participant
    Veteran
    Thank you so much.
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Help with conversion of Pinescipt code


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
denmar @denmar Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by denmar
3 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/22/2022
Status: Active
Attachments: No files
Logo Logo
Loading...