Guarda come scaricare robot di trading gratuitamente
Ci trovi su Facebook!
Unisciti alla nostra fan page
Script interessante?
Pubblica il link!
lasciare che altri lo valutino
Ti è piaciuto lo script? Provalo nel Terminale MetaTrader 5
Script

Import Ticks CSV - a tick file into a custom symbol for real-tick tests - script per MetaTrader 5

Dennis Muchiri Miano
Dennis Muchiri Miano
  • Developer and seller of MetaTrader 5 tools for risk, prop firms, gold and major forex pairs al  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
Visualizzazioni:
101
Pubblicato:
Freelance MQL5 Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance

Many brokers keep only a few months of real ticks, so "Every tick based on real ticks" cannot reach further back. This script reads a tick CSV you already have into a custom symbol, with the M1 bars built from it, and the Strategy Tester can then use it like any other symbol.

It places no orders and does not change any broker symbol.

Ticks imported into a custom symbol

What it does

  • Creates the custom symbol from a broker symbol, so it has the same contract specification, or updates one you already have.
  • Finds the time, bid and ask columns by their names, and recognises comma, semicolon or tab as the separator.
  • Reads epoch seconds or milliseconds, 2024-01-31, 2024.01.31, 31.01.2024 and 20240131, with or without milliseconds. Date and time can be in one column or two.
  • Moves UTC times to the server time most brokers use (UTC+2, UTC+3 during US summer time), or by a fixed number of hours.
  • Writes whole days at a time, and the first and last day of the file only as far as its ticks reach. Monthly or yearly files can be imported one after the other without a hole where they meet.
  • Counts the lines it could not read, the lines out of order and the ticks whose ask is below the bid, and reports them.

How to use it

  1. Put the CSV into the folder MQL5\Files of the terminal (File - Open Data Folder).
  2. Open a chart of the broker symbol, drop the script on it and enter the file name.
  3. Wait for DONE in the Experts log. A line that starts with ERROR says what went wrong.
  4. Choose the new symbol in the Strategy Tester with "Every tick based on real ticks".

The picture shows four days of gold: 590,461 ticks and 5,460 one-minute bars, imported in six seconds.

Inputs

  • InpFile: the CSV file in MQL5\Files. Its first line must name the columns.
  • InpSymbol: the custom symbol to create or update. Blank means the origin's name plus _CSV.
  • InpOrigin: the broker symbol to copy. Blank means the chart's symbol.
  • InpNYClose: UTC to server time, UTC+2 and UTC+3 in US summer (default true).
  • InpFixedShift: hours to add instead, when InpNYClose is off. Use 0 if the times are already server time, as in a tick export from MetaTrader 5.

Good to know

  • The log shows the broker's shift from UTC right now beside the shift the script uses. If they differ, set your own. The PC clock must be right for this check. The summer-time rule is the one in force since 2007.
  • In a date written 03.04.2024 or 03/04/2024 the day is read first, then the month.
  • For a Forex symbol the name must begin with the same six letters as the origin (EURUSD_CSV): MetaTrader takes its currencies from them. The script refuses another name.
  • Prices are rounded to the digits of the broker symbol.
  • The tester needs some history before the first tested day, so it may start later than the first tick. Import a little more than you want to test.
  • Prices and spreads of another source are not your broker's. Confirm a result on your broker's own ticks for the months it keeps.

The result also goes to ImportTicksCSV_result.txt in MQL5\Files. To see how far back your broker's own ticks reach, use Tick Depth Probe.

Questions and ideas: post in the comments.

Tick Depth Probe - how far back your broker keeps real ticks Tick Depth Probe - how far back your broker keeps real ticks

A script that shows how far back your broker's server keeps real ticks for a symbol. It samples a few short windows over the last four years, asks for each one until its ticks arrive or the time is up, and prints the oldest one that has ticks.

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.

Risk Lot Line: lot size from a draggable stop loss Risk Lot Line: lot size from a draggable stop loss

Drag a stop-loss line and read the lot size for your risk. The loss per lot comes from OrderCalcProfit, so the size is right on metals, indices and cross pairs. Shows the real risk after rounding, the margin and an R-multiple take profit. Places no orders.

Safe Pyramiding - add to winning trades only when they are risk free Safe Pyramiding - add to winning trades only when they are risk free

Decides if you can add to a running winner: only when all open trades in that direction are on break-even and the newest one is in profit. The open risk is never more than one add. Hedging accounts only.