Convert indicator SuperTrend from the TradingView platform

Forums ProRealTime English forum ProBuilder support Convert indicator SuperTrend from the TradingView platform

Viewing 8 posts - 16 through 23 (of 23 total)
  • #229552

    definition of variables periods and multiplie instead of 10 and 3

    //inputs
    periods = 10 //ATR period
    multiplier = 3 //ATR multiplier
    changeATR = 1 //Change ATR Calculation Method ?
    Showsignals = 1 //Show Buy/Sell Signals ?
    highlighting = 1 //Highlighter On/Off
    ///////////////////
    atr = averagetruerange[periods](close)
    up = high – multiplier*atr
    up1 = up[1]
    if close[1] > up1 then
    up = max(up,up1)
    else
    up = up
    endif

    dn = low + multiplier*atr
    dn1 = dn[1]
    if close[1] < dn1 then
    dn = min(dn,dn1)
    else
    dn = dn
    endif

    once trend = 1

    if trend = -1 and close > dn1 then
    trend = 1
    elsif trend = 1 and close < up1 then
    trend = -1
    else
    trend = trend
    endif

    if trend = 1 then
    mysupertrend = up
    r=0
    g=255
    b=0
    else
    mysupertrend = dn
    r=255
    g=0
    b=0
    endif

    buysignal = trend=1 and trend[1]=-1
    sellsignal = trend=-1 and trend[1]=1

    if buysignal then
    drawtext(“▲”,barindex,mysupertrend)coloured(“green”)
    drawtext(“Buy”,barindex,mysupertrend-0.3*tr)coloured(“green”)
    elsif sellsignal then
    drawtext(“▼”,barindex,mysupertrend)coloured(“red”)
    drawtext(“Sell”,barindex,mysupertrend+0.3*tr)coloured(“red”)
    endif

    mplot = (open+close+high+low)/4

    colorbetween(mplot,mysupertrend,r,g,b,40)

    return mysupertrend coloured(r,g,b)style(line,2)

    #229553
    JS

    Hi,

    You can change all input values yourself:

    For example:

    Periods=10 //ATR period

    Just change the number 10 to a value of your choice:

    Example: Periods=20 //ATR period

    Of course, this also applies to the other input values…

    #229554

    That’s i know, i want to change that with out to axit  at code

    #229555
    JS
    1. Import the attached “itf-file” into the “Indicators” tab
    2. Add the indicator “on the Price”
    3. An extra window will now appear in which you can change the inputs…
    #229592

    @js

    It doesn’t work , the changes are not made at settings , only  when i change inside the code

    #229610
    JS

    In the code comment out the following lines:

    // periods = 10

    // multiply = 3

    It’s hard to help when you don’t know the basic operations of the program…

    #229611

    Ok, I’ll try it tonight, after work, thanks.

    #229657

    Now it works, thank you all

Viewing 8 posts - 16 through 23 (of 23 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login