xmd79

NYSE Tick Alert on Chart

Dec 22nd, 2022
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. //@version=5
  2. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  3. // © DocRR
  4.  
  5. indicator(title='NYSE Tick Alert on Chart', overlay=true)
  6.  
  7. user_input = input.float(minval = 600, step = 50, defval = 600, title='Level', tooltip="Min. Value = 600, step = 50")
  8.  
  9. string SIZE_LARGE = "Large"
  10. string SIZE_NORMAL = "Normal"
  11. string SIZE_SMALL = "Small"
  12. string sizeInput = input.string(SIZE_NORMAL, "Size", options = [SIZE_LARGE, SIZE_NORMAL, SIZE_SMALL])
  13. var bool plot = na
  14.  
  15. getSize(simple string userSize) =>
  16. result =
  17. switch userSize
  18. SIZE_LARGE => size.large
  19. SIZE_NORMAL => size.normal
  20. SIZE_SMALL => size.small
  21. => size.auto
  22.  
  23. neg_input = user_input * -1
  24.  
  25. [h, l, firstbar_check, lastbar_check] = request.security('USI:TICK', timeframe.period, [high, low, session.isfirstbar, session.islastbar])
  26.  
  27. plot := firstbar_check ? true : lastbar_check[1] ? false : plot
  28. if not plot
  29. h := na
  30. l := na
  31.  
  32. if h >= user_input
  33. label.new(bar_index, na, yloc = yloc.abovebar, color = color.new(#ff8952, 0), style = label.style_triangledown, size = getSize(sizeInput))
  34.  
  35. if l <= neg_input
  36. label.new(bar_index, na, yloc = yloc.belowbar, color = color.new(#52a3ff, 0), style = label.style_triangleup, size = getSize(sizeInput))
  37.  
  38. alertcondition(h >= user_input == true, "NYSE Tick high!")
  39. alertcondition(l <= neg_input == true, "NYSE Tick low!")
Advertisement
Add Comment
Please, Sign In to add comment