Advertisement
ingram9999

RSI Highlight

Nov 21st, 2023
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. //@version=4
  2. study("RSI Highlight on Next NQ Candle", shorttitle="RSI NQ Next Candle", overlay=true)
  3.  
  4. // RSI settings
  5. rsiPeriod = 14
  6. rsiNQHigh = 80
  7. rsiESHigh = 85
  8. rsiNQLow = 20
  9. rsiESLow = 15
  10.  
  11. // Calculate RSI for NQ
  12. rsiNQ = rsi(close, rsiPeriod)
  13.  
  14. // Fetch RSI for ES
  15. symbolES = "ES1!" // Replace with actual ES symbol
  16. rsiES = security(symbolES, timeframe.period, rsi(close, rsiPeriod))
  17.  
  18. // Condition for current bar
  19. longCondition = rsiNQ[1] < rsiNQLow and rsiES[1] < rsiESLow
  20. shortCondition = rsiNQ[1] > rsiNQHigh and rsiES[1] > rsiESHigh
  21.  
  22. // Highlighting logic
  23. bgcolor(longCondition ? color.green : na, transp=90)
  24. bgcolor(shortCondition ? color.red : na, transp=90)
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement