OPEN-SOURCE SCRIPT
Bastion Level Sentinel [JOAT]

Bastion Level Sentinel [JOAT]
Introduction
The Bastion Level Sentinel is an open-source dynamic support and resistance overlay that derives price levels from EMA rounding, then builds conviction scores through touch-based strength analysis with optional volume confirmation. Rather than drawing static horizontal lines at arbitrary prices, BLS rounds an EMA to a configurable price increment (e.g., 500, 1000) to identify the institutional-grade price rails that the market naturally gravitates toward. Each time price interacts with a rail, the indicator counts and classifies the touch — validated (with above-average volume) or unconfirmed (low volume) — and uses these counts to build a conviction score that drives the visual intensity of the level through color gradients.
Most support/resistance indicators either use fixed pivot points that become stale, or they require manual drawing. BLS automates the process by anchoring levels to a moving EMA foundation, resetting touch counts when levels shift, and providing a complete lifecycle view of each level — from nascent (newly formed) through seasoned to ancient. The conviction engine ensures that levels with more validated touches appear visually stronger, giving traders an immediate sense of which levels carry the most institutional weight.

Core Engine: Level Derivation
The level calculation is straightforward but effective:
Pine Script®
The EMA provides a smoothed price anchor. Rounding up to the nearest increment gives the ceiling rail (resistance), and rounding down gives the floor rail (support). The grid increment is fully configurable — use 500 for crypto, 50 for stocks, 10 for forex — allowing the indicator to adapt to any instrument's natural price structure.
A stability check ensures that levels are only considered active when they remain unchanged from the previous bar. This prevents false touch counts during level transitions.
Conviction Engine (Touch-Based Strength Scoring)
The conviction engine is the heart of BLS. Every time price enters a rail's proximity zone (defined by a configurable tolerance fraction of the level gap), a touch is registered. Touches are edge-triggered — only the first bar of each interaction counts, preventing a single extended visit from inflating the score.
When volume confirmation is enabled, touches are classified into two categories:
The conviction score scales from 0% to 100% based on the number of touches relative to the saturation threshold (default 5 touches for 100%). When levels shift (the EMA moves enough to change the rounded level), all touch counts reset to zero, and the lifecycle begins fresh.
Level Lifecycle and Maturity
Each rail tracks its age in bars since the last level shift:
Ancient levels with high conviction scores represent the strongest support/resistance zones — they have been tested repeatedly over a long period and have held.
Visual Architecture
Signal Architecture
BLS generates five distinct signal types, all confirmed-bar and edge-triggered:
Pine Script®

