Kinetic Barycenter MT5
- Indicateurs
-
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
- 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.
Core engineering and quantitative architecture
Institutional Operational Playbooks
- 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).
- 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.
- 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
- 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.
- 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.
- 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.
- InpMaxHistoryBars (Default: 1000): Historical bar evaluation depth limit (0 = evaluate entire available history).
- InpThrottleSec (Default: 5): CPU throttling constant for heavy asynchronous calculations.
- InpDebugMode (Default: false): Silent high-fidelity telemetry logged to MQL5\Files\KineticDebug_<Symbol>.log.
Algorithmic Automation: 15 Formal Buffers (iCustom Ready)
Dynamic Sigma Evaluation in Code:
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.
- 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.

