rajandran.r

Supertrend V1.0 - Buy or Sell Signal

Supertrend Indicator with Buy and Sell Indicators. Supertrend is quite a popular indicator. To know more about it check out the article below.

10 Things to know about Supertrend
http://www.marketcalls.in/amibroker/10-things-to-know-about-supertrend-v2-0-afl-code.html
Remove from Favorite Scripts Add to Favorite Scripts
//Author - Rajandran R
//www.marketcalls.in
study("Supertrend V1.0 - Buy or Sell Signal", overlay = true)

Factor=input(3, minval=1,maxval = 100)
Pd=input(7, minval=1,maxval = 100)


Up=hl2-(Factor*atr(Pd))
Dn=hl2+(Factor*atr(Pd))


TrendUp=close[1]>TrendUp[1]? max(Up,TrendUp[1]) : Up
TrendDown=close[1]<TrendDown[1]? min(Dn,TrendDown[1]) : Dn

Trend = close > TrendDown[1] ? 1: close< TrendUp[1]? -1: nz(Trend[1],1)
Tsl = Trend==1? TrendUp: TrendDown

linecolor = Trend == 1 ? green : red

plot(Tsl, color = linecolor , style = line , linewidth = 2,title = "SuperTrend")

plotshape(cross(close,Tsl) and close>Tsl , "Up Arrow", shape.triangleup,location.belowbar,green,0,0)
plotshape(cross(Tsl,close) and close<Tsl , "Down Arrow", shape.triangledown , location.abovebar, red,0,0)
//plot(Trend==1 and Trend[1]==-1,color = linecolor, style = circles, linewidth = 3,title="Trend")

plotarrow(Trend == 1 and Trend[1] == -1 ? Trend : na, title="Up Entry Arrow", colorup=lime, maxheight=60, minheight=50, transp=0)
plotarrow(Trend == -1 and Trend[1] == 1 ? Trend : na, title="Down Entry Arrow", colordown=red, maxheight=60, minheight=50, transp=0)

dilip_r
2 years ago
Cant find the indicator
+3 Reply
rajandran.r dilip_r
2 years ago
Then copy the script and Paste it in your Tradingview Pinescript Editor
+8 Reply
SarathLal rajandran.r
a year ago
i am using zerodha pi software can i using this script
Reply
mreddappareddy.stocks SarathLal
5 months ago
No Zerodha Pi doesnt support pinescript. It is based on Tradescript.
Reply
Hi Rajandran,
I love this indicator. Is there a way to add an offset function? it seems the indicator correctly indicates market changes but is 6 bars late. An offset function could allow a more precise read on the market trend.
+8 Reply
MONEYMENOW PRO VWAP McStinkypants
9 months ago
But dont u think applying offset will give the signal and after the appearence of the 6th bar.. so in that case how would offset help?
Reply
davieovermeer MONEYMENOW
8 months ago
I completely agree. I found a strategy that looked perfect, which it was as it was set to offset -5, it was such a facepalm moment
+1 Reply
alisson.cruz davieovermeer
2 months ago
Hi davieovermeer! I'm quite new to tradingview. I was wondering: What strategy did you use? Have you changed the source code or simply tuned the inputs? For me it also appears that that the indicator is 5-6 bars too late.
Thanks!
Reply
BipinBihariPatra davieovermeer
2 months ago
Hi,

can you share the strategy for offst -5 or any code that you change to reflect this.
Reply
stenor PRO
2 years ago
Thanks rajandran.r for coding this very useful indicator.

I find that by adjusting the Factor value this Super Trend Indicator can be fine tuned to follow the market either more closely or further away as you choose. I like using a Factor value of 1.38. However the value you use is really an individual thing based on your trading method and time frame.

Also, using a Moving Average along with this indicator, such as KAMA, is also very helpful in keeping you on the right side of the market. The choice of which moving average to use is also an individual choice based on your own testing and depending on your trading method and time frame.

