Neural Confluence Engine [Quantum Algo]Neural Confluence Engine
Neural Confluence Engine is a Pine Script v6 indicator that fuses eight independent technical factors — momentum, trend, VWAP position, RSI regime, MACD acceleration, ADX trend power, volume confirmation, and squeeze state — into a single weighted directional strength score on a 0–100 scale. Signals are gated by a user-configurable score threshold and an optional higher-timeframe trend filter before firing. The script is open-source. All signals are confirmed on bar close and do not repaint.
═══════════════════════════════════════════════════════════════════════
HOW IT WORKS
═══════════════════════════════════════════════════════════════════════
1. The eight factor model. Each bar, the engine evaluates eight independent factors and assigns each a normalized score between 0 and 1 based on its current state and intensity. Factors are scored separately for bullish and bearish directions.
2. WaveTrend Momentum (weight 1.5). Computes a custom oscillator from HLC3 smoothed by EMA of channel length (default 9) and signal length (default 12). Oversold reversals below -40 score 1.0; readings above zero score 0.8; positive crossovers below zero score 0.5.
3. EMA Alignment (weight 1.3). Triple EMA stack: fast (default 9) > slow (default 21) > baseline (default 50) scores 1.0 for full alignment. Fast > slow alone scores 0.6. Otherwise 0.
4. VWAP Position (weight 1.0). Price above VWAP by more than 1 ATR scores 1.0. Price above VWAP within 1 ATR scores 0.7. Below VWAP scores 0.
5. RSI Regime (weight 0.8). RSI above 60 scores 1.0. RSI between 50 and 60 scores 0.6. Below 50 scores 0.
6. MACD Histogram (weight 0.8). Rising histogram above zero scores 1.0. Positive but flat histogram scores 0.6. Negative histogram scores 0.
7. ADX Trend Power (weight 0.7). ADX above 40 scores 1.0. ADX between 25 and 40 scores 0.7. ADX below 25 scores 0.3 (penalty for chop, not zero).
8. Volume Confirmation (weight 1.0). Volume above 20-bar SMA combined with a directional candle close scores 1.0. Volume between 80% and 100% of average scores 0.4. Below scores 0.
9. Squeeze State (weight 1.2). Detects Bollinger Band compression inside Keltner Channels using length-20 standard deviation and ATR-10 envelopes. A "firing" bar (compression releases) with positive momentum scores 1.0. Compression without release scores 0.3.
10. Weighted aggregation and smoothing. Each directional factor is multiplied by its weight, summed, divided by total weight, and scaled to 0–100. The raw score is then smoothed with a 3-bar EMA to reduce single-bar noise. Bull score and Bear score are tracked separately. The net Neural Confluence Engine score is the difference between them.
═══════════════════════════════════════════════════════════════════════
SIGNAL TIERS
═══════════════════════════════════════════════════════════════════════
The script produces two signal tiers from the same scoring engine, allowing traders to choose between sensitivity and selectivity.
Standard signals (BUY / SELL). Fire on EMA ribbon color change — when the fast EMA crosses the slow EMA. These follow every directional shift regardless of score. Useful for systematic trend-following.
High-confluence signals (BUY+ / SELL+). Fire only when three conditions align simultaneously: an EMA cross occurs, the directional score exceeds the user-configurable threshold (default 60), and the higher-timeframe trend agrees with the signal direction. Used to filter for the most aligned setups.
Both signal tiers open trade management — entry, stop loss, three take-profit targets, and optional trailing stop after TP1.
═══════════════════════════════════════════════════════════════════════
TRADE MANAGEMENT
═══════════════════════════════════════════════════════════════════════
When a signal fires, the engine computes ATR-scaled risk levels relative to entry:
Stop loss: entry minus 1.5 × ATR (configurable multiplier 0.5–10).
TP1: 1R target (configurable risk-reward ratio).
TP2: 2R target.
TP3: 3R target.
When TP1 is reached, the stop converts to a trailing structure: SL moves to breakeven, then advances to TP1 level when TP2 is hit, then to TP2 level when TP3 is hit. The trailing stop also follows price at 0.5 × ATR distance after TP1. This can be disabled via the "Activate Trailing SL after TP1" toggle.
═══════════════════════════════════════════════════════════════════════
WHAT'S ACTUALLY DIFFERENT
═══════════════════════════════════════════════════════════════════════
◆ Eight-factor weighted composite, not a single trigger. Standard indicators fire on one condition — an EMA cross, an RSI level, a volume spike. The Neural Confluence Engine requires multiple independent factors to agree, weights them by historical reliability, and gates signals through a configurable score threshold. The trader can dial sensitivity from 20 (sensitive) to 95 (selective) without re-tuning eight separate sub-indicators.
◆ Two-tier signal architecture. Most indicators produce one stream of signals. This produces two from the same engine: standard ribbon flips for sensitive trend-following, and high-confluence variants gated by score + HTF agreement. Traders can use either tier independently or both in confluence.
◆ HTF agreement is built into the signal gate, not a separate filter. The higher-timeframe trend check is computed natively via request.security, auto-detected based on the chart timeframe (15m → 1H, 1H → 4H, 4H → D, D → W) or set manually. BUY+/SELL+ signals are blocked if HTF disagrees.
◆ Per-factor visibility in the dashboard. Each of the eight factors is individually viewable in real time — traders can see exactly which factors are contributing to the current score, rather than receiving a black-box signal. This is rare in confluence-style indicators which typically hide the sub-components.
◆ Trailing-stop ratcheting tied to TP hits. The trailing stop doesn't just follow ATR — it advances in tiers tied to take-profit milestones. After TP1, stop moves to breakeven. After TP2, to TP1. After TP3, to TP2. This protects profits at structurally meaningful levels rather than purely volatility-derived ones.
═══════════════════════════════════════════════════════════════════════
RECOMMENDED SETTINGS
═══════════════════════════════════════════════════════════════════════
Forex majors (EUR/USD, GBP/USD, USD/JPY) — 1H to 4H: Min Confluence Score 65, HTF Trend Filter on, SL Multiplier 1.5, TP R:R 1/2/3, HTF auto. Optimized for session-driven moves where structural levels respect institutional flow.
Crypto perpetuals (BTC, ETH, SOL) — 15M to 1H: Min Confluence Score 60, HTF Trend Filter on, SL Multiplier 2.0, TP R:R 1/2/3, HTF auto. Tuned for 24/7 markets with higher noise floors; the slightly wider stop accommodates increased wick volatility.
Gold (XAUUSD) — 1H to 4H: Min Confluence Score 70, HTF Trend Filter on, SL Multiplier 1.8, TP R:R 1/2/3.5, HTF set to Daily. Designed for the elevated wick activity around US session open and the tendency for sharp moves to develop after squeeze release.
Indices (SPX, NDX, DAX) — 5M to 1H: Min Confluence Score 55, HTF Trend Filter on, SL Multiplier 1.2, TP R:R 1/2/3, HTF auto. Tuned for cash-session structure and typical post-open momentum continuation.
Swing trading (any market) — 4H to Daily: Min Confluence Score 75, HTF Trend Filter on, SL Multiplier 2.5, TP R:R 1.5/3/5, HTF set to Weekly. Reduces noise to the highest-conviction setups only; wider targets to match the higher timeframe.
═══════════════════════════════════════════════════════════════════════
ALERTS & OUTPUTS
═══════════════════════════════════════════════════════════════════════
Alerts available:
BUY signal — ribbon flipped bullish (standard sensitivity)
SELL signal — ribbon flipped bearish (standard sensitivity)
BUY+ signal — high-confluence bullish setup
SELL+ signal — high-confluence bearish setup
Squeeze breakout — volatility compression released
TP1 reached — trailing stop activated
TP2 reached
TP3 reached
On-chart visuals:
EMA ribbon (5, 9, 13, 21, 34, 50) with fill bands colored by trend direction
VWAP plot with color reflecting price position
BUY / SELL / BUY+ / SELL+ signal labels at signal bars
Confluence score percentage label on BUY+ / SELL+ bars
Optional Entry / SL / TP1 / TP2 / TP3 horizontal lines for the most recent trade
TP-hit confirmation labels with checkmarks
Squeeze background highlight when compression is active
Diamond markers (⚡) on squeeze breakout bars
Optional momentum wave background colored by net score intensity
Optional candle coloring on signal bars
Multi-row dashboard with bull/bear scores, bias classification, HTF direction, factor states, trade status, and threshold setting
═══════════════════════════════════════════════════════════════════════
NOTES
═══════════════════════════════════════════════════════════════════════
Pine Script version: v6.
Repainting: All signals (BUY, SELL, BUY+, SELL+, squeeze breakouts, TP/SL hits) are evaluated on confirmed bar close and do not repaint. Higher-timeframe values use lookahead=barmerge.lookahead_off so HTF readings reflect only confirmed information available at signal time.
Compatibility: Works on all symbols and timeframes available in TradingView. Tested on forex majors, crypto perpetuals, gold, and major indices. Functions on stocks but the volume confirmation factor may require threshold adjustment for low-volume tickers. Functions on continuous contracts and CFDs.
Open-source: This script is open-source. Clone, study, and modify it freely under the terms of TradingView's House Rules. Republishing the source under a different name is not permitted.
Credits: This indicator's logic is independently developed. The component oscillators (WaveTrend, RSI, MACD, ADX, Bollinger Bands, Keltner Channels, VWAP) are standard public-domain technical analysis tools. The weighted-score aggregation methodology, two-tier signal architecture, ATR-tiered trailing stop progression, and per-factor dashboard are original implementations.
Disclaimer: This indicator is provided for educational and analytical purposes. Trading involves substantial risk of loss. Past performance does not guarantee future results. Position sizing and risk management are the trader's sole responsibility. Nothing in this script or description constitutes financial advice.
مؤشر Pine Script®






















