ay2096388

US market analysis

Education
TVC:IXIC   US Composite Index



//@version=2
//supertrend strategy multitimeframe analysis...

strategy("TTK TOOL", overlay=true, default_qty_value=100)
res = input(title="Main SuperTrend Time Frame", type=resolution, defval="720")
Factor=input(2, minval=1,maxval = 100)
Pd=input(10, minval=1,maxval = 100)

tp = input(500,title="Take Profit")
sl = input(400,title="Stop Loss")


Up=hl2-(Factor*atr(Pd))
Dn=hl2+(Factor*atr(Pd))
MUp=security(tickerid,res,hl2-(Factor*atr(Pd)))
MDn=security(tickerid,res,hl2+(Factor*atr(Pd)))

Mclose=security(tickerid,res,close)

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

MTrendUp=Mclose>MTrendUp? max(MUp,MTrendUp) : MUp
MTrendDown=Mclose<MTrendDown? min(MDn,MTrendDown) : MDn

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

MTrend = Mclose > MTrendDown ? 1: Mclose< MTrendUp? -1: nz(MTrend,1)
MTsl = MTrend==1? MTrendUp: MTrendDown

linecolor = Trend == 1 ? green: red
plot(Tsl, color = linecolor , style = line , linewidth = 4,title = "SuperTrend")

Mlinecolor = MTrend == 1 ? black : red
plot(MTsl, color = Mlinecolor , style = line , linewidth = 4,title = "Main SuperTrend")

plotshape(cross(close,Tsl) and close>Tsl , "Up Arrow", shape.triangleup,location.belowbar,black,0,0)
plotshape(cross(Tsl,close) and close<Tsl , "Down Arrow", shape.triangledown , location.abovebar, black,0,0)
up = Trend == 1 and Trend == -1 and MTrend == 1
down = Trend == -1 and Trend == 1 and MTrend == -1



golong = Trend == 1 and Trend == -1 and MTrend == 1
goshort = Trend == -1 and Trend == 1 and MTrend == -1

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.