Adding an oscillator, such as John Uhlers recent Universal Oscillaor or your favorite oscillator, can be used to further filter for the best entries.
+2 Reply
stenor PRO stenor
2 years ago
I should note that in order to input Factor values having decimal places in them you need to alter one line of code:

Change:
Factor=input(3, minval=1,maxval = 100)

To:
Factor=input(1.38, type=float)
Reply
rajandran.r stenor
2 years ago
Factor and ATR value can be decided based on proper backtesting and optimization.
Reply
lenin rajandran.r
2 years ago
and whether there is a version 2 for tradingview?
+1 Reply
mb6606 rajandran.r
6 months ago
Can you post the the strategy testing code for your supertrend script ?? thanks
+1 Reply
dorobou
2 years ago
Thank you Rajandran.R for this wonderful indicator!
Reply
dingleberry
a year ago
Nice! How can I create an alert for this?
+7 Reply
squattter PRO dingleberry
a year ago
current price cross over
+1 Reply
Kabiastro PRO squattter
a year ago
do you have any sample code for this ? alert mechanism would be nice
Reply
squattter PRO Kabiastro
a year ago
Sorry man didn't even notice your reply.

Something like this - http://i.imgur.com/biCbQdf.png

But I prefer bouncing off supertrend rather than counting on breaking through. Send me a PM and I'll show you. Maybe I'll post an IDEA for the first time about it.
Reply
BipinBihariPatra squattter
2 months ago
Dear Squattter,

Please guide me how can I set an alert that it will popup when the Up arrow or the down arrow is plotted.

Regards
Bipin
Reply
scarf PRO dingleberry
12 days ago
I've added alerts and a bar colour feature:
Supertrend 1.0 with Alerts
Reply
Philosaphilos
a year ago
Thanks! Looks great
Reply
Hello! A fine job done! Could you change it in multi-time frame supertrend, say, with timeframes D, W, M?
Reply
mizot
a year ago
Thanks for this sharing. Very usefull, whatever the timefrime, especially with Heikin Ashi ...
Reply
ahsanq
a year ago
very fine indicator, good work! did anyone manage to add an alert on buy/sell signal on this one, if yes, can you please share? Thanks!
+3 Reply
Seal PRO ahsanq
a year ago
I have the same question. Nice indicator work.
Reply
PettyCash Seal
a year ago
Same question as well. Very nice.
Reply
NicoEsterhuyse
a year ago
What expiry time do you use with this incator? If using 1 minute chart is expiry 5minutes? Or what is best timeframes to use?

Thanks
+7 Reply
vipink1963 NicoEsterhuyse
8 months ago
Dear Sir

Kindly mail metaSTOCK EXPLORER ALGORITHM FOR SUPER TREND.( ID vipink1963@gmail.com)

warm regards
+1 Reply
Dethlefsen5EU
8 months ago
Hi Mr.Raj,
Thanks for this useful indicator. how can i install this indicator on meta-trader 4? any means? kindly advice.thanks.
Reply
tiosa1 Dethlefsen5EU
7 months ago
https://www.mql5.com/en/code/10851
Reply
Dethlefsen5EU tiosa1
7 months ago
thanks a lot tiosa1...got it..
Reply
santoshporwal
7 months ago
Add this 2 lines for alert condition in the end.


alertcondition(Trend == 1 and Trend == -1 ? Trend : na, title='Up Entry Arrow', message='Up Entry Arrow!')
alertcondition(Trend == -1 and Trend == 1 ? Trend : na, title='Down Entry Arrow', message='Down Entry Arrow!')
+1 Reply
sabeve santoshporwal
7 months ago
add it where exactly, on which lines?
Reply
BipinBihariPatra santoshporwal
2 months ago
Hi Santosh,

Added these lines but unfortunately did not see any change. No popup alert generated. Is there anyway Pop up alert and a sound can be set when up arrow or down arrow appears.

