Macd Pro Arbrain Ve
- Indicatori
-
Bahtiyar Arniyazov
Over 33 years of engineering, economic, and executive management experience in civil and industrial construction — progressing from field engineer and site supervisor to Head of Production & Technical Department (PTO), Head of Planning & Economic Department in a state construction enterprise, Chief - Versione: 1.0
SHORT DESCRIPTION (tagline)
Next-generation MACD indicator: pixel-exact crossing arrows, strict non-repainting, zero chart clutter. MTF filter, adaptive thresholds, 5-factor Decision Engine, iCustom-ready buffers.
FULL DESCRIPTION
MACD_PRO_Ar_Brain_VE v5.30 is a professional Technical Decision Support indicator for MetaTrader 5, built on top of MACD with an extended Decision Engine, Multi-Timeframe (MTF) filter, adaptive thresholds, and a pixel-precise crossing visualization system.
Unlike the classic MACD indicator, it does not just draw a histogram — it evaluates the market using 5 independent weighted factors, adapts to the volatility of the instrument, and produces a confirmed signal ONLY on a closed bar. The single visual element on the chart is an arrow placed EXACTLY at the point where MACD and Signal lines cross (bilinear time/value interpolation).
1. KEY FEATURES
PIXEL-EXACT CROSSING ARROWS
Linear time/value interpolation: vCross = m0 + (m1−m0)·frac, tCross = t[i−1] + frac·dt.
Arrow tip (233 / 234) coincides with the crossing point thanks to ANCHOR_UPPER / ANCHOR_LOWER (no pixel offset).
Duplicate arrow on the main chart (below/above the bar with ATR margin) for instant visual confirmation.
Old arrow is automatically replaced when a new crossing occurs — the chart never accumulates historical clutter.
STRICT NON-REPAINTING
All signal buffers (22..27) are written on closed bars only (index ≤ rates_total − 2). No arrow or signal ever moves after publication.
Causality: value for bar i uses only data from bars ≤ i.
MTF projection strictly by the higher timeframe's real close time (closed-bar projection), no "staircase" effect.
DECISION ENGINE (5 WEIGHTED FACTORS)
Every signal passes through a weighted voting system:
1. MACD histogram vote (weight InpWeightM)
2. Trend vote (EMA slope + price position, InpWeightT)
3. RSI pressure vote (momentum distance / acceleration, InpWeightR)
4. ADX / DI vote (trend strength and direction, InpWeightA)
5. TSI vote (true strength index, InpWeightTs)
Final score ∈ [−1; +1]. A signal is published only if:
Direction matches the vote (dec.dir == crossDir)
Passes InpMinConfluence (minimum agreeing factors)
Passes InpMinDecisionScore (minimum |score|)
Satisfies session, volume, flat, ADX, TSI, impulse, MTF and cooldown filters.
TRUE MTF FILTER
Up to 2 higher timeframes (auto-detected via InpMTFMinRatio).
Asynchronous readiness checks: SeriesInfoInteger, BarsCalculated, CopyBuffer < need → graceful skip without terminal freeze.
Signal is blocked if any higher TF contradicts its direction.
ADAPTIVE THRESHOLDS (PERCENTILE + ATR/ER AUTOTUNE)
ADX, TSI, RSI-distance thresholds are computed as percentiles (default P50) from the symbol's own history — no fixed numbers.
ATR/ER autotune re-adjusts sensitivity to current volatility every N closed bars (Efficiency Ratio + noise Z).
All coefficients are dimensionless — works equally well on Forex, metals, indices, crypto and futures.
AUTOMATIC INSTRUMENT ADAPTATION
DetectAsset(): auto-recognizes Forex / Metals / Indices / Crypto.
DetectStyle(): by timeframe (M1–M5 → scalping, M15–H1 → intraday, H4–D1 → swing, D1+ → position).
Style preset selects base MACD periods (e.g. 8/21/5 for scalping, 16/34/9 for position).
Manual mode (CORE_MANUAL) — any custom periods without override.
SMART ALERTS
Alert (popup), PlaySound, SendNotification, SendMail.
One alert per bar per direction (gAlertBuyBar / gAlertSellBar) — zero spam.
Alerts do NOT fire during historical backfill — only on live bars.
Last-alert state is persisted in MQL5\Files and restored after terminal restart.
ICUSTOM READY
28 documented buffers available via CopyBuffer:
0..5 MACD (histogram × 4 + MACD + Signal)
6..7 Fill upper / lower
8 ATR
9 Strength |hist| / TypicalAmp
10 Trend EMA
11..12 RSI + RSI signal
13..15 ADX + +DI + −DI
16..17 TSI + TSI signal
18..21 TSI EMA state (internal)
22 Decision score (−1 .. +1)
23 BUY = +1 on confirmed bar (EMPTY_VALUE otherwise)
24 SELL = −1 on confirmed bar (EMPTY_VALUE otherwise)
25 Trend state (−1 / 0 / +1)
26 Stop-Loss price of the signal
27 Take-Profit price of the signal
Example from an EA:
int h = iCustom(_Symbol, _Period, "MACD_PRO_Ar_Brain_VE", ...);
double buyBuf[];
if(CopyBuffer(h, 23, 1, 1, buyBuf) == 1 && buyBuf[0] == 1.0) { /* BUY */ }
CLEAN CHART
All objects use a unique prefix ABPR_<Symbol>_<TF>_<ChartID>_ and are removed via ObjectsDeleteAll() in OnDeinit.
OBJPROP_SELECTABLE = false, OBJPROP_HIDDEN = true — do not interfere with clicks and do not clutter Ctrl+B.
Zero "undeleted objects" warnings in the journal on removal.
PERFORMANCE
Incremental calculation driven by prev_calculated — only new bars are recomputed.
Arrow redraw executes once per closed bar, not on every tick (guard gLastCrossScanBar).
Works in Strategy Tester in optimization mode (MQL_OPTIMIZATION) without heavy graphics.
No DLL, no external dependencies — a single .ex5 file.
2. INPUT PARAMETERS (16 GROUPS)
1. AUTO TUNING
InpAutoTune — enable ATR/ER autotune
InpStyle — style (Auto / Scalping / Intraday / Swing / Position)
InpAssetType — asset type (Auto / Forex / Metals / Indices / Crypto)
InpCoreMode — MACD core mode (Auto / Classic / Manual)
InpAutoWindow — autotune window (60..5000)
InpAutoRefresh — refresh period in bars
InpAutoERLag — Efficiency Ratio lag
InpAutoSens — autotune strength (0..3)
2. CORE (MACD)
InpFast, InpSlow, InpSig — MACD periods (default 12/26/9)
InpPrice — applied price (PRICE_CLOSE, etc.)
3. FILTERS
InpVolFil, InpMinVol, InpVolWindow — volume filter
InpTrendFil — EMA trend filter
InpFlatFil, InpFlatMult, InpFlatWindow — flat-market filter
InpADXFil, InpADXMin — ADX filter
InpTSIFil, InpTSIMin — TSI filter
InpImpulseFil, InpImpulseMin, InpImpulseBars — impulse filter
4. RSI ENGINE
InpRSIPeriod, InpRSISignalPeriod — RSI periods
InpRSISignalMethod — smoothing method
InpRSIVelocityBars — velocity window
InpRSIMinDistance — minimum |RSI − Signal|
InpRSIOverbought, InpRSIOversold — zones
InpRSIPreset — preset (Auto / Scalp / Intra / Swing / Position)
5. ENGINE PERIODS
InpATRPeriod, InpTrendEMAPeriod, InpTrendSlopeBars, InpADXPeriod
6. TSI
InpTSI_R, InpTSI_S, InpTSI_Signal
7. DECISION ENGINE
InpWeightM, InpWeightT, InpWeightR, InpWeightA, InpWeightTs — weights
InpMinConfluence — minimum agreeing factors (0..5)
InpMinDecisionScore — minimum |score| (0..1)
InpSignalCooldown — minimum bars between same-direction signals
8. ADAPTIVE THRESHOLDS
InpThrMode — Adaptive / Fixed
InpAdaptWindow — percentile window
InpPctADX, InpPctTSI, InpPctRSIDist, InpPctRSIZone — percentiles
InpAdaptADXCap — cap the adaptive ADX level
9. MTF
InpMTF, InpMTFFilter — enable MTF and blocking against higher TFs
InpMTFLevels — 0..2 higher timeframes
InpMTF1, InpMTF2 — concrete TFs (PERIOD_CURRENT = auto)
InpMTFMinRatio — minimum ratio of higher TF to current
10. SESSION
InpUseSession, InpSessionStart, InpSessionEnd — server trading hours
11. SIGNAL GRAPHICS (crossing arrows only)
InpArrows — master switch
InpBuyCol, InpSellCol — arrow colors
InpArrSize — size (1..2)
InpArrowUp, InpArrowDown — glyph codes (233/234)
InpShowCrossSub — draw in subwindow
InpShowCrossMain — duplicate on main chart
InpTheme — Auto / Dark / Light
12. STOP / TARGET (buffers only, no lines)
InpShowSLTP — LOCKED to false (buffers only)
InpATRMult — SL distance in ATR
InpRRRatio — Risk/Reward ratio for TP
13. DIVERGENCE (buffers only)
InpDiv, InpDivLB, InpDivPiv, InpDivFil, InpDivBlockBars
14. ALERTS
InpAlertPopup, InpAlertSound, InpSoundFile, InpAlertPush, InpAlertMail
15. VISUALS
Histogram / MACD / Signal / Fill colors, widths, band levels
16. ADVANCED
InpAmpWindow, InpDrawLastBars, InpBackfillHistory, InpBackfillMaxBars
InpSaveState, InpStateKey, InpStateSlots, InpSelfCheck, InpVerbose
3. RECOMMENDED SETTINGS
Scalping (M1–M15):
InpStyle = STYLE_SCALPING
InpSignalCooldown = 3..5
InpMinConfluence = 2
InpMTFLevels = 1 (only M15/H1)
Intraday (M15–H1):
InpStyle = STYLE_INTRADAY
InpSignalCooldown = 5..10
InpMinConfluence = 3
InpMTFLevels = 2
Swing (H4–D1):
InpStyle = STYLE_SWING
InpSignalCooldown = 10..20
InpMinConfluence = 3..4
InpMTFLevels = 2
Position (D1+):
InpStyle = STYLE_POSITION
InpSignalCooldown = 20..30
InpMinConfluence = 4..5
Conservative trading:
InpThrMode = THR_ADAPTIVE
InpMinDecisionScore = 0.35
InpImpulseFil = true, InpImpulseMin = 0.50
InpMTFFilter = true, InpMTFLevels = 2
Aggressive trading:
InpMinConfluence = 1
InpMinDecisionScore = 0.0
InpSignalCooldown = 0
InpMTFFilter = false
4. COMPATIBILITY & REQUIREMENTS
Platform: MetaTrader 5, build 6274+
Language: MQL5 (modern standard, #property strict)
Compiled into a single .ex5 file, no external DLLs
Works in Strategy Tester (optimization and visualization)
Works on any asset class: Forex (4/5 digits), XAUUSD, indices (US30, NAS100, DE40), crypto (24/7), futures
Independent of quote precision and symbol prefixes/suffixes
No DLL, no network requests, no external file reads
5. DISCLAIMER
This indicator is a technical analysis tool and is NOT investment advice. Past performance does not guarantee future results. Before live trading, always test the indicator on a demo account with your own parameters and trading style. The author is not liable for any losses resulting from the use of this indicator.
6. SUPPORT
All questions and bug reports — via MQL5 Market messaging.
When contacting, please include: version (5.30), symbol, timeframe, and terminal logs (Experts / Journal) at the time of the issue.
