Skip to content
All library documents

Comparing Hourly Gold Movement with Spread Costs

Article MQL5 code base

Summary

This document describes a script that measures how much price moves during each hour relative to the spread, using a broker’s own M1 history. For each symbol and hour, it averages the bar ranges as a movement measure and averages recorded spreads. Their ratio estimates how many spreads of movement occurred, making it possible to compare trading conditions across hours and instruments. The inputs control symbols, lookback length, time-zone adjustment, and CSV output.

The example reports that gold’s spread was relatively steady over the sampled period, while several major currency pairs had much wider spreads at midnight; gold also had no bar for that hour at this broker. These figures are broker-specific and are not a general market rule. The measure is a descriptive screening aid: hourly range does not establish tradable profit, and the document gives no strategy test or execution-cost analysis beyond spread. Results depend on the broker’s data, the lookback period, and the chosen hour alignment.

Key ideas

  • The script compares average hourly M1 ranges with average spreads for each hour.
  • The movement-to-spread ratio helps identify hours when observed movement is large relative to spread cost.
  • It can analyze multiple symbols side by side and optionally save per-symbol results as CSV files.
  • Broker-specific history and session closures can materially affect the hourly profile.
  • The ratio describes historical conditions and does not demonstrate that a trading strategy is profitable.

Tags

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