Kinetic Barycenter MT5
- Indicators
-
Alex David Hernandez Maturrano
Most retail trading algorithms fail not because of a bad strategy, but due to poor memory management, execution lag, and sloppy matrix calculations. - Version: 1.0
- Activations: 5
KINETIC BARYCENTER MT5
First-Principles quantitative mechanics: Center of mass, Multi-Horizon price gravity and Elastic exhaustion bands
By ONDEB Labs
THE PARADIGM SHIFT: MEASURING MARKET MASS INSTEAD OF CHRONOLOGICAL TIME
Major technical indicators were conceived decades ago under the assumption that chronological time is uniform. Simple and Exponential Moving Averages (SMA, EMA) treat quiet, low-volume consolidation bars with the exact same mathematical weight as massive institutional liquidity events. The consequence is well-known to experienced traders: structural lag, false breakout whipsaws, and trend indicatoTecrs that systematically blow past statistical bounds.
Kinetic Barycenter MT5 approaches price discovery through first-principles classical physics and continuous elasticity:
- Volume as physical mass: Every transaction injects inertia. Price bars with dense liquidity exert gravitational attraction proportional to their volume.
- Continuous newtonian relaxation (Half-Life T1/2): Past volume influence decays continuously through an exponential half-life function, eliminating the abrupt, artificial step jumps common to standard rolling windows.
- Hooke's elasticity (Z-Score): When market price deviates from the institutional center of mass, spatial dispersion creates a quantifiable restorative tension. At statistical boundaries (absolute Z-Score >= 2.0 Sigma), liquidity thins out and volume-weighted mean reversion becomes an asymmetric risk/reward opportunity.
Operates flawlessly on any broker using standard OHLCV tick data for XAUUSD (Gold), Indices (US30, NAS100, GER40, SPX500), Forex Majors, and Cryptocurrencies. Requires zero external DLLs, no order-book subscriptions, and uses strict causal non-repainting integrity.
Core engineering and quantitative architecture
1. Multi-Horizon gravitational anchors (H1, D1, W1, MN1)
The indicator concurrently computes and projects the volume-weighted centers of mass across four operational horizons:
- MN1 (Crimson): Macro structural bedrock (monthly equilibrium anchor).
- W1 (Royal Blue): Swing trading benchmark and weekly balance point.
- D1 (Amber / Gold): Daily session fair-value center of mass.
- H1 (Spring Green): Tactical intraday microstructure line for precision entries.
2. Elastic Exhaustion Channels (+/- 1.5 Sigma to +/- 2.0 Sigma)
Dynamic standard deviation envelopes computed from volume-weighted spatial dispersion:
- Calibrated Defaults (Gold and Major Forex): The factory default setting (2.0 Sigma) is precision-calibrated for deep-liquidity institutional assets like Gold (XAUUSD), EURUSD, and GBPUSD. It pinpoints high-probability mean-reversion turning points without lag or premature entry.
- Fully Customizable for High-Volatility and Crypto: For hyper-volatile instruments with heavy-tailed distributions, such as Cryptocurrencies (BTCUSD, ETHUSD,SOLUSD) or NAS100, the sigma envelope is fully customizable via InpExhaustionSigma (e.g., expanded to 2.5 Sigma – 3.0 Sigma) to account for extreme volatility bursts and prevent premature counter-trend exposure.
3. High-Performance dark glassmorphism HUD (DearMQL5 Canvas)
A GPU-accelerated interactive dashboard rendered via native memory-buffered canvas (O(1) zero allocation on tick path):
- Real-time Z-Score: Continuous numerical readout of elastic tension.
- Proportional strain gauge: Visual progress meter mapping deformation against institutional climax thresholds.
- Multi-Timeframe confluence matrix: Instant readout of price distance (in points and sigmas) across all four horizons.
- Natural Take Profit Target: Real-time projection of the primary gravitational return target (D1 Barycenter).
- One-click toggles: Instantly show/hide exhaustion bands or mute/enable alerts directly from the chart window.
- Collapsible mini-widget: Minimize the panel into an unobtrusive title badge for multi-chart layouts.
4. Bilingual localization and dedicated File Diagnostics
- Native Bilingual Engine (InpLanguage): Instant zero-overhead switching between English (LANG_EN) and Portuguese (LANG_PT).
- Dedicated File Telemetry (InpDebugMode): Debug parameter that, when enabled, generates high-fidelity silent diagnostics logged to MQL5\Files\KineticDebug_<Symbol>_<TF>.log with rate-limited tick profiling and NDEBUG compilation support. These logs are intended to be sent to support with Alex Hernández.
Institutional Operational Playbooks
Playbook 1: Value retest and Polarity reversal (Day Trading M5/M15)
- Context: A high-volume expansion bar decisively breaks the Daily (D1) or Hourly (H1) Barycenter, absorbing resting liquidity. On the initial pullback, early positioning rebalances at fair-value breakeven. Directional participants step in to defend the newly established volume-weighted benchmark.
- Execution Context: Look for an M5 rejection candle (pin bar or engulfing) confirming that previous resistance has transitioned into dynamic support.
- Risk/Reward Structure: In this setup, the invalidation level (Stop Loss) is typically mapped behind the rejection wick, with the outer +/- 2.0 Sigma band acting as the primary target zone (offering a structural 1:3.0 to 1:4.0 R:R profile).
Playbook 2: Elastic boundary mean reversion (Absolute Z-Score >= 2.0 Sigma)
- Context: Price expands into the outer exhaustion envelope during active liquidity sessions. Spatial displacement enters statistical tail territory (> 95.4% probability boundary). Directional momentum decelerates as liquidity thins out.
- Execution Context: Look for the first M5/../M30/H1 candle closing back within the exhaustion band, confirmed by tick volume divergence.
- Risk/Reward Structure: Mean reversion toward the Daily Barycenter, mapping an asymmetric 1:3.5 to 1:5.0 structural R:R profile.
Playbook 3: Triple barycenter Super-Cycle Cross (Swing Trading H1/H4)
- Context: D1, W1, and MN1 barycenters tightly compress into a narrow price corridor (Absolute Z-Score < 0.5 Sigma).
- Mechanism: Multi-horizon consensus reaches a potential energy singularity, a structural compression that historically precedes sustained, multi-hundred-point directional expansions.
- Trend Management Reference: The moving D1 Barycenter serves as a dynamic trailing reference as long as the hierarchical cascade ( Price > D1 > W1 > MN1 ) remains unbroken.
Complete Input parameters specification
Group 0: Language & Localization
- InpLanguage (Default: LANG_EN): Native Bilingual Engine switching between English (LANG_EN) and Português (LANG_PT).
Group 1: Core Calibration & Newtonian Decay
- InpD1Bars (Default: 30): Number of daily bars evaluated for D1 Center of Mass.
- InpD1HalfLife (Default: 7.0): Exponential relaxation half-life in days for D1 memory decay.
- InpW1Bars (Default: 26): Number of weekly bars evaluated for W1 Center of Mass.
- InpW1HalfLife (Default: 14.0): Exponential relaxation half-life in days for W1 swing equilibrium.
- InpMN1Bars (Default: 12): Number of monthly bars evaluated for MN1 Macro Bedrock.
- InpMN1HalfLife (Default: 60.0): Exponential relaxation half-life in days for MN1 macro anchor (~2 months).
- InpH1Bars (Default: 48): Number of hourly bars evaluated for H1 intraday microstructure.
- InpH1HalfLife (Default: 1.0): Exponential relaxation half-life in hours for intraday continuous decay.
Group 2: Elastic Exhaustion Thresholds
- InpExhaustionSigma (Default: 2.0): Outer exhaustion band multiplier (1.5σ–2.0σ for Gold/Forex; customizable to 2.5σ–3.5σ for Crypto).
- InpClimaxSigma (Default: 3.0): Critical elastic climax threshold signaling extreme statistical depletion.
Group 3: Chart Visual Styling
- InpShowD1 / InpColorD1 (Default: true / Gold): Visibility and color for Daily Barycenter line.
- InpShowBandsD1 / InpColorBandsD1 (Default: true / Khaki): Visibility and color for Daily Exhaustion Bands.
- InpShowW1 / InpColorW1 (Default: true / DodgerBlue): Visibility and color for Weekly Barycenter line.
- InpShowBandsW1 / InpColorBandsW1 (Default: true / DeepSkyBlue): Visibility and color for Weekly Exhaustion Bands.
- InpShowMN1 / InpColorMN1 (Default: true / Crimson): Visibility and color for Monthly Macro Bedrock line.
- InpShowBandsMN1 / InpColorBandsMN1 (Default: true / Tomato): Visibility and color for Monthly Exhaustion Bands.
- InpShowH1 / InpColorH1 (Default: true / MediumSpringGreen): Visibility and color for Hourly Intraday Barycenter line.
- InpShowBandsH1 / InpColorBandsH1 (Default: true / PaleGreen): Visibility and color for Hourly Exhaustion Bands.
- InpStyleBands / InpWidthBands (Default: STYLE_DASH / 1): Line style and thickness for exhaustion envelopes.
Group 4: Floating HUD Canvas (DearMQL5)
- InpShowHud (Default: true): Master toggle for the GPU-accelerated DearMQL5 Canvas Dashboard.
- InpHudMarginX / InpHudMarginY (Default: 30 / 35): Horizontal and vertical screen margin offset in pixels.
Group 5: Multi-Alert & Anti-Spam System
- InpEnableAlerts (Default: true): Master switch for Pop-up, Sound, and Push Notification alerts.
- InpAlertPopup (Default: true): Terminal modal popup dialog on signal triggers.
- InpAlertPush (Default: false): Instant mobile Push notification to MT5 smartphone app (MetaQuotes ID).
- InpAlertSound / InpSoundFile (Default: true / "alert.wav"): Acoustic terminal notification toggle and audio filename.
- InpCooldownSec (Default: 60): Anti-spam interval (in seconds) between repeated alerts.
- InpAlertOnceBar (Default: true): Restricts signal notification to a maximum of once per bar.
Group 6: Optimization & Performance
- InpMaxHistoryBars (Default: 1000): Historical bar evaluation depth limit (0 = evaluate entire available history).
- InpThrottleSec (Default: 5): CPU throttling constant for heavy asynchronous calculations.
Group 7: Diagnostics & Debug Mode
- InpDebugMode (Default: false): Silent high-fidelity telemetry logged to MQL5\Files\KineticDebug_<Symbol>.log.
Algorithmic Automation: 15 Formal Buffers (iCustom Ready)
Engineered with a Clean Architecture paradigm, the indicator provides 15 standardized non-repainting data buffers accessible by any Expert Advisor or Script:
- Buffer 0 | BUFFER_BARYCENTER_D1 (Price): Daily Barycenter (Session Fair Value Anchor)
- Buffer 1 | BUFFER_BARYCENTER_W1 (Price): Weekly Barycenter (Swing Trading Equilibrium)
- Buffer 2 | BUFFER_BARYCENTER_MN1 (Price): Monthly Macro Bedrock Price
- Buffer 3 | BUFFER_UPPER_2SIGMA (Price): Upper Daily Exhaustion Band (+InpExhaustionSigma)
- Buffer 4 | BUFFER_LOWER_2SIGMA (Price): Lower Daily Exhaustion Band (-InpExhaustionSigma)
- Buffer 5 | BUFFER_ELASTIC_ZSCORE (Float): Continuous Hooke Elastic Z-Score Readout
- Buffer 6 | BUFFER_REGIME_SIGNAL (Int): Signal Code: +1 (Buy Reversal), -1 (Sell Reversal), 0 (Neutral)
- Buffer 7 | BUFFER_TARGET_TP (Price): Suggested Take Profit Gravitational Target Price
- Buffer 8 | BUFFER_UPPER_W1 (Price): Upper Weekly Exhaustion Band (+InpExhaustionSigma)
- Buffer 9 | BUFFER_LOWER_W1 (Price): Lower Weekly Exhaustion Band (-InpExhaustionSigma)
- Buffer 10 | BUFFER_UPPER_MN1 (Price): Upper Monthly Exhaustion Band (+InpExhaustionSigma)
- Buffer 11 | BUFFER_LOWER_MN1 (Price): Lower Monthly Exhaustion Band (-InpExhaustionSigma)
- Buffer 12 | BUFFER_BARYCENTER_H1 (Price): Hourly Tactical Intraday Barycenter
- Buffer 13 | BUFFER_UPPER_H1 (Price): Upper Hourly Exhaustion Band (+InpExhaustionSigma)
- Buffer 14 | BUFFER_LOWER_H1 (Price): Lower Hourly Exhaustion Band (-InpExhaustionSigma)
Dynamic Sigma Evaluation in Code:
Because the Center of Mass (c) and Dispersion (Sigma) are physical invariants of the volume ledger, an Expert Advisor can compute custom dynamic thresholds (1.6 Sigma for intraday scalps, 2.8 Sigma for swing trades) on the fly without modifying indicator inputs:
Sigma_Unit = (BufferUpper - BufferBarycenter) / InpExhaustionSigma CustomBand = BufferBarycenter +/- (k * Sigma_Unit)
Production-grade EA Integration Sample
//+------------------------------------------------------------------+ //| Integration Sample for Expert Advisors | //| Copyright 2026, ONDEB Quantitative Labs | //+------------------------------------------------------------------+ #define BUFFER_BARYCENTER_D1 0 #define BUFFER_UPPER_2SIGMA 3 #define BUFFER_LOWER_2SIGMA 4 #define BUFFER_ELASTIC_ZSCORE 5 #define BUFFER_REGIME_SIGNAL 6 #define BUFFER_TARGET_TP 7 int g_kinetic_handle = INVALID_HANDLE; int OnInit() { // ------------------------------------------------------------------ // AUTOMATIC HEADLESS ARCHITECTURE NOTE: // The indicator internally monitors MQLInfoInteger(MQL_TESTER). // When invoked by an EA during Strategy Tester backtests or genetic // optimizations, it automatically bypasses all DearMQL5 Canvas HUD // rendering, font memory allocations, and mouse events. // It operates in pure headless mode (O(1) vector math) to deliver // maximum multi-core CPU throughput across millions of ticks. // ------------------------------------------------------------------ g_kinetic_handle = iCustom(_Symbol, _Period, "KineticBarycenter"); if(g_kinetic_handle == INVALID_HANDLE) { PrintFormat("Kinetic Barycenter initialization failed. Error: %d", GetLastError()); return INIT_FAILED; } return INIT_SUCCEEDED; } void OnTick() { if(g_kinetic_handle == INVALID_HANDLE) return; // Fast 1-bar copy of essential mathematical buffers double signal[1], target_tp[1], z_score[1], bary_d1[1], upper_d1[1]; if(CopyBuffer(g_kinetic_handle, BUFFER_REGIME_SIGNAL, 0, 1, signal) <= 0) return; if(CopyBuffer(g_kinetic_handle, BUFFER_TARGET_TP, 0, 1, target_tp) <= 0) return; if(CopyBuffer(g_kinetic_handle, BUFFER_ELASTIC_ZSCORE, 0, 1, z_score) <= 0) return; if(CopyBuffer(g_kinetic_handle, BUFFER_BARYCENTER_D1, 0, 1, bary_d1) <= 0) return; if(CopyBuffer(g_kinetic_handle, BUFFER_UPPER_2SIGMA, 0, 1, upper_d1) <= 0) return; // Dynamic 1.6-sigma calculation for custom Intraday Scalping thresholds double InpExhaustionSigma = 2.0; double sigma_unit = (upper_d1[0] - bary_d1[0]) / InpExhaustionSigma; double custom_upper = bary_d1[0] + (1.6 * sigma_unit); double custom_lower = bary_d1[0] - (1.6 * sigma_unit); // ------------------------------------------------------------------ // NAIVE / BASELINE MEAN-REVERSION EXECUTION: // (Educational template. In live institutional production, pair this // baseline trigger with session time filters, spread guards, and // strict prop-firm risk management rules) // ------------------------------------------------------------------ if(signal[0] > 0.5) // Climax Oversold: Price pierced lower band and closed back inside { PrintFormat("BUY REVERSAL: z = %.2f sigma | Natural TP = %.2f", z_score[0], target_tp[0]); // Open Buy position: SL below the exhaustion candle wick, TP anchored at target_tp[0] } else if(signal[0] < -0.5) // Climax Overbought: Price pierced upper band and closed back inside { PrintFormat("SELL REVERSAL: z = %.2f sigma | Natural TP = %.2f", z_score[0], target_tp[0]); // Open Sell position: SL above the exhaustion candle wick, TP anchored at target_tp[0] } } void OnDeinit(const int reason) { // Clean up indicator handle to release terminal memory if(g_kinetic_handle != INVALID_HANDLE) { IndicatorRelease(g_kinetic_handle); } }
Technical Support and Diagnostic protocol (InpDebugMode)
To guarantee prompt assistance in the event of unexpected behavior (such as broker history desynchronization, exotic assets with non-standard tick dimensions, or weekend network latency), Kinetic Barycenter MT5 includes a dedicated file-based structured telemetry engine via InpDebugMode = true.
Official 3-Step Support Request Procedure:
- Activation: Open indicator properties (F7 in MetaTrader 5), navigate to the DIAGNOSTICS & DEBUG MODE parameter group, and set InpDebugMode to true.
- Telemetry Capture: Allow the indicator to run on your chart forthe necessary time to capture complete initialization, multi-timeframe synchronization, live broker data feeds and reproduce your current problem.
- Log Retrieval: In the top menu of MetaTrader 5, click: File -> Open Data Folder -> MQL5 -> Files. Locate the diagnostic log file formatted as MQL5\Files\KineticDebug_<Symbol>_<TF>.log . Send this log file directly to Alex Hernández via private message on our official MQL5 Community profile.
What Does Debug Mode Audit?
- Symbol Metadata: Fractional precision (Digits), minimum tick size (TickSize), and point value (Point) provided by your broker feed.
- Multi-Timeframe Synchronization: Requested vs. delivered bar counts for H1, D1, W1, and MN1, including low-level network return codes (GetLastError()).
- Mathematical Stability: Verification of variance floors preventing division-by-zero exceptions on abnormal tick spreads.
- Lifecycle Telemetry: Exact deinitialization reasons (UninitializeReasonGet()) and memory stability metrics.
Strict Privacy Policy:
The diagnostic log never accesses, stores, or transmits trading account passwords, balances, equity, or personal user data. It monitors strictly mathematical telemetry between MetaTrader 5 and the calculation engine.

