Smart Supertrend

Smart Supertrend

Here I leave an adaptation of the supertrend indicator.
We have the cloud, which shows us the price trend according to color.
On the other hand we have the adapted version of the supertrend, which can be used as a trailstop or confirmation.

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Madrosat • 94 days ago #

    Hello Ivan
    You have interesting topics on indicators , smart supertrend, optimised trend tracker, end ema9-21 , but did you have some exemples of wining strategy with this indicators.
    Congratulations

  2. Iván • 94 days ago #

    Hi! thanks. All of these codes are translations requested in the forum. I’ve on mind to backtest all of them.

  3. Raspete01 • 50 days ago #

    Buenos días Iván, estoy intentando llevar el código eliminando los colores y pasando un Backtest para sacar estadística de funcionamiento real.
    Marqué orden de compra y venta en el siguiente punto, por favor, está correcto ?
    Muchas gracias
    src = open
    prd = 2 //PP period
    factor = 3//Atr factor
    Pd = 12//Atr period
    len = 12//Cloud length
    Adxlen = 24//Adx length
    th = 24//Adx treshold
    showsignals = 0//boolean
    colorcandle = 0//boolean
    /////////////////////////Indicators///////////////////////////////
    ////////CLOUD
    pi=2*asin(1)
    er = abs(src-src[len])/summation[len](abs(src-src[1]))

    fastlimit = er
    slowlimit = er*0.1

    if barindex<6 then
    mesaperiod = 0
    smooth = 0
    detrender = 0
    I1 = 0
    I2 = 0
    Q1 = 0
    jI = 0
    Q2 = 0
    phase = 0
    else
    mesaperiodmult = 0.075*mesaperiod[1] + 0.54
    smooth = (4*src + 3*src[1]+2*src[2]+src[3])/10
    detrender = (0.0962*smooth + 0.5769*smooth[2] – 0.5769*smooth[4]-0.0962*smooth[6])*mesaPeriodMult
    I1= detrender[3]
    Q1 =(0.0962*detrender + 0.5769*detrender[2] – 0.5769*detrender[4]-0.0962*detrender[6])*mesaPeriodMult
    jI= (0.0962*I1 + 0.5769*I1[2] – 0.5769*I1[4]-0.0962*I1[6])*mesaPeriodMult
    jQ = (0.0962*Q1 + 0.5769*Q1[2] – 0.5769*Q1[4]-0.0962*Q1[6])*mesaPeriodMult
    I2 = I1 – jQ
    Q2 = Q1 + jI
    I2 = 0.2*I2 + 0.8*I2[1]
    Q2 = 0.2*Q2 + 0.8*Q2[1]
    Re = I2*I2[1] + Q2*Q2[1]
    Im = I2*Q2[1] – Q2*I2[1]
    Re = 0.2*Re + 0.8*Re[1]
    Im = 0.2*Im + 0.8*Im[1]
    if Re 0 and Im 0 then
    mesaperiod=2 * pi/atan(Im/Re)
    endif
    if mesaperiod>1.5*mesaperiod[1] then
    mesaperiod=1.5*mesaperiod[1]
    endif
    if mesaperiod<0.67*mesaperiod[1] then
    mesaperiod=0.67*mesaperiod[1]
    endif
    if mesaperiod 50 then
    mesaperiod = 50
    endif
    mesaperiod = 0.2*mesaperiod+0.8*mesaperiod[1]
    if I1 0 then
    phase=(180/pi)*atan(Q1/I1)
    endif
    deltaphase = phase[1]-phase
    if deltaphase < 1 then
    deltaphase = 1
    endif
    alpha = fastlimit/deltaphase
    if alpha < slowlimit then
    alpha = slowlimit
    endif
    endif

    a = alpha
    b = alpha/2

    if barindex kama[1]
    Scloud = kama mdi and myadx > th //long trend
    sadx = pdi th //short trend

    /////////PRICE POSITION
    ////////pivothigh
    ph1 = high < high[prd]
    ph2 = highest[prd](high) highest[prd](high)[prd+1]

    if ph1 and ph2 and ph3 then
    pivotH = high[prd]

    else
    pivotH = pivotH

    endif
    ////////pivotlow
    pl1 = low > low[prd]
    pl2 = lowest[prd](low) > low[prd]
    pl3 = low[prd] < lowest[prd](low)[prd+1]

    if pl1 and pl2 and pl3 then
    pivotL = low[prd]

    else
    pivotL = pivotL

    endif
    ////////Trailing
    if barindex = 0 then
    center = 0
    lastpp = 0
    Tup=0
    Tdown=0
    Trend=0
    else
    if pivotH pivotH[1] then
    lastpp = pivotH
    center = (center*2+lastpp)/3
    BUY 10000 CASH AT MARKET NextBarOpen
    elsif pivotL pivotL[1] then
    lastpp = pivotL
    center = (center*2+lastpp)/3
    sell at market NextBarOpen
    else
    lastpp = lastpp[1]
    center = center[1]
    endif

    atr = averagetruerange[pd](close)
    Up = center-(factor*atr)
    Dn = center+(factor*atr)

    if close[1]>Tup[1] then
    Tup = max(Up,Tup[1])
    else
    Tup = Up
    endif

    if close[1] Tdown[1] then
    Trend = 1
    elsif close < Tup[1] then
    Trend = -1
    else
    Trend = Trend[1]
    endif
    if trend = 1 then
    Trailings1 = Tup
    else
    Trailings1 = Tdown
    endif
    endif
    //////////SIGNALS
    if showsignals then
    bsignal = Trend=1 and Trend[1]=-1
    ssignal = Trend=-1 and Trend[1]=1
    if bsignal and not Scloud then
    firstlong = Trailings1

    else
    firstlong = undefined

    endif
    if ssignal and not Lcloud then
    firstshort = Trailings1

    else
    firstshort = undefined

    endif

    secondlong = Lcloud and Ladx and trend=1
    secondshort = Scloud and Sadx and trend=-1

    long = secondlong and firstlong
    short = secondshort and firstshort

    once longshort = 0
    longlast = long and (longshort[1]=0 or longshort[1]=-1)
    shortlast = short and (longshort[1]=0 or longshort[1]=1)

    if longlast = 1 then
    longshort = 1
    elsif longshort = 1 then
    longshort = -1
    else
    longshort = longshort[1]
    endif

    lastlongcond = long and longlast
    lastshortcond = short and shortlast

    if (bsignal and not scloud) or (lastlongcond) then
    longplot = Trailings1

    //drawarrowup(barindex,low-0.10*atr)
    else
    longplot = undefined
    endif

    if (ssignal and not lcloud) or (lastshortcond) then
    shortplot = trailings1

    //drawarrowdown(barindex,high+0.10*atr)
    else
    shortplot = undefined
    endif

    if ssignal and lcloud then
    longstop = trailings1

    //drawtext("✘",barindex,high+0.10*atr)coloured(0,250,0)
    else
    longstop = undefined
    endif

    if bsignal and scloud then
    shortstop = trailings1

    //drawtext("✘",barindex,low-0.10*atr)coloured(250,0,0)
    else
    shortstop = undefined

    endif

    endif

    ///////////COLOR CANDLES
    if colorcandle then
    if Lcloud then
    rbar=0
    gbar=210
    bbar=0
    elsif Scloud then
    rbar=255
    gbar=0
    bbar=0
    endif

    ENDIF
    //return mama as "Cloud A" coloured(rcloud,gcloud,bcloud), fama as "Cloud B" coloured(rcloud,gcloud,bcloud), Trailings1 as "PP line" coloured(rcloud,gcloud,bcloud)
    //return a*src as "a*src",(1-a) as "1-a"

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
zilliq Thanks @Nicolas. I tried to use it as Trend in a proorder system, but don't know why, it doe...
Suzu Yuk He is right. MT and mavgMT are not defined and causing errors.....
RakeshPoluri I have a question about the bands on the candles. Is it bollinger bands or something else?
Nicolas I think that's 2 Bollinger Bands
Emperor.it "style(line,2)" C'è una guida ai parametri che si possono modificare ? Tipo stile della lin...
IV Mcm https://www.prorealcode.com/programming-with-prorealtime/
Daniele Maddaluno Écrivez-moi où vous préférez you can easily find me on LinkedIn
AK27 C'est payant visiblement sur linkdin je peux pas vous envoyer, discord vous avez ?
Nicolas C'est dans ce sujet: https://www.prorealcode.com/topic/trendline-une-approche-du-trading/ M...
Pensera Bonjour Nicolas, comment est-il possible de backtester cet indicateur? cela fait une erreu...
Nicolas Oui bien sûr, il doit y avoir pas mal de sujets dans le forum à ce propos.
Nicolas Il doit s'agir d'un mauvais copier/coller. Je suggère de télécharger le fichier itf contenu ...
Bard Hello @Nicolas, I can get this to display in a separate indicator panel but not on Price as ...
Stenozar Hi @Nicolas, how can I put the bands on price? Thanks, Stefano
mickey992 salut merci pour ton partage et ton travaille
patapouf Hi Vivien René I just discovered your “Ordered trend-following stocks Screener”. Great work...
Nicolas Oui le code est correct et il fonctionne, j'ai de bons résultats sur la liste NASDAQ par exe...
pincherman Bonjour :-) J'ai coller le script dans prorealtime pour jouer avec le supertrend et j'ai un...
Nicolas Vous l'avez sans doute collé au mauvais endroit, dans l'éditeur de code pour les stratégies,...
Guillaume Mcm I gave the above message fix ;)
Tradingrob Is it possible to put the itf-file in the right way here in Prorealcode? so the right 'trend...
Guillaume Mcm Update link ;) https://www.prorealcode.com/topic/trend-histogramme-cci-mise-a-jour-suite-...
Screw27 Hi man, I installed the indicator and i don't know why but my graph it is so big
HelixKing sounds interesting I'll take a look
Godo Bonjour Souhait Sam, Après de nombreux essais pour le mettre en format afin d'utiliser ce c...
Nicolas Il faut supprimer celles qui existent dans la fenêtre d'optimisation et les créer en dur dan...
crusoe76 hi there, anyone can help making this strategy work, i have a message saying replace variabl...
Screw27 Salut nicolas j'aimerais savoir tes résulats grace a cettte methode
eva.g.forsgren It dose not work, I get a strap instead of candels???????????????????????????????????????????
Nicolas That indicator is the one below the chart. The indicator to put on the price chart is this o...
pyhrus P.S : IG , que j'ai contacté ,m'indique que la version V11 , ne sera pas disponible avant un...
Hasardeur Dear Nicolas, is there someting at the arry to modify in order to run the trend at the actu...
MALIMALO Dear Nicolas, just try touse your indicator with backtest but it's not working. is anybody...
ribes65 Bonjour Nicolas, Merci pour votre travail. Est-il envisageable de créer un screener pour ...
Nicolas Bien sûr, merci de formuler une demande dans le forum des screeners pour prorealtime. En res...
ipbvba Est il possible de le transformer en indicateur (pour ne plus avoir les lignes mais uniqueme...
supertiti Bonjour Nicolas, Je ne comprend pas bien , le trend change de couleur quand les prix sont a...
Nicolas Oui ce serait possible, cependant l'indicateur est bien prévu pour conserver la couleur de l...
supertiti Quand tu pourras si tu peux nous coder la troisième couleur cela améliorerait les trades cou...
Nicolas How to import file page: in the help section of the website explains howto
kenssa import through the indicator page/window in the Proreal time
chicoteca Buenas, no consigo que se me muestre en el chart de DAX. ¿Cómo procedo? Gracias.-
frenqle Hi There.. It seems the TSL stop loss is not working.. it does not respond is that correct?
Ciccarelli Franco Per lasciare che la strategia venga eseguita (dopo aver importato il file): Basta eliminare...
JADINVEST Hello Jan, hello everyone, Thanks Jan for this strategy! Since 2020, have any of you found a...
Stockastiss Can this code be simply transferred into Backtestingcode so one doesnt need to use call ? (i...
Vonasi Sorry for the late reply. Add the code to your strategy and remove line 5 and line 39. Chang...
viktorthunss Hi! How many averages are there? Can I see the somewhere?

Top