Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator("Multitimeframe Reversals", overlay=true)
- // Input parameters
- lookback = input(14, "Lookback period")
- resistance_threshold = input(2.0, "Resistance threshold")
- support_threshold = input(2.0, "Support threshold")
- // Calculate midline
- midline = ta.sma(close, lookback)
- plot(midline, color=color.white, title="Midline")
- // Calculate upper and lower lines
- upper_line = midline + resistance_threshold * ta.stdev(close, lookback)
- lower_line = midline - support_threshold * ta.stdev(close, lookback)
- plot(upper_line, color=color.green, title="Upper line")
- plot(lower_line, color=color.red, title="Lower line")
- // Define support and resistance reversal signals
- support_reversal = ta.cross(close, lower_line)
- resistance_reversal = ta.cross(upper_line, close)
- // Plot signals
- plotshape(support_reversal, style=shape.triangleup, location=location.belowbar, color=color.green, title="Support Reversal")
- plotshape(resistance_reversal, style=shape.triangledown, location=location.abovebar, color=color.red, title="Resistance Reversal")
Advertisement
Add Comment
Please, Sign In to add comment