Facebook
From RyoAsukae, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 699
  1. //RyoAsukae
  2. //@version=5
  3.  
  4. indicator(title = "Algo-Trader", shorttitle="Algo", overlay=true)
  5.  
  6. src = close
  7.  
  8. //MA-crosses & trends
  9. l1 = 25
  10. l2 = 150
  11. l3 = 300
  12.  
  13. lin1 = ta.linreg(close,l1,0)
  14. lin2 = ta.linreg(close,l2,0)
  15. lin3 = ta.linreg(close,l3,0)
  16. slope1 = (lin1 - lin1[l1])/l1
  17. slope2 = (lin2 - lin2[l2])/l2
  18. slope3 = (lin3 - lin3[l3])/l3
  19.  
  20. above = ta.crossover(close,lin1) and slope2 > 0 and slope2 > slope3
  21. below = ta.crossover(lin1,close) and slope2 < 0 and slope2 < slope3
  22.  
  23. trueRange = na(high[1])? high-low : math.max(math.max(high - low, math.abs(high - close[1])), math.abs(low - close[1]))
  24. sensitivity = input(1.0,"Sensitivity")
  25. atr = trueRange/sensitivity
  26.  
  27. short = below and ta.atr(10) >= atr
  28. long =  above and ta.atr(10) >= atr
  29.  
  30. //Plotting
  31.  
  32. plotshape(long, title = "Buy",  text = 'Buy',  style = shape.labelup,   location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny)
  33. plotshape(short, title = "Sell", text = 'Sell', style = shape.labeldown, location = location.abovebar, color= color.red,   textcolor = color.white, transp = 0, size = size.tiny)

Replies to Algo rss

Title Name Language When
Re: Algo Soft Human text 1 Year ago.