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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
//This indicator contains functions that can only be used with ProRealTime v10.3 and above.<br /> //If you use a previous version of ProRealTime, use the other version of the Indicators. multiplier=3 period=10 moy=averagetruerange[period](close) price=medianprice up=price+multiplier*moy dn=price-multiplier*moy once trend=1 if close>up[1] then trend=1 elsif close<dn[1] then trend=-1 endif if trend<0 and trend[1]>0 then flag=1 else flag=0 endif if trend>0 and trend[1]<0 then flagh=1 else flagh=0 endif if trend>0 and dn<dn[1] then dn=dn[1] endif if trend<0 and up>up[1] then up=up[1] endif if flag=1 then up=price+multiplier*moy endif if flagh=1 then dn=price-multiplier*moy endif if trend=1 then mysupertrend=dn else mysupertrend=up endif if mysupertrend > mysupertrend[1] then color1=0 color2=255 color3=0 elsif mysupertrend < mysupertrend[1] then color1=255 color2=0 color3=0 endif return mysupertrend coloured (color1,color2,color3) as "SuperTrend" |
For v10.2 and below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
//This indicator is for ProRealTime v10.2 and previous versions. //If you use version 10.3 or above, use the other indicator that includes the color or the SuperTrend multiplier=3 period=10 moy=averagetruerange[period](close) price=medianprice up=price+multiplier*moy dn=price-multiplier*moy once trend=1 if close>up[1] then trend=1 elsif close<dn[1] then trend=-1 endif if trend<0 and trend[1]>0 then flag=1 else flag=0 endif if trend>0 and trend[1]<0 then flagh=1 else flagh=0 endif if trend>0 and dn<dn[1] then dn=dn[1] endif if trend<0 and up>up[1] then up=up[1] endif if flag=1 then up=price+multiplier*moy endif if flagh=1 then dn=price-multiplier*moy endif if trend=1 then mysupertrend=dn else mysupertrend=up endif return mysupertrend coloured by (trend) as "SuperTrend" |
Share this
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 :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
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.
Exit and relaunch PRT should fix this behavior.
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\"
Good! thanks for sharing your own code! Please do so with other ones if you think you can improve them 😉