Assista a como baixar robôs de negociação gratuitos
Encontre-nos em Telegram!
Participe de nossa página de fãs
Script interessante?
Coloque um link para ele, e permita que outras pessoas também o avaliem
Você gostou do script?
Avalie seu funcionamento no terminal MetaTrader 5
Scripts

Backtest Data Preflight: check broker bar history before a backtest - script para MetaTrader 4

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.
Visualizações:
154
Publicado:
Freelance MQL5 Precisa de um robô ou indicador baseado nesse código? Solicite-o no Freelance Ir para Freelance

Backtest Data Preflight shows what bar history your MetaTrader 4 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.

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. Read the report in the Experts tab.

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.
  • If the first bar is far after From, open the History Center (F2), download the history for the symbol and run the check again. Bars the terminal never received are not in the test either.

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's Report and Journal tabs to check what the test actually ran on.

Bar report from an MT4 terminal run

CustomStopOut: your own margin call and stop-out levels, worst order closed first CustomStopOut: your own margin call and stop-out levels, worst order closed first

A script that sets your own margin call and stop-out levels above the broker's. It alerts when the margin level falls below your margin call level and, below your stop-out level, closes open orders one at a time, the worst net result first, until the level is back up, the way a broker stop-out works.

StrictJson: RFC 8259 JSON parser and writer for MQL4 StrictJson: RFC 8259 JSON parser and writer for MQL4

One include file that reads and writes JSON in MQL4. It refuses broken JSON and tells you the line and column of the mistake, keeps numbers exact, reads and writes UTF-8 files, and saves your EA's settings to a file and loads them back.

Hotkeys: keyboard shortcuts for MQL4 experts and indicators, set in the inputs Hotkeys: keyboard shortcuts for MQL4 experts and indicators, set in the inputs

One include file that gives your EA or indicator keyboard shortcuts the user types into the inputs, such as Shift+B. Each press fires one action, Shift+B never fires on a plain B, and a shortcut that cannot work is refused at start with the reason.

TesterSafeLots - risk lot size that stays correct in the MT4 Strategy Tester TesterSafeLots - risk lot size that stays correct in the MT4 Strategy Tester

Risk-based lot size for MQL4 that does not depend on MODE_TICKVALUE in the Strategy Tester, so backtests of USDJPY, USDCHF or USDCAD on a USD account risk what the input says. Includes a test EA that measures the error.