magic giant Version: 1.0

×

🚀 "Unleash the Giant: Smart Trading Starts Here"


This Expert Advisor (EA) is a semi-aggressive martingale-based trading system built for MetaTrader 4. It's designed to work on cent accounts, specifically on the M5 timeframe, and is optimized for EURUSD and GBPUSD pairs. The strategy uses order layering with increasing lot sizes to recover from drawdowns and generate consistent profits.


⚙️ Recommended Settings

Capital = 100 USD (Cent Account)

Timeframe = M5

Pair = EURUSD or GBPUSD

Max Pairs = 2 per 100 USD capital

🔧 Input Parameters

ParameterTypeDescription

LotsdoubleInitial lot size for the first trade (e.g., 0.01)

TakeProfitdoubleTake profit target in pips

MaxTradesintMaximum number of trades allowed in a martingale cycle

MultiplierdoubleLot size multiplier for martingale steps (e.g., 1.5 means each next trade is 1.5x larger)

PipStepdoubleMinimum pip distance required between entries


🔄 How It Works

1. Initialization

The EA initializes a set of variables, defines default settings, and sets up chart objects like labels for Account Equity, Profit/Loss, and Order Count.


It also calculates an expiry timestamp to automatically disable or close trades after a certain time.


2. Order Logic (OnTick Function)

🔁 Main Trading Cycle

Detects current market trend by analyzing the last few candles.


Opens a BUY or SELL order when conditions match:


If uptrend: opens a BUY


If downtrend: opens a SELL


➕ Martingale Mechanism

If trade goes into loss:


Places a new trade at a defined pip step.


Increases lot size using the Multiplier.


Continues until MaxTrades is reached or profit is achieved.


✅ Take Profit & Trailing Stop

TP is dynamically calculated based on the average price of open trades.


Trailing stop is optional (Ib_0040 = true) and adjusts SL as price moves in favor.


❌ Risk Protection

If total floating loss exceeds a percentage of equity (Id_0038), the EA closes all trades to prevent account wipeout.


⏱ Auto Timeout

Closes all trades after a fixed period if trades remain open without result (Il_00D0 logic).


🧪 Advanced Logic

Equity Check: Keeps track of highest equity during drawdowns and avoids over-trading.


Dynamic Take Profit & Stop Loss Calculation: Based on average open price across all trades.


Trade Context & Retry Logic: Uses retries with delays if server is busy or orders fail.


🔐 Safety Features

Equity Protection: Stops trading if losses exceed threshold.


Trade Timeout: Optional auto-close after specific time.


Retry Mechanism: Retries failed trades due to busy server or requotes.


📝 Slogan

“Unleash the Giant: Smart Trading Starts Here.”


👨‍💻 Developer & Source

Developer: R.KH

Year: 2025

Official Source: www.robomql.com



Leave a comment

$220