xmd79

Visible Range High Low [vnhilton]

May 25th, 2023
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 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. // © vnhilton
  3.  
  4. //Inspired by PineCoders' "VisibleChart" library & "Chart VWAP" by TradingView
  5.  
  6. //@version=5
  7. indicator("Visible Range High Low [vnhilton]", "VRHL", true)
  8.  
  9. //Getting access to functions from PineCoders' "VisibleChart" library
  10. import PineCoders/VisibleChart/4 as PCVC
  11.  
  12. //Label parameters
  13. highLabelColor = input.color(color.rgb(0, 165, 49, 80), "High Label Color")
  14. highTextColor = input.color(color.rgb(0, 165, 49, 0), "High Text Color")
  15.  
  16. lowLabelColor = input.color(color.rgb(255, 109, 90, 80), "Low Label Color")
  17. lowTextColor = input.color(color.rgb(255, 109, 90, 0), "Low Text Color")
  18.  
  19. //Getting OHLCV values
  20. [chartOpen, chartHigh, chartLow, chartClose, chartVolume] = PCVC.ohlcv()
  21.  
  22. //Getting HL time
  23. int highTime = PCVC.highBarTime()
  24. int lowTime = PCVC.lowBarTime()
  25.  
  26. //Plotting labels
  27. var label highLabel = label.new(na, na, na, xloc.bar_time, yloc.price, highLabelColor, label.style_label_down, highTextColor)
  28. var label lowLabel = label.new(na, na, na, xloc.bar_time, yloc.price, lowLabelColor, label.style_label_up, lowTextColor)
  29.  
  30. label.set_xy(highLabel, highTime, chartHigh)
  31. label.set_xy(lowLabel, lowTime, chartLow)
  32. label.set_text(highLabel, str.tostring(chartHigh, format.mintick))
  33. label.set_text(lowLabel, str.tostring(chartLow, format.mintick))
Advertisement
Add Comment
Please, Sign In to add comment