xmd79

Daily SMA In Lower Timeframe

Aug 26th, 2022
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © signalp1
  3.  
  4. //@version=5
  5. //change to make it public
  6. indicator("Daily SMA In Lower Timeframe")
  7.  
  8. out50 = ta.sma(close, 50)
  9. s50 = request.security(syminfo.tickerid, "1D", out50)
  10. out100 = ta.sma(close, 100)
  11. s100 = request.security(syminfo.tickerid, "1D", out100)
  12. out200 = ta.sma(close, 200)
  13. s200 = request.security(syminfo.tickerid, "1D", out200)
  14.  
  15. isInRange(cl,s)=>cl*1.05>s and cl*0.95<s
  16.  
  17. if(barstate.islast)
  18. if(isInRange(close[0],s50[0]))
  19. line.new(bar_index -78, s50, bar_index, s50,extend=extend.right,color=color.blue)
  20. label.new(bar_index-78,s50,text="50SMA",color=color.aqua)
  21. if(isInRange(close[0],s100[0]))
  22. line.new(bar_index -78, s100, bar_index, s100,extend=extend.right,color=color.green)
  23. label.new(bar_index-78,s100,text="100SMA",color=color.aqua)
  24. if(isInRange(close[0],s200[0]))
  25. line.new(bar_index -78, s200, bar_index, s200,extend=extend.right,color=color.red)
  26. label.new(bar_index-78,s200,text="200SMA",color=color.aqua)
  27.  
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment