Free strategy check — send your trading rules and we tell you within 24 hours if they can be automated. No obligation. Send your rules →
MT5 EA24 Sep 2026 · Eye Algo

Many strategies use a higher timeframe for direction and a lower one for entries, for example a 4H trend with 15-minute entries. This post explains how that works inside an EA and the one mistake that makes backtests look better than live trading.

How it works in an EA

  1. Read the higher-timeframe indicator on its last closed bar only.
  2. Allow buys only when that trend is up, and sells only when it is down.
  3. Take entries on the lower timeframe when your entry rule fires.

Why traders use more than one timeframe

A lower timeframe gives more entry points but also more noise. A higher timeframe is slower but shows the larger direction. Combining them lets a trader act only in the direction of the bigger move. This idea is simple to state, but it has to be coded carefully, because the EA reads two different time scales at the same moment.

The common mistake

Using the higher-timeframe value of the bar that is still open. It changes until that bar closes, so the backtest looks better than live trading. A correct EA uses closed bars, or clearly states when it uses the open one.

This is the same family of problem as repainting in Pine Script, which we describe in Pine Script to MT5. If a strategy was tested on TradingView with higher-timeframe data, check this first.

Points to settle in your rules

  • Which timeframes: the trend one and the entry one.
  • Which indicator on the trend timeframe: a moving average, Supertrend, or another.
  • Closed or open bar: we recommend closed bars unless you have a reason.
  • What happens when the trend flips: close open trades, or only stop new ones?
  • Number of timeframes: two is common, three adds more logic and more testing.

Testing multi-timeframe logic

MT5's strategy tester handles several timeframes better than MT4, which is one reason we suggest MT5 for new projects. See MQL5 vs MQL4. Test with real tick data, and compare the higher-timeframe values the EA reads with the chart at several dates. Our post on backtest vs live explains why tester results can still differ from a live account.

See our Supertrend multi-timeframe sample on the Our portfolio page.

Price and delivery

Multi-timeframe logic usually puts a project at the advanced level: from ₹7,000 and 4 to 8 days, depending on the number of conditions and filters. The final price is fixed in a written quote after we review your rules. Work starts after a 50% advance, and you see a working demo before the balance is paid. Three free revisions are included. See the pricing page and the EA service page.

An EA automates the rules you give it. A multi-timeframe filter can reduce trades against the trend, but it does not make a strategy profitable, and trading carries risk. Test on a demo account first.

A worked example

Say the rule is: trend on H4 using a 50 EMA, entries on M15. The EA reads the last closed H4 candle. If it closed above the EMA, the EA allows only buys. On M15, it waits for your entry rule, for example a closed candle above a 20 EMA after a pullback, then opens a buy with your stop loss and take profit. When the next H4 candle closes below the EMA, buys stop and, if you choose, open buys are closed. Every step uses a closed bar, so the test and the live behaviour should match as closely as the data allows.

Keeping it readable

Print the higher-timeframe value in the EA's log or on the chart, so you can check what the EA sees at each entry. This makes the demo stage faster, because you can compare the EA's reading with your own chart at the exact time of a trade.

If your strategy came from a TradingView script, send the script along. Multi-timeframe code in Pine often uses special functions, and reading the source is the quickest way to match its behaviour in MT5. Our conversion service covers that.

Finally, write down what you expect the filter to do. The goal is usually fewer trades against the larger direction, not more profit by itself. If the demo shows the EA skipping trades you would have taken by hand, compare those cases with your rules to see whether the rule or the expectation needs to change.

Frequently asked questions

Can I use three timeframes?

Yes. Each added timeframe needs its own rules and testing, so the project may move to a higher price level. Send the rules on the contact page and we will tell you what fits.

Why do my backtest and live results differ with higher-timeframe filters?

The usual cause is reading the open higher-timeframe bar. Another is differences in data and spread between the tester and your broker. Check both.

Can you add a multi-timeframe filter to my existing EA?

Often yes. See our page on changes to an existing EA. We need to read the current rules or code first.

Have a strategy you want automated?Get a free strategy check
← All articles