10 Things to know about Supertrend
//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>TrendUp? max(Up,TrendUp) : Up TrendDown=close<TrendDown? min(Dn,TrendDown) : Dn Trend = close > TrendDown ? 1: close< TrendUp? -1: nz(Trend,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,color = linecolor, style = circles, linewidth = 3,title="Trend") plotarrow(Trend == 1 and Trend == -1 ? Trend : na, title="Up Entry Arrow", colorup=lime, maxheight=60, minheight=50, transp=0) plotarrow(Trend == -1 and Trend == 1 ? Trend : na, title="Down Entry Arrow", colordown=red, maxheight=60, minheight=50, transp=0)
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.
did you find your answer? I also want to know how can I set alert when arrow is poped up
Hi did you find a soution? can you explain if you can
AvgTrueRangeLength (9), AvgTrueRangeMult (1) , Strength (9);
St = SuperTrend( AvgTrueRangeLength, AvgTrueRangeMult, Strength, strend);
Plot1 (st, "Up");
Plot2 (st, "Down");
Plot3 (st, "SuperTrend", IFF (strend = 1, GetPlotColor (1) , GetPlotColor (2)));
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)?