Hacker X AI Manual
Expert Advisor Manual — MQL5 MetaTrader 5
HACKER X AI
Advanced Hedging EA · Full Trader Documentation · v2.0
MT5 Native
MQL5 Source
All Pairs & Gold
Auto Risk Guard
HACKER X AI is a fully automated Expert Advisor for MetaTrader 5 built around a multi-level hedging strategy. When the initial trade moves against you, the EA automatically opens a counter-trade (a hedge) in the opposite direction with a larger lot size — allowing it to recover losses and close the basket in net profit when conditions align.
It enters the market using an EMA crossover + RSI confluence signal, then manages the position with break-even, trailing stop, and full drawdown protection — all while displaying live statistics on an in-chart dashboard.
02
How It Works — Logic Flow
1
Signal Scan — EMA Cross + RSI Filter
Every tick, the EA checks if the fast EMA (default 21) has crossed the slow EMA (default 50). A bullish cross triggers a BUY signal; a bearish cross triggers a SELL. The RSI filter confirms momentum — it blocks buys if RSI is overbought (>70) and blocks sells if oversold (
2
Initial Entry — Hedge Level #0
A trade is opened at the base lot size (default 0.01). The EA always verifies there is enough free margin before entering using OrderCalcMargin() . A Take Profit is set. No Stop Loss on the initial trade — the hedge manages risk instead.
3
Position Monitoring
The EA watches the open position every tick. If price moves in your favour, Break-Even and Trailing Stop kick in to protect profit. If price moves against you beyond the trigger distance, a hedge is triggered.
4
Hedge Trigger — Counter-Trade Opened
When the position is losing and price has moved InpTriggerPoints against you, a counter-trade is opened in the opposite direction. The hedge lot is the previous lot × the multiplier (default 1.5×). This repeats up to 4 levels. The EA checks margin before each hedge — if margin is insufficient, it halves the lot until it fits.
5
Position Management — BE + Trailing
All profitable positions have trailing stops applied. Break-even is moved once a position reaches the break-even offset in profit. SL/TP values always respect the broker’s minimum stop level ( SYMBOL_TRADE_STOPS_LEVEL ) to avoid invalid stop errors.
6
Basket Closure — Take Profit
Each hedge has its own TP. When TPs are hit, the combined basket closes in net profit. The EA halts for the day if the daily profit target is reached. Max drawdown guard closes everything and halts if equity drops too far.
Example using default settings (InpLotSize=0.01, InpLotMultiplier=1.5, InpTriggerPoints=50) on a standard pair:
#0 BUY 0.01 #1 SELL 0.02 #2 BUY 0.03 #3 SELL 0.05 TP -50pts -50pts -50pts Entry Price
| Level | Direction | Lot Size | Trigger | Purpose |
|---|---|---|---|---|
| #0 Initial | BUY (signal) | 0.01 | EMA cross + RSI | Original trade, follows the trend signal |
| #1 Hedge | SELL (counter) | 0.02 (×1.5) | −50 points loss | First counter-trade, covers initial loss |
| #2 Hedge | BUY (counter) | 0.03 (×1.5) | −50 points further | Second recovery layer |
| #3 Hedge | SELL (counter) | 0.05 (×1.5) | −50 points further | Third recovery layer |
| #4 Hedge (max) | BUY (counter) | 0.07 (×1.5) | −50 points further | Final recovery — no more hedges after this |
On instruments like XAUUSD (Gold), even a 0.01 lot needs significant margin. The EA automatically checks OrderCalcMargin() and will reduce the hedge lot if margin is insufficient — it will never send a trade it can’t afford.
04
Input Parameters — Full Reference
| Parameter | Default | Description |
|---|---|---|
| Core Settings | ||
| InpLotSize | 0.01 | Starting lot for the initial trade. Keep small on high-margin pairs like XAUUSD. |
| InpLotMultiplier | 1.5 | Each hedge multiplies the previous lot by this value. 1.5 is balanced; going above 2.0 increases recovery speed but blows margin faster. |
| InpMaxHedges | 4 | Maximum number of hedge levels. After this, no more hedges are placed. Recommended: 3–5. |
| InpTriggerPoints | 50 | How many points price must move against a losing trade before triggering the next hedge. Higher = wider gaps = lower hedge frequency. |
| InpTakeProfit | 80 | Take Profit in points for the initial trade. Hedges use 50% of this value. |
| Trend Filter | ||
| InpMA_Fast | 21 | Fast EMA period. Shorter = more signals (more trades, more noise). Try 10–21 for scalping. |
| InpMA_Slow | 50 | Slow EMA period. Larger = stronger trend filter. Try 50–200 for swing trading. |
| InpRSI_Period | 14 | RSI lookback. 14 is standard. Lower = more reactive, higher = smoother. |
| InpRSI_OB / InpRSI_OS | 70 / 30 | Overbought / Oversold thresholds. Tighten to 65/35 for fewer but higher-quality entries. |
| Risk Management | ||
| InpMaxDrawdown | 5.0% | Maximum allowed equity drawdown. If hit, all positions close and trading halts for the day. Set between 3–10% depending on your risk tolerance. |
| InpDailyProfitTarget | 2.0% | When daily balance profit reaches this %, the EA closes all trades and stops for the day. Prevents overtrading after a good day. |
| InpUseBreakEven | true | Moves SL to near entry once the trade is profitable by InpBreakEven points. Recommended: always ON. |
| InpBreakEven | 20 | Points of profit required before break-even triggers. Must be above broker’s STOPS_LEVEL. |
| InpUseTrailing | true | Activates trailing stop on profitable positions. Recommended: ON. |
| InpTrailingStart | 40 | Profit in points before trailing stop activates. |
| InpTrailingStep | 10 | How tightly the trailing stop follows price. Smaller = tighter trailing. |
05
Live Dashboard — Reading the Stats
The dashboard renders directly on your MT5 chart. Here’s what each panel shows:
⚡ HACKER X AI | HEDGING EA
BALANCE10,250.00 USD
EQUITY10,183.40 USD
OPEN P&L-66.60
MAX DD1.24%
Win / Loss
34 W16 L68.0%
Trade Stats
TOTAL TRADES50
GROSS PROFIT842.30
GROSS LOSS291.10
PROFIT FACTOR2.89
LARGEST WIN48.20
LARGEST LOSS32.10
CONSEC WINS7
CONSEC LOSS3
Hedge Status
OPEN POSITIONS2
HEDGE LEVEL1 / 4
STATUS● ACTIVE
08:14:33v2.0 | MQL5
Win Rate Bar
Green
≥55% win rate
Win Rate Bar
Yellow
40–54% win rate
Win Rate Bar
Red
Status Badge
● Active
EA trading normally
Status Badge
■ Halted
DD or target hit
Profit Factor
>1.5
Healthy performance
1
Open MetaEditor
In MT5, press F4 or go to Tools → MetaQuotes Language Editor.
2
Create the File
File → New → Expert Advisor (template). Name it HACKER X AI . Delete the template code and paste the full EA source code.
3
Compile
Press F7 to compile. You should see 0 errors, 0 warnings in the Toolbox. If warnings appear, check your broker’s symbol name and lot constraints.
4
Attach to Chart
In MT5 Navigator panel (Ctrl+N), find HACKER X AI under Expert Advisors. Drag and drop onto your desired chart (e.g. EURUSD M15).
5
Enable Auto Trading
Click the Auto Trading button in the MT5 toolbar (turns green when active). Also enable “Allow algorithmic trading” in the EA’s properties → Common tab.
6
Set Inputs and Go
In the EA properties → Inputs tab, configure your lot size, risk settings, and other parameters. Click OK. The dashboard will appear on the chart.
Run HACKER X AI on a demo account or in Strategy Tester for at least 2–4 weeks before going live. Every broker has different spreads, stop levels, and margin requirements that affect performance.
07
Recommended Settings by Use Case
Conservative — Low Risk
LotSize: 0.01
Multiplier: 1.3
MaxHedges: 3
TriggerPts: 80
MaxDD: 3%
DailyTarget: 1%
Timeframe: H1 / H4
Balanced — Recommended ✓
LotSize: 0.01
Multiplier: 1.5
MaxHedges: 4
TriggerPts: 50
MaxDD: 5%
DailyTarget: 2%
Timeframe: M15 / M30
Aggressive — Higher Risk
LotSize: 0.05
Multiplier: 2.0
MaxHedges: 5
TriggerPts: 30
MaxDD: 8%
DailyTarget: 4%
Timeframe: M5 / M15
Gold moves in larger point ranges. Set TriggerPoints to 150–300, TakeProfit to 200+, and keep LotSize at 0.01 or lower. Gold requires higher margin per lot — always check your broker’s margin requirements first.
A healthy EA should have a Profit Factor above 1.5 in backtesting. If yours is below 1.2, tighten the RSI filter (65/35) or increase TriggerPoints to reduce hedge frequency.
Q: Why is the EA showing “Invalid stops”?
Your broker’s minimum stop level (STOPS_LEVEL) is larger than the SL/TP distance. Increase InpBreakEven and InpTrailingStart values until they exceed your broker’s stop level. The EA auto-detects this via SYMBOL_TRADE_STOPS_LEVEL but your input values also need to be above it.
Q: “Not enough money” error on XAUUSD?
Gold requires high margin. The EA auto-reduces hedge lots if insufficient margin is detected. If it still errors, reduce InpLotSize to 0.01 and InpLotMultiplier to 1.2, or increase your account balance.
Q: The EA says “HALTED” — what happened?
Either the daily profit target was hit (good!) or the max drawdown limit was reached. The EA resets automatically the next trading day at midnight server time.
Q: Can I use this on multiple pairs at once?
Yes. Attach HACKER X AI to different charts with different symbols. Each instance tracks its own positions via the Magic Number and symbol filter.
Q: What timeframe should I use?
M15 or M30 is the sweet spot for most pairs — enough signal quality without excessive noise. H1 works well for conservative traders. Avoid M1/M5 on live accounts until backtested thoroughly.
Risk Disclaimer
Forex and CFD trading involves significant risk of loss and is not suitable for all investors. Past performance is not indicative of future results. HACKER X AI is an automated trading tool — it cannot guarantee profits and can sustain losses. Always test on a demo account before live deployment. Never trade with money you cannot afford to lose.
HACKER X AI · v2.0 · MQL5 METATRADER 5 · ALL RIGHTS RESERVED