OPEN-SOURCE SCRIPT

Aegis Parabolic Oscillator - Triple Confluence Histogram

586
What This Indicator Does

-The Aegis Parabolic Oscillator transforms the relationship between two Parabolic SAR layers operating on different timeframes into a single histogram that oscillates between five discrete levels: +100, +50, 0, -50, and -100. Each level represents a specific degree of alignment between a higher-timeframe trend filter (Macro SAR), a lower-timeframe momentum signal (Micro SAR), and an exponential moving average confirmation layer.

-When all three layers agree on direction, the oscillator reaches full confluence. When only the SAR layers agree but the EMA does not confirm, the oscillator shows partial confluence. When the layers conflict, the oscillator returns to zero.
istantanea
-This converts the abstract concept of multi-timeframe trend agreement into a concrete, quantifiable reading that can be tracked, alerted on, and used as a filter for other trading strategies.

How It Works

The indicator operates through three distinct analytical layers that are evaluated simultaneously on every bar.

-Layer 1 - Macro SAR (Trend Structure)
A Parabolic SAR is calculated on a user-defined higher timeframe to determine the dominant market structure. By default, this runs on the Daily chart. The Macro SAR uses conservative acceleration factor settings (start: 0.01, increment: 0.01, max: 0.15) which produce a slower, less reactive indicator that filters out minor pullbacks and focuses only on genuine trend reversals at the structural level.
istantanea
When price closes above the Macro SAR on the higher timeframe, the macro trend is considered bullish. When price closes below the Macro SAR, the macro trend is considered bearish. This establishes the directional bias for the entire analysis.

-Layer 2 - Micro SAR (Entry Momentum)
A second Parabolic SAR is calculated on a lower timeframe to provide the momentum signal. By default, this runs on the 1-hour chart. The Micro SAR uses faster acceleration settings (start: 0.02, increment: 0.02, max: 0.20) to respond more quickly to directional changes within the broader trend structure.
istantanea
The Micro SAR determines whether short-term momentum aligns with or diverges from the macro trend established by Layer 1. Agreement between both SAR layers indicates that trend and momentum are synchronized.

-Layer 3 - EMA Confirmation Filter
An exponential moving average is calculated on the Macro timeframe and serves as a third confirmation dimension. The EMA length is configurable (default: 21 periods on the Macro timeframe).

For the oscillator to reach full bullish confluence (+100), price must be above this EMA. For full bearish confluence (-100), price must be below the EMA. When the SAR layers agree but the EMA does not confirm, the oscillator shows partial confluence (+50 or -50) rather than full confluence.

The EMA is used as an internal calculation filter only. It is not plotted as a visible line on the chart. Its role is purely to provide an additional confirmation gate that distinguishes strong alignment from moderate alignment.

Confluence Logic and Oscillator Values

The indicator combines the three layers into a single discrete value according to this logic:

+100 (Full Bullish Confluence): Macro SAR is bullish AND Micro SAR is bullish AND price is above the Macro EMA. All three conditions confirm bullish direction.

+50 (Partial Bullish Confluence): Macro SAR is bullish AND Micro SAR is bullish BUT price is below the Macro EMA. The SAR layers agree on bullish direction but the EMA filter does not confirm.

0 (Neutral / Conflict): The Macro SAR and Micro SAR disagree on direction. When the macro trend is bullish but micro momentum is bearish, or when the macro trend is bearish but micro momentum is bullish, the oscillator returns zero indicating conflicting signals.

-50 (Partial Bearish Confluence): Macro SAR is bearish AND Micro SAR is bearish BUT price is above the Macro EMA. The SAR layers agree on bearish direction but the EMA filter does not confirm.

-100 (Full Bearish Confluence): Macro SAR is bearish AND Micro SAR is bearish AND price is below the Macro EMA. All three conditions confirm bearish direction.

Visual Components

