Skip to content
All library documents

Scaling Indicator Line Shifts Across Timeframes in MQL5

Article MQL5 articles

Summary

This article explains how to display standard indicators from a higher timeframe on a lower-timeframe chart when their lines have a shift. A shift measured in source-chart bars must be converted into recipient-chart bars: for example, one higher-timeframe bar spans multiple lower-timeframe bars. The implementation also applies the line shift when copying source indicator values into the destination buffer, so the data alignment matches the plotted offset.

The article describes changes to a reusable MQL5 buffer collection: allowing calculated buffers to store shifts, adjusting the starting position used when copying indicator data, and using a shared method for preparing standard indicators in multi-symbol and multi-period modes. The demonstration reports that Bollinger Bands and Alligator display with their intended shifts in the selected setup. It also identifies limits: Gator Oscillator and Ichimoku are not yet handled because their internal calculations use shifted lines, and the demonstrated library and test indicator target MetaTrader 5 rather than MetaTrader 4. This is a charting and indicator-data alignment technique, not a trading strategy or performance study.

Key ideas

  • Convert a source indicator’s shift into the equivalent number of bars on the chart where it will be displayed.
  • Apply the shift when copying source values as well as when plotting the destination line.
  • A shared buffer method can reduce duplicated handling across standard indicators.
  • The demonstration shows shifted Bollinger Bands and Alligator lines in a multi-timeframe setup.
  • Indicators whose calculations use shifted lines may need separate handling.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.