Page 1 of 1

Higher timeframe moving averages on lower charts: the stair step problem

Posted: Thu Oct 15, 2026 9:01 pm
by Fairman
Higher timeframe moving averages on lower charts: the stair step problem

A common setup is plotting, say, the H1 50 EMA on an M5 chart, so you can see the bigger trend without switching charts. TradingView and MT5 both let you do it, either through the indicator settings or a custom indicator.

The catch is how it's drawn. Each H1 value only exists once the hour closes. So on the M5 chart, the line stays flat for twelve candles, then jumps to the next value. It looks like stairs. Some versions smooth that out by drawing a line between the steps, which looks nicer but uses future data for the candles in between. On historical charts that line is a little better than what you'd have seen in real time.

There's also the question of the current hour. Some indicators show the still forming H1 value, which moves around until the hour closes. Others only show closed values, which lag but don't change.

Neither is wrong. You just need to know which one you're looking at, especially if you backtest by eye. A smooth higher timeframe MA can make pullback entries look cleaner in hindsight than they were.

I use the stepped version with closed values only. It's uglier but what I see in replay is what I'd have seen live.

Re: Higher timeframe moving averages on lower charts: the stair step problem

Posted: Fri Oct 16, 2026 9:32 am
by Fairman
An alternative some people use is to scale the period instead, for example a 600 EMA on M5 to approximate an H1 50 EMA. It's not identical, since the EMA weights are applied to M5 closes rather than H1 closes, but it updates every M5 bar with no steps and no lookahead. The two will drift apart a bit, especially after sharp moves within the hour. For a rough trend filter that's often close enough, and it avoids the repaint question entirely. I'd pick one approach and stick to it in both analysis and backtesting, so the two match.

Re: Higher timeframe moving averages on lower charts: the stair step problem

Posted: Fri Oct 16, 2026 10:20 am
by Fairman
If you code this in an EA, be careful with which bar index you use from the higher timeframe. Reading bar zero gives the forming value, bar one the last closed one. Mixing them up is one of the most common reasons an EA backtests better than it trades. In MT5 the tester can also behave oddly with multi timeframe data at the start of a test, so I'd skip the first few days of results while the higher timeframe history loads in properly. Printing both bar zero and bar one values to the log for a few hours is a fast way to confirm the EA is reading what you think it's reading.