Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © Sofien-Kaabar
- //@version=5
- indicator("RSI Objective Lines")
- lookback = input(defval = 200, title = 'Lookback')
- threshold = input(defval = 0.05, title = 'Threshold')
- rsi_high = ta.rsi(high, 14)
- rsi_low = ta.rsi(low, 14)
- // calculating the maximum range
- max_range = ta.highest(rsi_high, lookback) - ta.lowest(rsi_low, lookback)
- // support
- support = ta.lowest(rsi_low, lookback) + (max_range * threshold)
- // resistance
- resistance = ta.highest(rsi_high, lookback) - (max_range * threshold)
- inp = input(close)
- plot(ta.rsi(inp, 14))
- plot(support, color = ta.rsi(inp, 14) > support? color.green : na)
- plot(resistance, color = ta.rsi(inp, 14) < resistance? color.red : na)
Add Comment
Please, Sign In to add comment