-->

Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

Metatrader 4 Expert Advisor | Latest: Popular (1M views) 4 Hour Range Strategy coded and tested | Trading Tool Update

Discover expert developed MetaTrader tools that can complement professional solutions.

Provided for educational purposes; not trading advice. Backtests on EURUSD under my conditions were unprofitable.

The strategy follows the following logic:

  1. First the strategy marks the high and the low of the first 4H candle, using the New york time zone.
  2. After the first 4H candle is formed the strategy waits for a 5 Minute candle to close outside the Range.
  3. If a 5 Minute candle closes above the High and then a 5 Minute candle closes back in the Range, there is a sell signal.
  4. If a 5 Minute candle closes below the Low and then a 5 Minute candle closes back in the Range, there is a buy signal.

There was one vague rule the strategy did not follow regarding the orderblock. To avoid trades after the price has overextended beyound the range, a time filter was introduced and if the price stayed above the high or below the low for more than 75 Minutes the trade is marked as invalid.

It is of utmost importance to specify your own broker's GMT offset times and the dates when the switching from Summer time to Winter time (and vica versa). Since this strategy is based on the New York local time, a single error in this can offset the whole strategy.

Here are the input parameters for the strategy:

  1. ServerGMTOffsetWinter: The GMT offset of the broker's server in winter time.
  2. ServerGMTOffsetSummer: The GMT offset of the broker's server in summer time. (Can be the same as Winter offset for brokers with fixed GMT offset)
  3. ServerSwitchToSummerMonth: The month when the broker switches to summer time zone.
  4. ServerSwitchToSummerDay: The day of month when the broker switches to summer time zone.
  5. ServerSwitchToWinterMonth: The month when the broker switches to winter time zone.
  6. ServerSwitchToWinterDay:The day of month when the broker switches to winter time zone.
  7. Lots: Lotsize

Here are the backtest results of the backtest for EURUSD:

Backtest report for MT5

Equity curve


Watch in-depth trading tutorials and EA reviews on the RobotFX YouTube channel. Subscribe for free tips.

Build better strategies with RobotFX professional tools – check them out.

68095

Best MetaTrader Indicators + Profitable Expert Advisors