Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Scripts

Tick Depth Probe - how far back your broker keeps real ticks - script for MetaTrader 5

Dennis Muchiri Miano
Dennis Muchiri Miano
  • Developer and seller of MetaTrader 5 tools for risk, prop firms, gold and major forex pairs at  DeeFX
  • Kenya
  • 820
I build MetaTrader 5 tools for my own trading and publish them on the MQL5 Market under DeeFX. I trade with the tools I build: a tool ships only after it has done its job on my own charts, so it can do the same job on yours.
What I build
- Risk and drawdown guards for prop-firm rules
Views:
14
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

A backtest on "Every tick based on real ticks" is only as real as the ticks your broker still keeps. This script asks the broker's server for real ticks in a few short sample windows, from two weeks ago back to about four years ago, and tells you the oldest tick it found.

It places no orders and changes no settings. Run it on the symbol you want to test: tick history is kept per symbol.

Tick Depth Probe result on XAUUSD

How it works

  • The windows start two weeks ago, then about 1, 3, 6, 12, 18, 24, 30, 36, 42 and 48 months ago. Only a few days are asked for in each, so the script does not need the whole history.
  • The first request for a window makes the terminal download it, so an early answer can be "no ticks" although the broker has them. The script asks each window again until ticks arrive or the time limit is up.
  • The newest window is a control. If even that one is empty, the script says that the result means nothing instead of naming a date.
  • It stops after a set number of empty windows in a row. If ticks turn up behind an empty window, or a request failed, it says so.

How to read the result

One line per window shows the start date, the number of ticks and the average per day of the window. In the above picture the last window with ticks is only partly filled, which is why its average is far lower: the history begins inside it. The line "Oldest tick found" is the one to set your test start by: start on or after that date. The picture shows a run on gold on one broker's demo, where the ticks began about three months back.

Inputs

  • InpSymbol: symbol to check. Blank means the chart's symbol.
  • InpDays: length of each sample window in days, from 1 to 7 (default 4).
  • InpWaitSec: the longest wait for each window in seconds (default 60). Raise it on a slow connection or a symbol with many ticks.
  • InpStopEmpty: stop after this many empty windows in a row (default 2, 0 checks all).
  • InpOnChart: show the result on the chart as well (default true).

The result also goes to the Experts log and to a text file in MQL5\Files, TickDepthProbe_ plus the symbol name.

Good to know

  • On gold, with half a million ticks a day, a first run took about five minutes and a repeat about two.
  • The windows are samples. A tick in a window does not prove that every minute between two windows is there, and the true start can lie between an empty window and the next one.
  • An empty answer can also be a slow download. Run it a second time with a longer wait before you rely on it.

Questions and ideas: post in the comments.

Swing Level Breaks Graded by Volume Swing Level Breaks Graded by Volume

Draws support and resistance from confirmed swing points and keeps each level live, with its price on the chart, until a close breaks it. Every break is graded on the spot: an arrow when volume surges, a diamond when the candle shows a rejection wick, a hollow circle when price slipped through without either.

Account Settings Sync - Bidirectional EA Settings Across Charts Account Settings Sync - Bidirectional EA Settings Across Charts

Small MQL5 library that shares an EA's own runtime settings between charts of the same account, with edits from either chart, a file lock and per-field merge.

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

MACD Signals MACD Signals

Indicator edition for new platform.