OPEN-SOURCE SCRIPT

AlgoPilotX - Breakout & Breakdown Meter (v1)

209
Version Note:
This is a revised and improved version of the AlgoPilotX – Breakout & Breakdown Meter. It includes expanded explanations of the underlying logic, variable usage, and originality to comply with TradingView guidelines.

AlgoPilotX – Breakout & Breakdown Meter is a structured trading tool that combines Fair Value Gap (FVG) detection, session-based support/resistance breakouts, and a clean market condition info panel. It’s designed to help traders spot potential setups early and confirm stronger breakouts or breakdowns with context from momentum, volatility, and trend indicators.

How It Works
Session Levels → The first candle high/low of the session defines dynamic support/resistance. Unlike static pivots, these levels update with each new trading session and reflect real intraday sentiment.
Fair Value Gaps (FVGs) → A three-candle imbalance highlights inefficiencies. When detected, the script marks the open of the third candle as a potential entry (light green/red arrow).
Pullback Confirmations → If price pulls back into session support/resistance and then breaks away strongly, a stronger entry signal (dark green/red arrow) is plotted.
Breakouts & Breakdowns → Additional arrows appear when price crosses decisively above resistance or below support.
Signal Hierarchy → Arrows vary by color/size:
Light = early/potential setups.
Dark/Large = stronger confirmations.
Info Panel Dashboard → RSI, MACD, Bollinger Bands, and EMAs are displayed in a compact table with both numeric values and Bullish/Bearish/Neutral states, color-coded for quick interpretation.

How the Functions and Variables Work Together
Session Levels (Support & Resistance)
The script uses time() and session inputs to identify the first candle of the chosen trading session.
Variables sessionHigh and sessionLow are stored with var so they persist until the next session.
These levels are then plotted as dynamic support/resistance lines. This approach is different from static pivots or daily highs/lows, because it adapts in real-time to the market open.
Fair Value Gap (FVG) Detection
Conditions check for three-candle imbalances (low[1] > high[2] for bullish, high[1] < low[2] for bearish).
When detected, a potential entry is marked at the open of the third candle.
Variables fvgBull and fvgBear define this logic, making FVGs a core entry condition rather than a side overlay.
Entry Hierarchy (Light vs. Dark Arrows)
longPotentialEntry and shortPotentialEntry mark light green/red arrows as early signals.
pullbackToSupport and pullbackToResistance build on these by requiring price to return to session levels and then break away again.
This creates the dark green/red arrows for stronger entries, introducing a two-step filtering process.
Breakout & Breakdown Detection
breakAbove = ta.crossover(close, sessionHigh)
breakBelow = ta.crossunder(close, sessionLow)
These conditions confirm true breakouts or breakdowns beyond support/resistance, reducing noise.
Info Panel Construction
A table is created and updated each bar.
Functions like ta.rsi(), ta.ema(), ta.sma(), and ta.stdev() calculate RSI, MACD, EMAs, and Bollinger Bands.
Each indicator’s state is summarized into human-readable text (e.g., “Bullish,” “Bearish,” “Above,” “Oversold”) and displayed with color coding using the helper function f_stateColor().
Values are also displayed numerically (RSI, MACD histogram, EMA levels, BB width), making this a dashboard rather than just arrows on a chart.
Helper Function for States
f_stateColor(state) translates qualitative states into consistent colors (green for bullish/above, red for bearish/below, orange for neutral, purple for overbought/oversold).
This ensures that every signal in the info panel has a visual identity that traders can read instantly.
Alerts Integration
alertcondition() is tied to each major event: FVG potential entries, strong pullback confirmations, and breakout/breakdown signals.
This allows the script to be used for alerts, notifications and automation, not just visual charting.

How to Use
1. Default timeframe = 15m (adjustable).
2. The first session candle defines support & resistance.
3. Watch for arrows:
  • Light green (▲) below candle → Potential breakout long (FVG detected).
  • Dark green (▲) below candle → Strong breakout confirmation after pullback.
  • Light red (▼) above candle → Potential breakdown short (FVG detected).
  • Dark red (▼) above candle → Strong breakdown confirmation after pullback.
  • Larger arrows = higher confidence signals.

4. Check the Info Panel for context:
  • RSI → momentum
  • MACD → trend confirmation
  • Bollinger Bands → overbought/oversold
  • EMA20 & EMA50 → short- and medium-term trend bias

5. Always confirm with your own price action, volume, and risk management rules.
6. Easily move the Info Panel to any corner of the chart via settings to keep your view clear.

Why This Structure Is Original
Not a mashup: Instead of simply overlaying RSI, MACD, or EMAs, the script integrates them into a signal-filtering framework.
Dynamic anchoring: Session-based high/low variables make levels adaptive to intraday structure, unlike fixed pivots.
Dual entry tiering: Light vs. dark arrows are built by combining FVGs + pullback conditions, offering nuance most breakout scripts lack.
Dashboard-style panel: Variables are summarized into a real-time info box with both numbers and state labels, replacing multiple chart overlays with one compact tool.
Modular functions: Breakout, pullback, FVG detection, and indicator states are modularized with separate variables — making the script flexible, extendable, and unique in design.

Disclaimer
This script is for educational purposes only. It does not constitute financial advice and does not guarantee profitable outcomes. Always backtest thoroughly, paper trade, and use proper risk management before trading live.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.