SuperTrend

SuperTrend

This indicator is the ProBuilder version of the SuperTrend Indicator. SuperTrend is available by default in the ProRealTime workstation but this ProBuilder version can be useful to create custom versions of the indicator.

If you want to use the standard SuperTrend indicator in Market Scan (ProScreener) or a Trading system, it’s easier to just use the ProBuilder function.

You can download the code directly at the bottom of the page.

If you prefer to add it manually to your workstation, here is the code.

For v10.3 and above:

For v10.2 and below:

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. verdi55 • 05/13/2016 #

    This indicator is exteremly slow. In a full DAX 1 min chart (~ 8 months), calculation takes more than 10 minutes, whereas the normal built-in supertrend is immediately there. What is the reason ? Too many if-then-else loops ? In a trading strategy, it would be almost impossible to use. 

    • Nicolas • 05/13/2016 #

      Exit and relaunch PRT should fix this behavior.

  2. verdi55 • 05/13/2016 #

    Thank you. After a restart, it is somewhat faster; however, it still takes about 3 minutes to load for the full DAX 1 min chart. Here is my own version of the supertrend that loads about 6-7 faster. Still, in a backtest, using this manual code for supertrend instead of the built-in version increases calculation time of the backtest by a factor of 20. So, this is not very advisable and suitable only for testing custom supertrends, not so much for parameter optimization. 
    ONCE Richtung = 1
    ONCE STlongalt = 0
    ONCE STshortalt = 1000000000000

    per = 10
    Faktor = 3

    indicator1 = medianprice

    indicator2 = averagetruerange[per] * Faktor

    STlong = indicator1 - indicator2

    STshort = indicator1 + indicator2

    If Richtung = 1 and STlong < STlongalt then
    STlong = STlongalt
    endif

    If Richtung = -1 and STshort > STshortalt then
    STshort = STshortalt
    endif

    If barindex > 2 and Richtung = 1 and close crosses under STlong then
    Richtung = -1
    endif

    If barindex > 2 and Richtung = -1 and close crosses over STshort then
    Richtung = 1
    endif

    STlongalt = STlong

    STshortalt = STshort

    If Richtung = 1 then
    ST = STlong
    endif

    If Richtung = -1 then
    ST = STshort
    endif

    Return ST coloured by (Richtung) as \"Supertrend\"
     

    • Nicolas • 05/13/2016 #

      Good! thanks for sharing your own code! Please do so with other ones if you think you can improve them 😉

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Iván
2 months ago
Iván I personally like it in daily timeframe
oliTR Many thanks Ivan, I copy/paste your code to try it but could only get a constant stable unif...
Iván Hi, I've copied the code above and it works... what asset are you trying? $indices array ...
Iván
2 months ago
Madrosat Hello Ivan You have interesting topics on indicators , smart supertrend, optimised trend t...
Iván Hi! thanks. All of these codes are translations requested in the forum. I've on mind to back...
Raspete01 Buenos días Iván, estoy intentando llevar el código eliminando los colores y pasando un Back...
sfl Removing the short side will help, I would like to know from the author where are the condit...
WE ARE SOCIETY DEFPARAM cumulateOrders = False rem CAC40 (france40) en 10 secondes rem à la ligne ci-dess...
David Daget Bonjour. A noter que cette stratégie fonctionne aussi sur le ftse. Ce qui n'est pas surprena...
Nicolas Simple strategy with this indicator is available here: https://www.prorealcode.com/topic/ut-...
FXtonio Nicolas.... MERCI 1 millions de fois, cet indicateur gagne dans 75% des cas en scalping m1 ...
davy42 bonjour, à quel moment apparait le fleche, à l'ouverture ou la fermeture de la bougie? merci
JS
10 months ago
AndPar Buongiorno Nicolas, vorrei provare questo indicatore, ma quando lo inserisco in PRT mi vengo...
Nicolas Basta aggiungerlo al prezzo https://www.prorealcode.com/blog/video-tutorials/how-to-add-an-i...
Aragorna hello Nicolas, this indicator works with the last Beta version of PRT? Ive seen tha many in...
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,...
Nicolas Just add it on the price series.
yomisadiku Hello Nicolas, Can I use high and low price at lines hh=max(hh,close) and ll=min(ll,close) ...
Nicolas Yes you can do that, the impact will be that the trailing stop line will be much close to th...
AlgoAlex
5 years ago
Marcot18 Alex ti sei superato
AlexF Esagerato!
SL Hi, Fer666 Thank you for sharing. If I want to show daily ST on a 10_min intraday chart...
SL correction above... system had remove"not equal" signs Line 19 : change to if WeekNo "Not...
SL OK... I had figured out... need more than that. Thank you anyway.
Juan Salas Hi FULVIO09, Nice piece of work. It seems to work very well. Does only work for INDEXES??...
Johann Hi @FULVI09, I understand the instructions however I'm not too sure how to determine the "p...
Player8520 Hello, It doesn't work with me either. However, I changed AA to 180 on line 15, added th...
Geronima Ortiz I watched the video three times, but I can not put the npips parameter as a variable. I do...
Geronima Ortiz I think the video is for an old version of prorealtime, the images do not correspond at all ...
Nicolas indicator1 = CALL “PRC_StopReversal”[npips, 1] and define npips in the optimization window ...
Caribeengeek Bonjour j’avais vu que vous proposiez d’écrire des codes pour ceux qui s’y connaisse pas Mai...
Caribeengeek Les devises unité
Nicolas Merci d'utiliser le forum pour les demandes de programmation personnalisée
verdi55 You can find me at www.FXautomate.com Ahh. So i got it ? 4 different supertrends without th...
juanj What? This has nothing to do with the website. The site is simply a service to help people ...
Nicolas Advertising is allowed,as long as people are helping others and if provided services are abo...
jebus89 Big thanks for sharing this :) Seems to work as expected, good stuff.
WarningTrading Comment peut on la comparer ? comme ceci ? cela ne me donne plus le message d'erreur manque...
sally31120 Bonjour, je n'arrive pas à créer ce screener close > supertrend extended2[1] la réponse...
Nicolas voir ce sujet pour un screener basé sur Supertrend Extended: https://www.prorealcode.com/top...
Nicolas Indeed, if you are not willing to loose, you will always win. Averaging down losers can carr...
David You're always safer going Long especially with averaging down on an index as the probability...
Oskar Bergvall  I noted Davids and Nicolas remarks. Could it be possible to make an indicator for contraria...
verdi55 Is there such a thing as a free lunch ?
maceng Thanks Nicolas for this great work! I would like to understand the math behind it in order t...
Nicolas Sorry I have no time to provide assistance for python programmers. Have a good day.
Nicolas You need to have enough bars loaded on your chart for the indicator to compute completely th...
verdi55 Working with separately calculated supertrend indicators in backtests is usually somewhat pr...
Nicolas Very interesting Verdi. Would be a great addition to the library, your own modified version ...

Top