Command Panel (Dashboard)
An 11-row monospace dashboard displays:
Input Parameters
Fortress Grid:
Conviction Engine:
Optics Layer:
How to Use This Indicator
Limitations
Originality Statement
This indicator is original in its conviction-based level strength scoring approach. While EMA-derived support/resistance and touch counting are known concepts individually, BLS is justified because:
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice. Support and resistance levels describe historical price interaction zones but do not guarantee future reactions. Levels can and do break. Always use proper risk management and conduct your own analysis before making trading decisions. The author is not responsible for any losses incurred from using this tool.
-Made with passion by officialjackofalltrades
Introduction
The Bastion Level Sentinel is an open-source dynamic support and resistance overlay that derives price levels from EMA rounding, then builds conviction scores through touch-based strength analysis with optional volume confirmation. Rather than drawing static horizontal lines at arbitrary prices, BLS rounds an EMA to a configurable price increment (e.g., 500, 1000) to identify the institutional-grade price rails that the market naturally gravitates toward. Each time price interacts with a rail, the indicator counts and classifies the touch — validated (with above-average volume) or unconfirmed (low volume) — and uses these counts to build a conviction score that drives the visual intensity of the level through color gradients.
Most support/resistance indicators either use fixed pivot points that become stale, or they require manual drawing. BLS automates the process by anchoring levels to a moving EMA foundation, resetting touch counts when levels shift, and providing a complete lifecycle view of each level — from nascent (newly formed) through seasoned to ancient. The conviction engine ensures that levels with more validated touches appear visually stronger, giving traders an immediate sense of which levels carry the most institutional weight.
Core Engine: Level Derivation
The level calculation is straightforward but effective:
float emaVal = ta.ema(close, emaLen)
float topLvl = roundVal * math.ceil(emaVal / roundVal)
float botLvl = roundVal * math.floor(emaVal / roundVal)
The EMA provides a smoothed price anchor. Rounding up to the nearest increment gives the ceiling rail (resistance), and rounding down gives the floor rail (support). The grid increment is fully configurable — use 500 for crypto, 50 for stocks, 10 for forex — allowing the indicator to adapt to any instrument's natural price structure.
A stability check ensures that levels are only considered active when they remain unchanged from the previous bar. This prevents false touch counts during level transitions.
Conviction Engine (Touch-Based Strength Scoring)
The conviction engine is the heart of BLS. Every time price enters a rail's proximity zone (defined by a configurable tolerance fraction of the level gap), a touch is registered. Touches are edge-triggered — only the first bar of each interaction counts, preventing a single extended visit from inflating the score.
When volume confirmation is enabled, touches are classified into two categories:
- Validated Touches: Price interacts with the rail while short-term volume exceeds the configurable threshold (default 1.2x average). These carry 70% weight in the conviction score.
- Unconfirmed Touches: Price interacts with the rail on below-average volume. These carry 30% weight — they still count, but with reduced conviction.
The conviction score scales from 0% to 100% based on the number of touches relative to the saturation threshold (default 5 touches for 100%). When levels shift (the EMA moves enough to change the rounded level), all touch counts reset to zero, and the lifecycle begins fresh.
Level Lifecycle and Maturity
Each rail tracks its age in bars since the last level shift:
- NASCENT: Fewer than 50 bars old — newly formed level, conviction still building
- SEASONED: 50-200 bars old — established level with meaningful touch history
- ANCIENT: Over 200 bars old — long-standing level that has persisted through extended price action
Ancient levels with high conviction scores represent the strongest support/resistance zones — they have been tested repeatedly over a long period and have held.
Visual Architecture
- Primary Rails: Ceiling and floor levels plotted with conviction-driven color gradients. Low conviction = neutral purple, high conviction = vivid red (resistance) or green (support). The color intensity directly communicates level strength.
- Proximity Halos: Tolerance zone boundaries around each rail, filled with transparency that scales with conviction. Stronger levels have more visible halos.
- Equator Line: The midpoint between ceiling and floor — a natural equilibrium reference.
- Tertiary Gridlines: 25% and 75% sub-levels between the rails, providing additional structure within the grid.
- Proximity Aura: Subtle background tint when price enters a rail's tolerance zone — immediate visual alert that price is near a significant level.
- Grid Tint Candles: Candles colored by their position within the grid — red tones near the ceiling, green tones near the floor, purple at the equator.
Signal Architecture
BLS generates five distinct signal types, all confirmed-bar and edge-triggered:
- RAIL LOCK (Validated Touch): Price interacts with a rail on confirmed volume. The label includes the running touch count. These are the highest-confidence interaction signals.
- ECHO (Unconfirmed Touch): Price interacts with a rail but volume is below the confirmation threshold. The interaction is noted but flagged as lower confidence.
- BREACH: Price closes beyond a rail — a potential breakout (ceiling) or breakdown (floor). These are edge-triggered crossover/crossunder signals.
- APPROACH: Price enters a rail's proximity zone for the first time — an early warning that an interaction is imminent.
- Conviction Pulse: Periodic labels on the rails (every 20 bars) showing the current conviction percentage, providing at-a-glance strength information without cluttering the chart.
// Edge-triggered touch detection
bool topTouchEdge = topTouch and not topTouch[1]
bool botTouchEdge = botTouch and not botTouch[1]
Command Panel (Dashboard)
An 11-row monospace dashboard displays:
- CEILING: Current resistance rail price
- C CONV: Ceiling conviction — validated/total touches with percentage (e.g., "3v/4t (85%)")
- FLOOR: Current support rail price
- F CONV: Floor conviction — validated/total touches with percentage
- EQUATOR: Midpoint price between ceiling and floor
- NEAREST: Which rail price is closest to, with distance as a percentage
- GRID POS: Price position classification (Ceiling Zone, Upper Grid, Equator, Lower Grid, Floor Zone)
- MATURITY: Lifecycle stage of each rail (Nascent, Seasoned, Ancient)
- LOCKED: Whether each rail is currently stable (unchanged from previous bar)
- FLUX: Current volume confirmation ratio — values above the threshold indicate "hot" volume
Input Parameters
Fortress Grid:
- Lattice Anchor: EMA period for level derivation (default 21)
- Grid Increment: Price rounding value (default 500) — adjust for your instrument
- Proximity Radius: Fraction of level gap used as tolerance zone (default 0.15)
- Tertiary Gridlines: Toggle 25%/75% sub-levels
Conviction Engine:
- Conviction Saturation: Touches needed for 100% conviction (default 5)
- Flux Validation: Require above-average volume for validated touches (default on)
- Flux Threshold: Volume ratio required for validation (default 1.2x)
Optics Layer:
- Individual toggles for: Primary Rails, Proximity Halos, Equator Line, Command Panel, Proximity Aura, Breach Flash, Conviction Pulse, Approach Beacon, Grid Tint Candles
How to Use This Indicator
- Adjust the Grid Increment to match your instrument — 500 or 1000 for BTC, 50 or 100 for stocks, 10 or 25 for forex pairs. The goal is to identify the round-number levels that institutional orders cluster around.
- Pay attention to conviction scores — rails with 80%+ conviction and SEASONED or ANCIENT maturity are the strongest levels. Expect significant reactions when price approaches them.
- RAIL LOCK signals with high touch counts indicate levels that have been tested and held multiple times. These are prime candidates for bounce trades.
- BREACH signals mark potential breakouts. A breach of a high-conviction rail is more significant than a breach of a low-conviction one.
- Use APPROACH signals as early warnings to prepare for potential level interactions. They give you time to assess the setup before the actual touch occurs.
- The Grid Position metric in the dashboard tells you where price sits within the current structure — useful for bias determination and risk assessment.
Limitations
- EMA-derived levels are inherently lagging — they reflect where the market has been, not where it is going. Levels shift when the EMA moves enough to change the rounded value.
- The rounding approach works best on instruments with natural round-number psychology (crypto, indices, large-cap stocks). It may be less effective on instruments without clear round-number clustering.
- Touch counts reset when levels shift, which means conviction history is lost during transitions. This is by design (stale counts on new levels would be misleading) but means newly formed levels always start at zero conviction.
- Volume confirmation depends on reliable volume data. Instruments with inconsistent volume reporting may produce unreliable validation classifications.
- The indicator identifies levels and measures their strength but does not predict whether price will bounce or break through. That decision requires additional context.
Originality Statement
This indicator is original in its conviction-based level strength scoring approach. While EMA-derived support/resistance and touch counting are known concepts individually, BLS is justified because:
- The conviction engine differentiates between volume-validated and unconfirmed touches, weighting them differently to produce a more meaningful strength score than simple touch counting.
- Level lifecycle tracking (Nascent/Seasoned/Ancient) provides temporal context that static level indicators lack.
- Conviction-driven color gradients using color.from_gradient create an immediate visual hierarchy where stronger levels are visually more prominent.
- The proximity halo system with conviction-scaled transparency provides zone-based level visualization rather than single-line levels.
- Edge-triggered touch detection with stability checks prevents false counts during level transitions and extended visits.
- The comprehensive dashboard presents level prices, conviction breakdowns, maturity, grid position, and volume state simultaneously.
- Five distinct signal types (Rail Lock, Echo, Breach, Approach, Conviction Pulse) provide a complete interaction vocabulary for level-based analysis.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice. Support and resistance levels describe historical price interaction zones but do not guarantee future reactions. Levels can and do break. Always use proper risk management and conduct your own analysis before making trading decisions. The author is not responsible for any losses incurred from using this tool.
-Made with passion by officialjackofalltrades
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.