Regards
Bipin
Reply
santoshporwal BipinBihariPatra
a month ago
After adding this lines you have to actually go to alerts and create a alert for the condition on tool Super Trend.
Reply
albo1111 PRO
7 months ago
Hello, thank you for the indicator.
What do the green and red lines represent? Are they smooth lines of some sort? or a mathematical reverse mirroring of the price action?
Thanks
Reply
sabeve
7 months ago
Tradingview.com on Chrome, I can't see the bottom histogram indicator.... any clue?
Reply
ArchieVanWyk
5 months ago
Hi. How can i make this compatable with my Protrader platform?
Reply
Tech23
4 months ago
Could you please provide easy language code for super trend. i have bugs in my code (given below) and can't compile it properly.

inputs:

AvgTrueRangeLength (9), AvgTrueRangeMult (1) , Strength (9);

variables:

strend (0),
st (0);

St = SuperTrend( AvgTrueRangeLength, AvgTrueRangeMult, Strength, strend);

Plot1 (st, "Up");
Plot2 (st, "Down");
Plot3 (st, "SuperTrend", IFF (strend = 1, GetPlotColor (1) , GetPlotColor (2)));
Reply
MarxBabu
4 months ago
Hello Rajendran
When are you planning to publish the most effective SUPERTREND 5 code
http://www.marketcalls.in/amibroker/supertrend-v5-0-amibroker-afl-code.html
Reply
sjcwealth
4 months ago
Hello Rajandran Have you got the code for sound and pop up alert,please?
Reply
RadonGroup
3 months ago
1 Week
103 trade
1 Min -> 43 Win 60 Lose
5 Min -> 39 Win 64 Lose
I don't like this indicator.
Reply
sjcwealth RadonGroup
3 months ago
Thanks for your honest feedback.
Reply
terrence7d RadonGroup
2 months ago
if you are using for forex then try
factor: 1.5
Period: 14

let me know
Reply
diggyrg PRO terrence7d
11 days ago
@terrence7d, seems to work OK, thank you for your advice! Are you using a 1min chart for trades here? What charts do you think would be the best for this signal? All the best
Reply
MarxBabu RadonGroup
a month ago
The below customized Super Trend gives more accurate results
snapshot

Reply
allenpascual RadonGroup
12 days ago
@RadonGroup, Wonder if opposite would be profitable.
Reply
amlanrashmi
3 months ago
how do I create a SuperTrend indicator financial chart for my website
Reply
lucrative PRO amlanrashmi
2 months ago
FWD answer please
Reply
Anrows1 PRO
2 months ago
HI
please can anyone help
would like to like to try this as a stratergy in ig index automotive need help with writing it ?

regards andy#
Reply
p699
2 months ago
Can somebdy please explain the strategy in plain english?
Reply
rajandran.r p699
2 months ago
Go thro the webinar here https://www.youtube.com/watch?v=arPnDXL17l4
Reply
BipinBihariPatra rajandran.r
2 months ago
Dear Raj,

really good work. Is there anyway Pop up alert and a sound can be set when up arrow or down arrow appears.

Regards
Bipin
Reply
RIPANDEB
2 months ago
Please say about the back test result...........?
Reply
sameer_patel18in
2 months ago
why dont you give pine code of supertrend 5.0.
It would be awesome.
Reply
MarxBabu sameer_patel18in
2 months ago
Dear Rajendar this is our request but you are avoiding the same
When can be see SuperTrend5.0 pls post the code
Reply
MarxBabu
a month ago
If we get SuperTrend5.0 that will be awesome
snapshot

Reply
airwyn MarxBabu
19 days ago
@MarxBabu, Hello, can you share the pine script code on the SuperTrend 5.0?
Reply
khoilevt
a month ago
how about EA this Indicator ? .
Reply
kickbang PRO
11 days ago
I just love this indicator. It works best. Thank you so much for building it.
I have one question, How do I scan for stocks that got up arrow ?
thank you :)
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out