xmd79

LLHH_SESSION

Sep 26th, 2021
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 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. // © CryptoBoole
  3.  
  4. //@version=4
  5. study("LLHH_SESSION", overlay=true, max_bars_back=1440)
  6.  
  7. // start-end of session
  8. t = time(timeframe.period, "0001-2359:1234567")
  9. x = barssince(na(t))
  10.  
  11. // keep session high and low
  12. var sessionHH = float(na)
  13. var sessionLL = float(na)
  14.  
  15. // if we are within the session calculate hh ll barsback = session
  16. if x > 0
  17. sessionHH := highest(close, x)
  18. sessionLL := lowest(close, x)
  19.  
  20. // mark sessions
  21. bgcolor(x == 0.0 ? color.silver : na)
  22.  
  23. // session high/low
  24. plot(sessionHH, color=color.red)
  25. plot(sessionLL, color=color.green)
  26.  
Advertisement
Add Comment
Please, Sign In to add comment