Loading…

Intraday Reversal Time Statistics

Traders often have an instinct for "the market usually turns around this time", but rarely a number behind it. This script walks every H1 close-to-close step in the requested history, classifies each step's direction as up, down or flat, and flags a "flip" whenever a bar's direction is the opposite sign of the immediately preceding bar's direction - both steps must sit inside the same calendar day, so the overnight gap between one day's last bar and the next day's first never counts as a flip. For every server-time hour, the script reports three figures: how often a flip actually happened out of the times a genuine two-sided comparison was possible that hour (the flip rate), the average size of the flip bar's own move in pips, and how many further bars, on average, the new direction kept going before the next flip or the trading day ended (persistence). A high flip rate with low persistence describes a choppy, indecisive hour; a lower flip rate with high persistence describes an hour that tends to set a direction and hold it. "Direction" is deliberately simple: the sign of one H1 close-to-close step. This is an honest proxy for a turning point, not a claim about what happened tick by tick inside the hour, which H1 bar data cannot reconstruct. Notes and limitations - All hour labels are server time as reported by iTime(); the script does not attempt to convert to any other time zone. - A flip requires two consecutive non-flat directions inside the same calendar day; a flat (zero-change) bar breaks the comparison chain rather than counting as a continuation or a flip. - Persistence is measured only forward from the flip bar to the next flip or the day's last available bar - it does not look back to how long the direction being replaced had itself run. - This is a bar-close proxy for turning points, not an intrabar tick study; a genuinely tick-level reversal-time study would need tick history, which this script does not use.

Script · MT5 · v1.0 · Free

About Intraday Reversal Time Statistics

Intraday Reversal Time Statistics is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 2 settings, such as Symbol and Max bars. MQL source code included.

Files in the download: IntradayReversalTimes.ex5, IntradayReversalTimes.mq5, IntradayReversalTimes.txt.

Settings

SettingDefaultWhat it does
SymbolSymbol to study, blank = this chart's symbol
Max bars5000Most recent H1 bars to include

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria