Convert indicator SuperTrend from the TradingView platform

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #229552 quote
    ZAZI
    Participant
    New

    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 quote
    JS
    Participant
    Veteran

    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 quote
    ZAZI
    Participant
    New
    That’s i know, i want to change that with out to axit  at code
    #229555 quote
    JS
    Participant
    Veteran
    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…
    SuperTrend-ZAZI.itf Scherm­afbeelding-2024-03-10-om-17.29.30.png Scherm­afbeelding-2024-03-10-om-17.29.30.png
    #229592 quote
    ZAZI
    Participant
    New
    @js It doesn’t work , the changes are not made at settings , only  when i change inside the code
    #229610 quote
    JS
    Participant
    Veteran

    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 quote
    ZAZI
    Participant
    New
    Ok, I’ll try it tonight, after work, thanks.
    #229657 quote
    ZAZI
    Participant
    New
    Now it works, thank you all
Viewing 8 posts - 16 through 23 (of 23 total)
  • You must be logged in to reply to this topic.

Convert indicator SuperTrend from the TradingView platform


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
ZAZI @zazi Participant
Summary

This topic contains 22 replies,
has 5 voices, and was last updated by ZAZI
2 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/04/2024
Status: Active
Attachments: 2 files
Logo Logo
Loading...