# Support and Resistance

> Support and Resistance is an indicator drawn over the price chart.

Source: https://algobarsx.com/docs/ex-34-support-resistance-levels/

```algobarsx
indicator "Support and Resistance"
    pane: price

input lookback = 300
input min_touches = 3

found = support_resistance(lookback, touches: min_touches).filter(l => l.touches >= min_touches)
strongest = found.sort_by(l => -l.strength)

for level in strongest.keep_last(6):
    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: 2
    label "{level.touches} touches", at: (bar.index, level.price), color: gray
```
What 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".
