Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Twitter !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Scripts

Backtest Data Preflight: check broker bar and tick history - script pour MetaTrader 5

George Ciprian Mandache
George Ciprian Mandache
Mostly writing code that does stuff...

User guides are on my blog. For questions or bugs, write in the product's Comments tab or send me a message.
Vues:
113
Publié:
Mise à jour:
MQL5 Freelance Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance

Backtest Data Preflight shows what price history your MetaTrader terminal can read for a symbol, timeframe and date range. Check the report before starting a backtest if you want to see whether the broker returned bars near the dates you asked for.

The script also runs on MetaTrader 4. Save the downloaded source as BacktestDataPreflight.mq4 in MQL4/Scripts and compile it in MetaEditor.

Run a check

  1. Compile the script in MetaEditor and drag it from Navigator onto a chart.
  2. Use the chart symbol and timeframe, or pick a timeframe and enter another symbol from Market Watch.
  3. Set From and To in broker server time. The check includes From and excludes To. Leave both at zero for the last 30 days.
  4. On MetaTrader 5, turn on Check tick history to inspect ticks as well. Read the report in Experts.

Read the report

  • The bar count and first and last opens show what the terminal returned. The edge offsets show how far those opens are from the requested dates.
  • A gap is a pair of opens farther apart than the selected timeframe. Check the dates against normal trading hours. Weekends and holidays can produce gaps. Monthly bars show the observed dates without a gap count.
  • The MT5 tick scan checks each server date separately. Empty reads and reads that returned an error have separate totals. When ticks are available, the report gives their count and the first and last timestamps.

Try it on an hourly currency chart over a weekend. The report shows the interval between Friday's last open and the next one. Use the Strategy Tester report to check what the test actually ran on.

Bar and tick report from an MT5 terminal run

TradeGateway: Fake Broker for Trade Management Tests TradeGateway: Fake Broker for Trade Management Tests

A library for MetaTrader 5 that puts trade management code behind an interface and tests it against a fake broker, without a trade server. The fake checks stops level, freeze level, tick grid and volume step, answers with retcodes chosen by the test and logs every request. An example break-even rule and 26 test cases come with it.

Trailing Stop That Starts at the Take-Profit Level Trailing Stop That Starts at the Take-Profit Level

Starts a trailing stop when the price reaches the take-profit zone of a position you already have open. The take profit is removed, extended or kept. It never opens trades.

Symbol Trading Hours: broker trade sessions, countdown and off-session bars Symbol Trading Hours: broker trade sessions, countdown and off-session bars

An indicator that reads the broker's weekly trade-session schedule for the chart symbol and shows whether trading is open, when the next close or open happens and a live countdown to it. It also marks bars that lie completely outside the trade sessions.

Range Expansion Clock: When the Day's Range Actually Gets Made. Range Expansion Clock: When the Day's Range Actually Gets Made.

A per-hour profile of when the day's range actually gets built, plus a live readout of whether today is running ahead of or behind its usual pace