I need an MQL5 Expert Advisor that trades once per day based on a 2-candle combination zone formed at 8:00 AM IST.
The EA must detect the correct server time equivalent of IST and work on any MT5 broker (Exness).
At 08:00 IST, the EA must:
Take the first M5 candle starting at 08:00.
Take the next M5 candle (08:05).
These two candles form the Combination Zone:
comb_high = max(high of both candles)
comb_low = min(low of both candles)
Ideally candles should be Green → Red or Red → Green.
If they are same color, still use these two candles as the combination zone.
Only one combination per day.
LONG Entry
Trigger: price breaks above comb_high
Order type: Market Buy
Stop Loss = comb_low
Take Profit = EntryPrice + 2 × (EntryPrice - comb_low)
(1:2 Risk-Reward)
Trigger: price breaks below comb_low
Order type: Market Sell
Stop Loss = comb_high
Take Profit = EntryPrice - 2 × (comb_high - EntryPrice)
First Entry
EA enters first breakout trade (long or short).
If FIRST trade hits TP
Stop trading for the rest of the day.
No second entry.
EA must allow ONE MORE trade (second entry).
Second entry follows same breakout rules.
After second entry closes (TP/SL) → stop for the day.
Lot size must be calculated using 1% or 2% risk of account balance:
stopDistance = comb_high - comb_low
riskAmount = Balance × Risk%
lot = riskAmount / (stopDistance × valuePerPointPerLot)
EA must:
Detect broker min / max lot
Respect lot step
Skip trade if lot < min lot
Include a max lot input cap (user adjustable)
Do NOT trade if spread > user input (e.g., 50 points).
Avoid duplicate trades on restart — use persistent variables or OnTradeTransaction tracking.
EA must handle restarts without forgetting:
combination zone
whether first trade was taken
whether second entry is allowed
EA must prevent more than 2 trades per day.
EA must reliably detect 08:00 IST, even if the broker server uses a different timezone.
Acceptable solutions:
Auto-detect using TimeLocal (if VPS is IST), OR
Input parameter: “Server hour equivalent of 8:00 IST”.
Either method is fine; the EA must work correctly.
Symbol
Risk Percent (1% or 2%)
Max Lot Cap
Spread Filter
Slippage (Deviation)
Magic Number
Enable/Disable 2nd Entry
Server Start Hour (if not auto-detected)
Fully working .mq5 + .ex5
Clear, commented source code
Clean input menu
One backtest showing logic from any date range
7–14 days bug-fix / correction support
The EA is considered complete when:
Combination candles at 8:00 IST are detected correctly.
Breakout entries occur exactly as per rules.
First trade hits TP → no more trades that day.
First trade hits SL → second entry allowed.
Lot size matches the risk % position sizing formula.
EA works after MT5 restarts with no duplicate trades.
Backtest examples for:
2025-Sep-24 to 2025-Nov-18