Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study("DVK",overlay=false)
- LowestPeriod = input(title="L1",type=integer,defval=1)
- MediumPeriod = input(title="M2",type=integer,defval=25)
- source = close
- length = input(10, minval=1), mult = input(1.0, minval=0.001, maxval=50)
- basis = sma(source, length)
- dev = mult * stdev(source, length)
- upper = basis + dev
- lower = basis - dev
- p1 = plot(upper, color=black)
- p2 = plot(lower, color=black)
- fill(p1, p2)
- LowestEMA = ema(close,LowestPeriod)
- MediumEMA = ema(close,MediumPeriod)
- LEColor = LowestEMA > LowestEMA[1] ? green : red
- MEColor = MediumEMA > MediumEMA[1] ? lime : maroon
- plot( LowestEMA, color= LEColor , title="L1", trackprice=false, style=line)
- plot( MediumEMA ,color= MEColor , title="M2", trackprice=false, style=line)
- //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 = arrows, linewidth = 3,title="Trend")
- Trend = LowestEMA > MediumEMA or LowestEMA > upper? 1 : LowestEMA < MediumEMA or LowestEMA < lower? -1 : 0
- plotarrow(Trend == 1 and Trend[1] != 1 ? Trend : na, title="Up Entry Arrow", colorup=lime, maxheight=30, minheight=20, transp=0)
- plotarrow(Trend == -1 and Trend[1] != -1 ? Trend : na, title="Down Entry Arrow", colordown=red, maxheight=30, minheight=2, transp=0)
- alertcondition(Trend == 1 and Trend[1] != 1, title='Buy Alert', message='A Buy Signal') //Alert for buy
- alertcondition(Trend == -1 and Trend[1] != -1, title='Sell Alert', message='A Sell Signal') //Alert for sell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement