AlgoPilotX - Breakout & Breakdown Meter (v1)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 > high for bullish, high < low 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.
Relativestrenghtindex
RSI Divergence Strategy - AliferCryptoStrategy Overview
The RSI Divergence Strategy is designed to identify potential reversals by detecting regular bullish and bearish divergences between price action and the Relative Strength Index (RSI). It automatically enters positions when a divergence is confirmed and manages risk with configurable stop-loss and take-profit levels.
Key Features
Automatic Divergence Detection: Scans for RSI pivot lows/highs vs. price pivots using user-defined lookback windows and bar ranges.
Dual SL/TP Methods:
- Swing-based: Stops placed a configurable percentage beyond the most recent swing high/low.
- ATR-based: Stops placed at a multiple of Average True Range, with a separate risk/reward multiplier.
Long and Short Entries: Buys on bullish divergences; sells short on bearish divergences.
Fully Customizable: Input groups for RSI, divergence, swing, ATR, and general SL/TP settings.
Visual Plotting: Marks divergences on chart and plots stop-loss (red) and take-profit (green) lines for active trades.
Alerts: Built-in alert conditions for both bullish and bearish RSI divergences.
Detailed Logic
RSI Calculation: Computes RSI of chosen source over a specified period.
Pivot Detection:
- Identifies RSI pivot lows/highs by scanning a lookback window to the left and right.
- Uses ta.barssince to ensure pivots are separated by a minimum/maximum number of bars.
Divergence Confirmation:
- Bullish: Price makes a lower low while RSI makes a higher low.
- Bearish: Price makes a higher high while RSI makes a lower high.
Entry:
- Opens a Long position when bullish divergence is true.
- Opens a Short position when bearish divergence is true.
Stop-Loss & Take-Profit:
- Swing Method: Computes the recent swing high/low then adjusts by a percentage margin.
- ATR Method: Uses the current ATR × multiplier applied to the entry price.
- Take-Profit: Calculated as entry price ± (risk × R/R ratio).
Exit Orders: Uses strategy.exit to place bracket orders (stop + limit) for both long and short positions.
Inputs and Configuration
RSI Settings: Length & price source for the RSI.
Divergence Settings: Pivot lookback parameters and valid bar ranges.
SL/TP Settings: Choice between Swing or ATR method.
Swing Settings: Swing lookback length, margin (%), and risk/reward ratio.
ATR Settings: ATR length, stop multiplier, and risk/reward ratio.
Usage Notes
Adjust the Pivot Lookback and Range values to suit the volatility and timeframe of your market.
Use higher ATR multipliers for wider stops in choppy conditions, or tighten swing margins in trending markets.
Backtest different R/R ratios to find the balance between win rate and reward.
Disclaimer
This script is for educational purposes only and does not constitute financial advice. Trading carries significant risk and you may lose more than your initial investment. Always conduct your own research and consider consulting a professional before making any trading decisions.