Platform: MetaTrader 5 (MT5)
Language: MQL5
Robot Type: Fully Automated Expert Advisor
Trading Direction: Both BUY and SELL
Strategy: Higher Timeframe (HTF) Trendline Breakout with Retest Confirmation
I require a professional, fully automated MT5 trading robot based on a Higher Timeframe Trendline Breakout and Retest strategy.
The robot must analyse the market carefully using multiple timeframes, identify valid trendlines, wait for confirmed breakouts, and execute trades only after a successful retest.
The EA must prioritise accuracy, capital preservation, disciplined entries and strict risk-to-reward management over trading frequency.
I do not want a robot that enters trades randomly or trades every market movement.
The robot must use three timeframes:
WEEKLY – Major Market Direction
Identify the overall market trend.
Identify major swing highs and swing lows.
Draw and analyse major ascending and descending trendlines.
Identify significant support and resistance zones.
Establish the overall bullish or bearish market bias.
4-HOUR – Trend Confirmation
Confirm the direction established by the Weekly timeframe.
Identify intermediate swing highs and lows.
Draw relevant H4 trendlines.
Identify valid market structure and potential breakout areas.
Confirm whether the market is suitable for a BUY or SELL setup.
1-HOUR – Trade Execution
Identify the actual trendline breakout.
Require a completed H1 candle to close beyond the trendline.
Wait for price to return and retest the broken trendline.
Require confirmation that the retest is holding.
Execute the trade only after confirmation.
The robot must not enter simply because price touches or crosses a trendline.
The EA must automatically identify valid trendlines using confirmed swing highs and swing lows.
BUY CONDITIONS:
Weekly and H4 analysis supports a bullish trading opportunity.
Price breaks above a valid descending trendline on H1.
An H1 candle closes above the trendline.
Price returns to retest the broken trendline.
The retest holds as support.
A bullish confirmation candle forms.
The trade offers a minimum 1:3 risk-to-reward ratio.
Execute BUY.
SELL CONDITIONS:
Weekly and H4 analysis supports a bearish trading opportunity.
Price breaks below a valid ascending trendline on H1.
An H1 candle closes below the trendline.
Price returns to retest the broken trendline.
The retest holds as resistance.
A bearish confirmation candle forms.
The trade offers a minimum 1:3 risk-to-reward ratio.
Execute SELL.
The EA must support both directions independently and must not permanently favour BUY or SELL trades.
This is a very important requirement.
I want the EA to visually highlight its analysis directly on the MT5 chart.
The robot must:
Draw identified Weekly and H4 trendlines.
Draw the H1 breakout trendline.
Mark the exact breakout candle.
Highlight the retest area using a coloured rectangle.
Display a BUY or SELL confirmation signal.
Mark the proposed entry price.
Draw Stop Loss and Take Profit levels.
Display the calculated risk-to-reward ratio.
Show the current market bias: BULLISH, BEARISH or NO TRADE.
Use different colours to distinguish bullish and bearish setups.
I want to understand exactly why the robot entered a trade.
Capital preservation is extremely important.
The EA must include:
Adjustable risk per trade.
Recommended default risk: 1% of account equity.
Maximum margin allocation: 3–5% of account equity, configurable.
Automatic lot-size calculation based on Stop Loss distance.
Automatic Stop Loss placement.
Automatic Take Profit placement.
Maximum daily loss setting.
Maximum drawdown protection.
Maximum number of simultaneous positions.
Optional break-even functionality.
Optional trailing stop functionality.
Daily trading limit.
Emergency stop function.
The robot must never increase lot sizes to recover previous losses.
It must not use Martingale, Grid or uncontrolled averaging strategies.
This is a NON-NEGOTIABLE trading rule.
Minimum acceptable RR: 1:3.
Higher RR opportunities: 1:4, 1:5 or above.
Never execute a trade with an RR below 1:3.
Calculate RR before placing an order.
Account for spread, commission and expected execution costs.
Reject trades where the stop loss is excessively large.
Never move the Stop Loss further away to accommodate a losing trade.
Example:
Entry: 1.1000
Stop Loss: 1.0950
Risk: 50 pips
Take Profit: 1.1150
Reward: 150 pips
Risk-to-Reward: 1:3.
My long-term performance objective is to develop a system capable of targeting approximately 30–50% account growth over a suitable performance period.
This is a performance objective, NOT a guaranteed return.
The EA must prioritise consistent execution, controlled drawdown and positive risk-adjusted performance rather than forcing trades to achieve a monthly target.
The EA should include:
Spread filter.
Volatility filter using ATR.
Optional economic news filter.
Minimum trendline quality requirements.
Minimum number of valid trendline touches.
Confirmation of candle closes.
Retest confirmation.
Protection against false breakouts.
Avoid trading when the market is consolidating without a valid setup.
The EA should wait patiently when there is no valid opportunity.
The robot must:
Automatically calculate lot sizes.
Place market orders after all conditions are met.
Set Stop Loss and Take Profit automatically.
Manage open trades.
Prevent duplicate entries on the same breakout.
Allow configurable trading sessions.
Support multiple currency pairs.
Support both bullish and bearish market conditions.
I require the following:
Complete MT5 source code (.mq5).
Compiled MT5 Expert Advisor (.ex5).
Fully configurable input settings.
Automatic trendline drawing.
Automatic breakout and retest detection.
Visual BUY/SELL chart annotations.
Automatic risk and lot-size calculations.
Backtesting results.
Strategy optimisation report.
Installation instructions.
User manual explaining all settings.
Demonstration of BUY and SELL executions.
Before accepting the final EA, I require testing using historical market data.
Please provide:
At least five years of historical testing where reliable data is available.
Tests across multiple currency pairs.
Weekly, H4 and H1 timeframe alignment.
Modelling using real ticks where available.
Profit factor.
Maximum drawdown.
Win rate.
Total trades.
Average RR.
Net profit.
Consecutive losses.
Out-of-sample testing.
Please do not optimise the EA only to produce attractive historical results. I want a strategy that can withstand different market conditions.
I want a professional, intelligent and disciplined trading robot that follows my HTF Trendline Breakout and Retest strategy.
The robot must analyse Weekly, confirm on H4, and execute on H1.
It must identify valid opportunities in both directions, wait for breakout and retest confirmation, and strictly enforce a minimum 1:3 risk-to-reward ratio.
NO CONFIRMATION = NO TRADE.
RR BELOW 1:3 = NO TRADE.
CAPITAL PROTECTION COMES FIRST.
Please confirm that you understand the complete strategy before beginning development. I also require a working demonstration and backtesting evidence before final delivery.