Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. study("DVK",overlay=false)
  2.  
  3. LowestPeriod = input(title="L1",type=integer,defval=1)
  4. MediumPeriod = input(title="M2",type=integer,defval=25)
  5.  
  6. source = close
  7. length = input(10, minval=1), mult = input(1.0, minval=0.001, maxval=50)
  8. basis = sma(source, length)
  9. dev = mult * stdev(source, length)
  10. upper = basis + dev
  11. lower = basis - dev
  12. p1 = plot(upper, color=black)
  13. p2 = plot(lower, color=black)
  14. fill(p1, p2)
  15.  
  16.  
  17.  
  18. LowestEMA = ema(close,LowestPeriod)
  19. MediumEMA = ema(close,MediumPeriod)
  20.  
  21.  
  22. LEColor = LowestEMA > LowestEMA[1] ? green : red
  23. MEColor = MediumEMA > MediumEMA[1] ? lime : maroon
  24.  
  25.  
  26. plot( LowestEMA, color= LEColor , title="L1", trackprice=false, style=line)
  27. plot( MediumEMA ,color= MEColor , title="M2", trackprice=false, style=line)
  28.  
  29. //plotshape(cross(close,Tsl) and close>Tsl , "Up Arrow", shape.triangleup,location.belowbar,green,0,0)
  30. //plotshape(cross(Tsl,close) and close<Tsl , "Down Arrow", shape.triangledown , location.abovebar, red,0,0)
  31. //plot(Trend==1 and Trend[1]==-1,color = linecolor, style = arrows, linewidth = 3,title="Trend")
  32. Trend = LowestEMA > MediumEMA or LowestEMA > upper? 1 : LowestEMA < MediumEMA or LowestEMA < lower? -1 : 0
  33. plotarrow(Trend == 1 and Trend[1] != 1 ? Trend : na, title="Up Entry Arrow", colorup=lime, maxheight=30, minheight=20, transp=0)
  34. plotarrow(Trend == -1 and Trend[1] != -1 ? Trend : na, title="Down Entry Arrow", colordown=red, maxheight=30, minheight=2, transp=0)
  35.  
  36. alertcondition(Trend == 1 and Trend[1] != 1, title='Buy Alert', message='A Buy Signal') //Alert for buy
  37. 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