Histogram
-The primary visual element is a column histogram centered on zero. The histogram displays the current confluence value with color-coded bars. Full bullish bars (+100) appear in bright green. Partial bullish bars (+50) appear in semi-transparent green. Full bearish bars (-100) appear in deep red. Partial bearish bars (-50) appear in semi-transparent red. Neutral bars (0) are not visible.
istantanea
Macro Ribbon
-Two narrow column plots at the +15 and -15 levels create a visual frame around the histogram. These ribbon columns indicate the current Macro SAR state regardless of the histogram value. When the Macro SAR is bullish, the ribbon columns appear in white (by default). When bearish, they appear in black. This provides constant context for the macro trend direction even when the histogram shows neutral or partial confluence.

Background Tint
-An optional background color can be enabled that tints the entire chart background based on the Macro SAR state. When Macro SAR is bullish, the background receives a subtle white tint. When bearish, a dark tint. The transparency is adjustable to avoid visual interference with price action.
istantanea
Non-Repainting Implementation

-All security calls in this indicator use lookahead disabled (barmerge.lookahead_off) and reference the previous closed bar using the [1] index. This means the indicator calculates confluence based on confirmed bar closes only, not on intra-bar price movements.

-The indicator will not repaint. Once a bar closes, its confluence value is fixed and will not change on subsequent bars. This makes the indicator suitable for backtesting analysis and strategy development where historical accuracy is required.

-If the higher timeframe data is unavailable (which can occur on the first bars of a chart), the indicator falls back to local calculations using the chart timeframe with the same [1] indexing to maintain non-repainting behavior.

Settings Reference

Macro SAR Settings:
- Macro Timeframe: The timeframe for the trend-filter SAR. Should be significantly higher than your chart timeframe. Default: D (Daily).
- Macro Start AF: The initial acceleration factor value. Lower values produce a slower, more conservative SAR that changes direction less frequently. Default: 0.01.
- Macro Increment AF: How much the AF increases each time a new extreme point is reached. Smaller increments reduce whipsawing. Default: 0.01.
- Macro Max AF: The maximum cap on the acceleration factor. Prevents the SAR from accelerating too aggressively during extended trends. Default: 0.15.

Micro SAR Settings:
- Micro Timeframe: The timeframe for the momentum SAR. Should be lower than the Macro timeframe but typically equal to or higher than your chart timeframe. Default: 60 (1 hour).
- Micro Start AF: Default: 0.02. Higher than Macro Start to provide faster response.
- Micro Increment AF: Default: 0.02.
- Micro Max AF: Default: 0.20.

Macro EMA Filter:
- EMA Length: The period of the exponential moving average calculated on the Macro timeframe. This EMA is used internally as a confirmation filter and is not plotted. Default: 21.

Display Settings:
- Full Confluence Bull (+100): Color for the histogram when all three layers align bullish. Default: bright green.
- Partial Confluence Bull (+50): Color for partial bullish confluence. Default: semi-transparent green.
- Full Confluence Bear (-100): Color for full bearish alignment. Default: deep red.
- Partial Confluence Bear (-50): Color for partial bearish confluence. Default: semi-transparent red.
- Macro Ribbon Bull Color: Color of the ribbon columns when Macro SAR is bullish. Default: white.
- Macro Ribbon Bear Color: Color of the ribbon columns when Macro SAR is bearish. Default: black.
- Show Trade Style Table: Displays a reference table with suggested settings for different trading approaches.
- Show Background Tint: Enables the background color based on Macro SAR state.
- Background Tint Transparency: Controls how visible the background tint appears. Higher values are more transparent.

Trade Style Configuration Guide

The indicator includes a reference table (toggle in settings) that provides starting configurations for different trading styles:
istantanea
-Scalping: Micro AF 0.04/0.2, Macro AF 0.02/0.2, EMA Length 13, Suggested Timeframes 1m chart with 15m Micro and 1H+ Macro.

-Day Trading: Micro AF 0.02/0.2, Macro AF 0.01/0.1, EMA Length 21, Suggested Timeframes 15m chart with 1H Micro and 4H Macro.

-Swing Trading: Micro AF 0.01/0.1, Macro AF 0.005/0.1, EMA Length 50, Suggested Timeframes 1H chart with 4H Micro and Daily Macro.

