Confluence Engine Strategy [JOAT] by officialjackofalltrades

By officialjackofalltrades

Performance Metrics

Description

Confluence Engine Strategy [JOAT]OverviewConfluence Engine Strategy is a fully automated Pine Script v6 strategy that combines four independent signal layers into a single numeric confluence score (0–100) before executing any trade. Entries require genuine agreement between linear regression momentum, dual EMA trend regime, ATR volatility state, and higher-timeframe bias. All exits are ATR-proportional with configurable take-profit and stop-loss multiples, plus a bar-based timeout and a trend-flip emergency exit. Commission (0.05% per side) and slippage (2 ticks) are configured for realistic backtesting.Why Require Confluence?Single-condition strategies (e.g., "go long when RSI crosses 50") produce entries in every conceivable market environment — ranging, trending, low-volatility, high-volatility — most of which are statistically unfavourable for that signal type. Requiring multiple independent conditions to agree simultaneously filters the entry universe down to the high-probability subset where each individual indicator is operating in its most favourable context. The Confluence Engine makes this filtering explicit and auditable through a numeric score.Signal Layer 1 — Linear Regression CrossoverThe primary entry trigger mirrors the Regression Flux Candles logic: a 21-bar linear regression of close (LR close) crossing above/below an 8-bar SMA of itself. The LR approach de-noises price before computing the crossover, significantly reducing the whipsaw rate compared to raw close-based SMA crossovers.Signal Layer 2 — Dual EMA Trend RegimeTwo exponential moving averages (fast: 21-period, slow: 55-period) define the trend regime. Long entries are only considered when the fast EMA is above the slow EMA; short entries only when fast is below slow. This prevents the LR crossover from triggering counter-trend entries in established trends — one of the most common sources of false signals in momentum strategies.Signal Layer 3 — ATR Volatility StateThe current 14-bar ATR is compared to a 50-bar ATR. Entries are only accepted when the current ATR is above a configurable fraction of the slow ATR (default 0.7). This volatility gate blocks trades during compression phases — low-volatility periods where breakouts frequently fail. The strategy only participates when directional energy is present.Signal Layer 4 — Higher-Timeframe BiasA higher-timeframe linear regression direction is fetched via request.security() with lookahead_off. The HTF LR close vs. HTF LR open comparison gives a single bullish/bearish vote from the higher timeframe. Long entries receive a confluence bonus when the HTF agrees; short entries receive a bonus when the HTF is bearish. This aligns trade direction with the prevailing macro bias.Confluence Score and ThresholdEach of the four layers contributes points to the confluence score:- LR crossover in direction: +30- Dual EMA alignment: +25- ATR volatility expansion: +20- HTF bias alignment: +25Maximum score: 100. The minimum required score to execute an entry (default 60) filters out entries where fewer than three layers agree. This threshold is adjustable — lower it for more signals, raise it for higher selectivity.Entry LogicLong: LR crossover up AND the accumulated confluence score >= minimum AND the signal is on a confirmed bar AND warmup has elapsed AND no position is currently open AND no cooldown bars remain.Short: LR crossover down AND confluence >= minimum AND same guards.A configurable cooldown period (default 5 bars) prevents re-entering the same direction immediately after an exit, avoiding overtrading in choppy conditions.Exit Logic — Four Exit Conditions1. ATR Take-Profit: Long exits when close >= entry + ATR × TP multiplier (default 2.0). Short exits below entry - ATR × TP.2. ATR Stop-Loss: Long exits when close 2:1)- Win rate in context of average win vs. average loss- Profit factor (total gross profit / total gross loss, seek > 1.3)- Number of trades (sufficient sample size for statistical inference)Adjust the confluence minimum score to trade off signal frequency against quality: 50 produces more trades, 75 produces fewer but higher-quality entries.Non-Repainting DesignAll entries fire on strategy.entry() within barstate.isconfirmed blocks. HTF bias uses lookahead_off. No future bar data is accessed. Historical signals do not shift position.Limitations- The strategy is designed as a general-purpose framework. It is not optimised for any specific instrument or session. Optimal parameters vary significantly across markets and timeframes.- ATR-based exits are approximate. In gap markets (equities overnight, weekend gaps on crypto), the stop-loss may be exceeded significantly before the exit executes.- Backtesting results are computed on historical data only and do not account for execution quality, broker-specific fees, or market impact. Past backtesting performance does not guarantee future live results.- The bar timeout exit may prematurely close positions that would have eventually reached TP. This is a deliberate conservative design choice to limit capital lock-up, not a flaw.DisclaimerThis strategy is provided for educational and informational purposes only. Backtesting results presented in the strategy tester represent historical simulation and do not guarantee any future trading outcome. Past performance is not indicative of future results. Never risk capital you cannot afford to lose. Always use proper risk management and conduct independent analysis before making any trading decisions.Made with passion by officialjackofalltrades

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView