BtcUsd Trader AI
- Uzman Danışmanlar
- Bohdan Suvorov
- Sürüm: 2.52
- Güncellendi: 28 Şubat 2026
- Etkinleştirmeler: 15
Version: 2.52 | Timeframe: H1 | Optimized for: XAUUSD & BTCUSD
1. Executive Summary
HedgeReset EA is an automated Expert Advisor for MetaTrader 5 built around a market-neutral hedging strategy. It opens simultaneous Buy and Sell positions of equal lot size, then manages them through ATR-based dynamic stops, session-aware trade filtering, and a profit-cycle reset mechanism.
The EA does not predict market direction. Instead, it profits from volatility — whichever side moves far enough first locks in a trailing stop and eventually closes in profit, while the opposing position is covered by the net cycle target. It is engineered specifically for high-volatility instruments: Gold (XAUUSD) and Bitcoin (BTCUSD) on the H1 timeframe.
2. Strategy Logic
2.1 Entry — The Hedge
When no positions are open and all filters pass, the EA simultaneously opens one BUY at Ask and one SELL at Bid with identical lot sizes. No directional prediction is made. The cycle begins fresh regardless of prior results.
Filters checked before entry:
- Market session is active ( SymbolInfoSessionTrade — broker schedule)
- Symbol trade mode is not DISABLED or CLOSEONLY
- Current spread ≤ Average spread × InpSpreadMultiplier (default ×2.5)
- Symbol is not EURUSD (excluded by design)
2.2 Stop Loss & Take Profit — ATR Based
Stop Loss and Take Profit are calculated dynamically each tick using the ATR(14) indicator:
SL Distance = ATR(14) × InpATR_Multiplier (default ×1.5) TP Distance = SL Distance × InpRR_Ratio (default ×2.5)
Both values are floored to max(SYMBOL_TRADE_STOPS_LEVEL, SYMBOL_TRADE_FREEZE_LEVEL) + 3 points to prevent [Invalid stops] errors. This minimum is enforced at entry and on every trailing stop modification.
2.3 Trailing Stop
Once a position's floating profit exceeds InpTrailingStart points (default 15 pts), the SL begins trailing:
- BUY: new SL = Bid − TrailingStart × point. Moves only upward, minimum step = InpTrailingStep (default 5 pts).
- SELL: new SL = Ask + TrailingStart × point. Moves only downward (toward price), minimum step = InpTrailingStep .
Every modification is preceded by a stops-level check. If the computed SL would violate broker minimums, the modification is skipped that tick and retried on the next valid tick.
2.4 Cycle Reset — Profit Target
Each tick the EA sums POSITION_PROFIT + POSITION_SWAP for all EA positions on the symbol. When total net profit reaches the cycle target, all positions are closed and a new cycle starts immediately:
Cycle Target = (ATR × Multiplier) × InpCycleProfitMult × LotValue + SpreadCost
SpreadCost accounts for the bid-ask spread paid on both the BUY and SELL entry, ensuring the target is always genuinely profitable net of opening costs.
3. Risk Management
3.1 Dynamic Lot Sizing
Lot size is recalculated at the start of every cycle:
Lot = (Balance × InpRiskPercent%) / (SL_Points × TickValue / TickSize)
Result is clamped to:
- Broker minimum/maximum ( SYMBOL_VOLUME_MIN / SYMBOL_VOLUME_MAX )
- User limits: InpMinLot = 0.06, InpMaxLot = 10.0
3.2 Hard Loss Limit
If total floating loss across all open positions reaches InpMaxLossMoney (default $100), all positions are closed immediately as an emergency stop. This protects against flash crashes and gap events.
3.3 Session & Spread Filters
Session filter (v2.52): Uses SymbolInfoSessionTrade() to query the broker's actual trading schedule. All trading operations — entry, trailing, close — are blocked outside active sessions. This correctly handles:
- Weekend closure (Saturday/Sunday)
- Early Monday pre-market hours (e.g. XAUUSD before 01:00 server time)
- Late Friday session end
Spread filter: Current spread is compared against a rolling 20-bar estimate. Entry is blocked if CurrentSpread > AvgSpread × 2.5 .
4. Input Parameters Reference
| Parameter | Default | Description |
|---|---|---|
| InpRiskPercent | 1.0 | % of balance risked per cycle |
| InpMinLot | 0.06 | Minimum allowed lot size |
| InpMaxLot | 10.0 | Maximum allowed lot size |
| InpATR_Period | 14 | ATR calculation period |
| InpATR_Multiplier | 1.5 | ATR × multiplier = SL distance |
| InpRR_Ratio | 2.5 | TP = SL × this ratio (1:2.5) |
| InpCycleProfitMult | 1.0 | Cycle closes when profit ≥ SL-distance × this |
| InpTrailingStart | 15 | Profit in points before trailing activates |
| InpTrailingStep | 5 | Minimum SL move per modification (points) |
| InpMaxLossMoney | 100 | Emergency close if loss exceeds this ($) |
| InpSpreadMultiplier | 2.5 | Max spread = avg spread × this |
| InpMagicNumber | 123456 | Unique EA identifier |
| InpComment | HedgeAuto | Order comment label |
7. Installation
- Open the .mq5 file in MetaEditor and press F7 to compile — must show 0 errors, 0 warnings.
- Place the compiled .ex5 in MQL5/Experts/ inside your MT5 data directory.
- Attach to an XAUUSD H1 or BTCUSD H1 chart.
- In EA properties: enable Allow Algo Trading. In MT5 toolbar: enable the Algo Trading button.
- Account type: Hedging required. Netting accounts cannot hold simultaneous Buy + Sell on the same symbol.
8. Risk Disclosures
- Slippage on news: Hedging reduces directional risk but does not eliminate execution slippage during high-impact events (CPI, FOMC, geopolitical shocks). Both positions may close at worse prices than set.
- Swap costs: Holding both a long and short position overnight generates swap charges on both sides simultaneously. On many brokers swap is negative for both directions. Monitor daily swap for long-running cycles.
- Broker requirements: Requires low spreads and fast execution. High spreads directly reduce cycle profitability and may prevent entry entirely via the spread filter.
- Session dependency: The EA relies on SymbolInfoSessionTrade() returning accurate session data from your broker. Verify session times match your broker's actual market hours before live deployment.
- VPS recommended: For uninterrupted 24/5 (Gold) or 24/7 (Crypto) operation, run on a VPS to avoid gaps caused by internet or power interruptions.
- Past performance: Strategy Tester results do not guarantee live performance. Market microstructure, execution quality, and broker conditions differ significantly from historical simulation.
