Advertisement
theartoftrading

HLine Labels

Aug 2nd, 2021
73
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © ZenAndTheArtOfTrading.com
  3. // @version=4
  4. study("HLine Labels", overlay=true)
  5.  
  6. // Plot HLine
  7. hlPrice = 1.00
  8. hl = hline(hlPrice)
  9.  
  10. // Check if candle touches HLine
  11. touchesHL = low <= hlPrice and high >= hlPrice
  12.  
  13. // Draw label only if candle touches HLine
  14. myLabel = touchesHL ? label.new(bar_index, high, text="Touch!", tooltip="Touches " + tostring(hlPrice), style=label.style_label_down, color=color.blue, textcolor=color.white, size=size.small) : na
Advertisement
RAW Paste Data Copied
Advertisement