BananaQuant v2.0 MT5 Source Code

BananaQuant v2.0 MT5 Source Code

Pinned Quarterly Featured MT5v2.0

M1 momentum-reversal first layer + counter-trend grid martingale + tiered basket TP + deep-blue tech panel + direction lock. Built for XAUUSD range-pullback markets.

Views 835 Downloads 144 File 45.9 KB Updated 2026-10-09

Details & Usage Instructions

Core Features
1. First-layer Signal: M1 Momentum Reversal (tick-level)
Look back the last N M1 closes.
move = current Bid - N-M1-ago close.
Drop ≥ threshold → reverse to long; rise ≥ threshold → reverse to short.
Tick-level trigger, no wait for candle close.
Min interval between first layers (default 30s).

2. Counter-trend Grid Martingale
Add a layer when price runs reverse by grid spacing (default $2.0).
Up to 16 layers; lot increases by param table (0.01 → 1.50).
Lot table scalable overall (InpLotScale), scaled proportionally for bigger capital.
First layer posts a server TP (optional); auto-canceled on entering grid, managed by basket TP.

3. Tiered Basket TP (core)
TP distance by current layer count:
1-2 layers: $1.50
3 layers: $1.25
4 layers: $1.00
5 layers: $0.85
6 layers: $0.70
7 layers: $0.65
8+ layers: $0.60
Deeper layers → closer TP, faster breakeven close.
Chart draws TP line (green long / red short) with price and layer labels.

4. Two-way Independent Operation
Long and short each maintain a basket, can run in parallel.
Hedge can be disabled, allowing only one-direction basket.

5. Direction Lock (new in v2.0)
Three panel buttons: Both / Long / Short.
Selected highlighted, others dimmed, mutually exclusive click.
After lock, only that direction's signals are accepted; reverse signals filtered out.
Only affects first-layer opening; existing basket management unaffected.

6. Risk System
Basket SL: chop the whole basket when floating loss hits threshold (default off, 1:1 replica of original no-hard-SL).
Daily breaker: no new first layer after daily realized loss hits threshold (default off).
Escape plan: after deep basket (max lot ≥ threshold), close all on basket profit target (default off).
Trailing TP: starts after layer threshold; close all on N% peak pullback (default off).
Big-candle pause: pause N minutes after single M1 amplitude exceeds limit (default off).
Spread limit: no new open/averaging above threshold.
Margin check: reject open if insufficient, 60s log throttle.
Weekend liquidation: close all after a set Beijing-time Saturday time.

7. Daily Target & Stats
Daily profit target: no new first layer after reached.
Today's earnings, floating loss, close count, peak profit, peak loss.
Dual peaks persisted, survive restart.

8. Business Hours
Beijing time, minute granularity.
Supports cross-midnight sessions.
Auto market-closed on weekends.

Deep-blue Tech Panel
Background card (360×545)
Title bar: 🍌 BananaQuant v2.0
Status bar: Open / Closed / Stopped + real-time spread
Long basket card: layers / total lot / average / price / TP line / max lot / floating P/L
Short basket card: same
16-layer grid ladder: opened layers colored green/red by floating P/L
Today P/L card: today earnings / floating loss / close count / peak profit / peak loss
Daily target progress bar
Risk-status card: reason no first layer / escape plan / daily breaker / big-candle pause / basket SL
Direction-lock three buttons: Both / Long / Short
Draggable

Chart TP Line
When long basket exists, draw green dashed at average + TP.
When short basket exists, draw red dashed at average - TP.
Label shows price + layer count.
Auto-delete after basket close.

Suitable Market
Built for XAUUSD (gold); good for ranging and pullback markets.
Not for extreme one-sided, no-pullback, frequent-gap markets.

2.jpg

Risk Warning:Resources on this site are for learning, research and technical exchange only, and do not constitute any investment advice. Before running any EA on any account, please do thorough forward-testing on a demo account first; no strategy can guarantee profits.