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)

Hi Rajendran, Fan of your's site http://www.marketcalls.in. Grt job buddy. But plz guide me how could I add this indicator to tradingview chart as I am quite new to this site I don't know where to add this code.
+1 Reply
Check http://www.tradeseven.com for metatarder platforms
Reply
supertrend is so similar to EMA 50.
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
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
Comment removed
blackbox2017 cristian.d
@cristian.d, Why do you say that Cristian?
Reply
Absolutely love this script. Helps confirm my decision to buy or sell. Thank you so much for creating.
Reply
is min max write in above code OR do they need to be switched ?
Reply
how I get this indicator?
Reply
United States
United Kingdom
India
Deutschland
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
中国
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out