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)

Cant find the indicator
+15 Reply
Then copy the script and Paste it in your Tradingview Pinescript Editor
+20 Reply
SarathLal rajandran.r
i am using zerodha pi software can i using this script
Reply
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.
+35 Reply
MONEYMENOW PRO VWAP McStinkypants
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
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
+3 Reply
alisson.cruz davieovermeer
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!
+1 Reply
BipinBihariPatra davieovermeer
Hi,

can you share the strategy for offst -5 or any code that you change to reflect this.
+2 Reply
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.
+10 Reply
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)
+10 Reply
Factor and ATR value can be decided based on proper backtesting and optimization.
+1 Reply
lenin rajandran.r
and whether there is a version 2 for tradingview?
+1 Reply
mb6606 rajandran.r
Can you post the the strategy testing code for your supertrend script ?? thanks
+1 Reply
Thank you Rajandran.R for this wonderful indicator!
Reply
Nice! How can I create an alert for this?
+11 Reply
squattter PRO dingleberry
current price cross over
+1 Reply
do you have any sample code for this ? alert mechanism would be nice
Reply
squattter PRO Kabiastro
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
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
RusenAtmaca PRO BipinBihariPatra
@BipinBihariPatra,
did you find your answer? I also want to know how can I set alert when arrow is poped up
Reply
scarf PRO dingleberry
I've added alerts and a bar colour feature:
Supertrend 1.0 with Alerts
+16 Reply
Thanks! Looks great
Reply
Hello! A fine job done! Could you change it in multi-time frame supertrend, say, with timeframes D, W, M?
+2 Reply
Thanks for this sharing. Very usefull, whatever the timefrime, especially with Heikin Ashi ...
Reply
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!
+4 Reply
Seal PRO ahsanq
I have the same question. Nice indicator work.
Reply
Same question as well. Very nice.
Reply
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
+14 Reply
vipink1963 NicoEsterhuyse
Dear Sir

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

warm regards
+1 Reply
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
https://www.mql5.com/en/code/10851
Reply
thanks a lot tiosa1...got it..
Reply
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!')
+5 Reply
sabeve santoshporwal
add it where exactly, on which lines?
Reply
BipinBihariPatra santoshporwal
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
After adding this lines you have to actually go to alerts and create a alert for the condition on tool Super Trend.
Reply
daebak PRO santoshporwal
@santoshporwal, Thank you for the answer. Instead of "Super Trend", I selected "Up Entry Arrow" and "Down Entry Arrow" to distinguish for Down/Up. Somehow, it doesn't fire the alert when using "Up Entry Arrow"/"Down Entry Arrow". 1. How do I make the message this is Down or Up? Any idea? 2. I want to display the price (no matter open/close), and percentage when alerts. Do you think it's possible? Thank you.
Reply
@daebak,
Hi did you find a soution? can you explain if you can
Reply
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
Tradingview.com on Chrome, I can't see the bottom histogram indicator.... any clue?
Reply
Hi. How can i make this compatable with my Protrader platform?
Reply
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)));
+2 Reply
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
Hello Rajandran Have you got the code for sound and pop up alert,please?
Reply
1 Week
103 trade
1 Min -> 43 Win 60 Lose
5 Min -> 39 Win 64 Lose
I don't like this indicator.
+5 Reply
sjcwealth RadonGroup
Thanks for your honest feedback.
Reply
terrence7d RadonGroup
if you are using for forex then try
factor: 1.5
Period: 14

let me know
Reply
diggyrg terrence7d
@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
The below customized Super Trend gives more accurate results
snapshot

Reply
MarxBabu MarxBabu
@MarxBabu, The three line strategy is here for the same
SUPER SUPERTREND THREE LINE PROFIT STRATEGY

Reply
allenpascual RadonGroup
@RadonGroup, Wonder if opposite would be profitable.
Reply
how do I create a SuperTrend indicator financial chart for my website
Reply
lucrative amlanrashmi
FWD answer please
Reply
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
Can somebdy please explain the strategy in plain english?
Reply
Go thro the webinar here https://www.youtube.com/watch?v=arPnDXL17l4
Reply
BipinBihariPatra rajandran.r
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
+3 Reply
Please say about the back test result...........?
Reply
why dont you give pine code of supertrend 5.0.
It would be awesome.
Reply
MarxBabu sameer_patel18in
Dear Rajendar this is our request but you are avoiding the same
When can be see SuperTrend5.0 pls post the code
Reply
If we get SuperTrend5.0 that will be awesome
snapshot

Reply
airwyn MarxBabu
@MarxBabu, Hello, can you share the pine script code on the SuperTrend 5.0?
+1 Reply
@MarxBabu, Share the pine script
+1 Reply
how about EA this Indicator ? .
Reply
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 :)
+2 Reply
Isn't this just Parabolic SAR ?
Reply
lordmetroid Khaled-B
@Khaled-B, No, this is a Chandelier stop that adjusts itself to highest close since entry and the average true range.
Reply
hi is there anyone using supertrend
Reply
Thank you for sharing this. and I wonder if you can make it has alarm (beeping or send email) in the event of buy/sell signal?
Reply
@daebak, Or alert. Thank you.
Reply
Hi to all.
I publish a study to use with this Strategy for use TradingView Alert.
Add my study and this strategy with same parameters and after add all alert you want.

Thanks to Rajandran R for this Pine Script! :-)
Reply
I prefer 1.5 factor value.
Reply
Anyone have this in ThinkOrSwim script, ThinkScript?
Reply
My favorite indicator. Awesome!
Reply
amazing...but when to close the trade ? optimized option ?
Reply
Alfrodox Aqib00
@Aqib00, very interesting also but not very useful for trading cryptocurrencies. why not using bitcoin trading bot in the cloud. http://bit.ly/tradingbot perhaps someone could adapt the code for supertrend v.5 which can be found here http://www.marketcalls.in/amibroker/supertrend-v5-0-amibroker-afl-code.html
Reply
sai88 Alfrodox
@Alfrodox, Hi can you please let me know how to import it to trading view ..@ Rajendran r thank you for the great indicator.
Reply
thanks for share.
Reply
how I get yhis indicator?
Reply
how I get this indicator?
Reply
is min max write in above code OR do they need to be switched ?
Reply
Absolutely love this script. Helps confirm my decision to buy or sell. Thank you so much for creating.
Reply
WOW, worst indicator around here that is as useless gets 8400 views
Reply
blackbox2017 cristian.d
@cristian.d, Why do you say that Cristian?
Reply
Hello.
Could you please explain me, this part of the script "TrendUp=close>TrendUp? max(Up,TrendUp) : Up" Isn't it a circular reference? As far as I understand, function "TrendUp" refer to itself. Actually I'm trying to make this indicator in Metastock and Metastock doesn’t allow to make circular references. Can somebody explain me am I wrong and example above isn’t a circular reference or I just misunderstand calculation of this functions (TrendUp in this example)?
Thank you))
Reply
Hi Rajandran,


This looks like a great indicator, thanks for sharing.

I noticed on your site you have version 5 of this indicator. Would you be able to update here, and also, could you create a scanner (based on this indicator) that can scan Russell 3000 stocks and forex pairs?

Thank you.
Reply
supertrend is so similar to EMA 50.
Reply
Check http://www.tradeseven.com for metatarder platforms
Reply
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
日本
한국
Home Stock Screener Forex Signal Finder 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 Account and Billing Sign Out