Support and Resistance
Support and Resistance is an indicator drawn over the price chart.
core language
1
indicator "Support and Resistance"2
pane: price3
4
input lookback = 3005
input min_touches = 36
7
found = support_resistance(lookback, touches: min_touches).filter(l => l.touches >= min_touches)8
strongest = found.sort_by(l => -l.strength)9
10
for level in strongest.keep_last(6):11
line from: (bar.index - 50, level.price), to: (bar.index, level.price), extend: right, color: if level.price > close then red.fade(40) else green.fade(40), width: 212
label "{level.touches} touches", at: (bar.index, level.price), color: grayWhat this script says
Support and Resistance is an indicator drawn over the price chart.
You can change 2 inputs: lookback (default 300) and min_touches (default 3).
It calculates found as support_resistance(lookback, touches: min_touches).filter(l => l.touches >= min_touches) and strongest as found.sort_by(l => -l.strength).
On each bar, it goes through each level in strongest.keep_last(6) and draws a line and labels "{level.touches} touches".