OPEN-SOURCE SCRIPT
Key Levels

Here's a publication description you can drop into TradingView:
---
**Key Levels + Battle Line**
A clean intraday levels indicator that maps the day's most-watched price reference points and identifies the central level bulls and bears are fighting over.
At the 9:30 cash open, the script locks in and plots seven key levels, each extending fully across the chart:
- **Premarket High / Low** — the range built before the open
- **Yesterday's High / Low / Close** — prior-session reference points
- **Premarket Mid** and **Yesterday Mid** — the equilibrium of each range
It then calculates a **Battle Line** — the central pivot of the whole structure. You can set this to either the *range equilibrium* (midpoint between the highest and lowest key level) or a *5-level average* (mean of premarket high/low and yesterday's high/low/close), which behaves more like a center-of-gravity pivot. The idea is simple: price tends to chop around this line while neither side has control, and a decisive break tends to resolve in that direction.
When price closes through the Battle Line, the indicator marks the break with an arrow and flips the directional bias — close above for bullish, close below for bearish. By default, breaks are confirmed on the bar **close** rather than wicks, so you're reacting to commitment rather than noise. An optional background shade colors the session by current bias, and built-in alerts fire on each break.
**Settings**
- Fully adjustable premarket and regular session times plus timezone (default 9:30 = US cash open)
- Toggle any level on or off
- Custom colors, line widths, and label offset
- Choose the Battle Line basis and switch break confirmation between close and wick
- Optional break arrows and bias background shading
**Notes**
- Designed for intraday timeframes; built and tested on 15-minute charts
- Yesterday's values are pulled from the daily timeframe
- Levels anchor at the open, so load a recent regular-session day to see them
This is an analysis tool, not financial advice. Always confirm setups with your own plan and risk management.
---
**Key Levels + Battle Line**
A clean intraday levels indicator that maps the day's most-watched price reference points and identifies the central level bulls and bears are fighting over.
At the 9:30 cash open, the script locks in and plots seven key levels, each extending fully across the chart:
- **Premarket High / Low** — the range built before the open
- **Yesterday's High / Low / Close** — prior-session reference points
- **Premarket Mid** and **Yesterday Mid** — the equilibrium of each range
It then calculates a **Battle Line** — the central pivot of the whole structure. You can set this to either the *range equilibrium* (midpoint between the highest and lowest key level) or a *5-level average* (mean of premarket high/low and yesterday's high/low/close), which behaves more like a center-of-gravity pivot. The idea is simple: price tends to chop around this line while neither side has control, and a decisive break tends to resolve in that direction.
When price closes through the Battle Line, the indicator marks the break with an arrow and flips the directional bias — close above for bullish, close below for bearish. By default, breaks are confirmed on the bar **close** rather than wicks, so you're reacting to commitment rather than noise. An optional background shade colors the session by current bias, and built-in alerts fire on each break.
**Settings**
- Fully adjustable premarket and regular session times plus timezone (default 9:30 = US cash open)
- Toggle any level on or off
- Custom colors, line widths, and label offset
- Choose the Battle Line basis and switch break confirmation between close and wick
- Optional break arrows and bias background shading
**Notes**
- Designed for intraday timeframes; built and tested on 15-minute charts
- Yesterday's values are pulled from the daily timeframe
- Levels anchor at the open, so load a recent regular-session day to see them
This is an analysis tool, not financial advice. Always confirm setups with your own plan and risk management.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.