OPEN-SOURCE SCRIPT
KATIK Anchor Levels

1. This Pine Script, "KATIK Anchor Levels", automatically identifies recent swing highs and lows to define an active anchor zone on the chart.
2. It accepts three user inputs: `leftBars` and `rightBars` (pivot sensitivity) and `lookback` (how far to consider anchors).
3. Pivot points are detected with `ta.pivothigh()` and `ta.pivotlow()`, which confirm a pivot after the specified left/right bars.
4. The most recent confirmed pivot values are saved into `lastHigh` and `lastLow` (persisting across bars).
5. The script plots the recent swing high as a red line and the recent swing low as a green line for immediate visual reference.
6. It shades the area between those two lines with a yellow fill to highlight the current **anchor zone**.
7. Logical conditions `insideZone`, `breakAbove`, and `breakBelow` determine whether price is neutral, bullish, or bearish relative to the anchor.
8. Three `alertcondition()` calls let you create alerts for price entering the zone, breaking above, or breaking below the anchor.
9. Best used on intraday (15–60 min) or higher timeframes with `leftBars/rightBars` tuned (smaller values = more pivots, larger = stronger pivots).
10. Limitations: pivots require sufficient bars to confirm (so anchors can lag) and the simple method doesn’t use volume/VWAP—adjust sensitivity or combine with other indicators for higher confidence.
2. It accepts three user inputs: `leftBars` and `rightBars` (pivot sensitivity) and `lookback` (how far to consider anchors).
3. Pivot points are detected with `ta.pivothigh()` and `ta.pivotlow()`, which confirm a pivot after the specified left/right bars.
4. The most recent confirmed pivot values are saved into `lastHigh` and `lastLow` (persisting across bars).
5. The script plots the recent swing high as a red line and the recent swing low as a green line for immediate visual reference.
6. It shades the area between those two lines with a yellow fill to highlight the current **anchor zone**.
7. Logical conditions `insideZone`, `breakAbove`, and `breakBelow` determine whether price is neutral, bullish, or bearish relative to the anchor.
8. Three `alertcondition()` calls let you create alerts for price entering the zone, breaking above, or breaking below the anchor.
9. Best used on intraday (15–60 min) or higher timeframes with `leftBars/rightBars` tuned (smaller values = more pivots, larger = stronger pivots).
10. Limitations: pivots require sufficient bars to confirm (so anchors can lag) and the simple method doesn’t use volume/VWAP—adjust sensitivity or combine with other indicators for higher confidence.
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.