Liquidity
Equal highs and lows (EQH, EQL), resting liquidity above swing highs and below swing lows, and the sweeps that take it.
Inputs
| Name | Type | Default | Range |
|---|---|---|---|
| confirm_bars | int | 3 | 1 to 50 |
| margin_atr | float | 0.1 | 0 to 5 |
| atr_period | int | 10 | 1 to 500 |
Outputs
| Name | Type | Required | Description |
|---|---|---|---|
| eqh | value | Optional | color theme.down, shape circle, shift -3, style marker, where above_bar |
| eql | value | Optional | color theme.up, shape circle, shift -3, style marker, where below_bar |
| sweep_high | event | Optional | color theme.down, shape triangle_down, style marker, where above_bar |
| sweep_low | event | Optional | color theme.up, shape triangle_up, style marker, where below_bar |
| buyside | value | Optional | color theme.down, dash dash, style step, width 1 |
| sellside | value | Optional | color theme.up, dash dash, style step, width 1 |
- Warm-up
- 2 * confirm_bars bars (6 at the defaults)
- Repaints
- Yes
- Parity
- None
Formula
A swing high is a bar whose high is above every high within confirm_bars bars on each side; it is known confirm_bars bars later, and values are written then. Swing lows mirror it.
EQH marks a swing high within margin_atr times the ATR of the previous swing high. The ATR is Wilder's average true range over atr_period bars. EQL mirrors it.
Every swing high leaves buyside liquidity at its price, and every swing low sellside liquidity. When a bar trades above a buyside level it is taken; if the bar closes back below it, that is a sweep (sweep_high). Sellside mirrors it (sweep_low).
buyside is the nearest untaken buyside level above price and sellside the nearest untaken sellside level below it. Forge keeps the fifty newest levels per side. A missing bar starts again.