-Long Term: Micro AF 0.005/0.1, Macro AF 0.002/0.05, EMA Length 100-200, Suggested Timeframes 4H chart with Daily Micro and Weekly Macro.

-These presets use progressively slower acceleration factors and longer EMA periods as the trading horizon extends. Scalping configurations prioritize faster response at the cost of more frequent direction changes. Long-term configurations minimize noise response and confirm only established multi-week trends.

How to Use It

-For trend-following entries: Look for the oscillator to reach +100 for long entries or -100 for short entries. Full confluence indicates that trend, momentum, and the EMA filter all agree on direction. These readings represent the highest-probability alignment.

-For confirmation of existing analysis: Use the oscillator to validate setups identified through other methods. If your chart analysis suggests a long entry, check whether the oscillator confirms with positive values. Avoid fighting full negative confluence.

-For position management: Monitor transitions from full to partial confluence. When the oscillator drops from +100 to +50, the EMA confirmation has failed even though the SAR layers still agree. This may indicate weakening momentum or the beginning of a correction. Consider tightening stops or taking partial profits.

-As a directional filter: The Macro Ribbon provides constant visual context for the dominant trend. Some traders only take long setups when the ribbon shows bullish (white) and only take shorts when bearish (black), using the oscillator value to time specific entries.

-For multi-timeframe awareness without chart switching: The oscillator synthesizes information from two different timeframes into a single panel, eliminating the need to constantly switch between charts to assess alignment.

What Makes This Indicator Original

-While the Parabolic SAR and EMA are well-known public domain indicators, this implementation combines them in a specific architecture that produces analytical output distinct from standard single-timeframe SAR usage:

-The dual-timeframe SAR comparison is the core mechanism. Standard SAR shows whether price is above or below the SAR on a single timeframe. This indicator compares SAR states across two timeframes simultaneously, creating a trend-momentum relationship that neither SAR in isolation provides.

-The EMA confirmation layer adds a third dimension that converts binary SAR agreement (both bullish or both bearish) into a graded confluence system with four non-neutral states rather than two. This additional filter distinguishes between strong agreement (price position confirms SAR direction) and weak agreement (SARs agree but price position contradicts).

-The quantized five-level output transforms a continuous indicator relationship into discrete categorical states. Each state has specific interpretive meaning and can trigger distinct trading responses. This is different from percentage-based or continuous oscillators where threshold selection is arbitrary.

-The non-repainting multi-timeframe implementation uses proper security call structure with closed-bar referencing to ensure historical accuracy. Many multi-timeframe indicators repaint because they use current-bar values from higher timeframes. This indicator explicitly avoids that behavior.

Markets and Trading Styles

This indicator applies to any liquid market with sufficient historical data: cryptocurrencies, forex pairs, equities, indices, commodities, and futures.

-For scalping (1-5 minute holds): Use faster AF settings and shorter timeframe combinations. Full confluence signals on the 1-minute chart with 15m/1H layers indicate alignment for quick momentum trades. Exit at the first sign of confluence weakening.

-For day trading (intraday holds): Standard settings work well. Monitor the 15m or 1H chart with 4H Macro. Hold positions through partial confluence as long as the Macro ribbon maintains direction. Close positions before the session end or when full negative confluence appears.

-For swing trading (multi-day holds): Extend to Daily Macro timeframe. Entries on full confluence can be held for several days. Partial confluence from +100 to +50 does not necessarily require exit but warrants increased attention to price action.

-For position trading (weeks to months): Weekly Macro timeframe with minimal AF values. The oscillator will change state infrequently. Full confluence signals represent major structural alignment suitable for longer-term position building.

Disclaimer

This indicator is a technical analysis tool that processes historical and current price data through mathematical formulas. It does not predict future price movements, guarantee trading profits, or constitute financial advice. All trading involves substantial risk including the potential loss of principal. Past indicator readings and confluence states do not ensure future accuracy or profitability. Users should combine this tool with proper risk management, appropriate position sizing, and their own independent analysis. The author assumes no responsibility for trading decisions or outcomes resulting from the use of this indicator.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.