Part 14 Meta Trader 4 Show – How to download a functional program

Best Binary Options Brokers 2020:
  • BINARIUM
    BINARIUM

    The Best Binary Options Broker 2020!
    Perfect For Beginners and Middle-Leveled Traders!
    Free Education.
    Free Demo Account.
    Get Your Sign-Up Bonus Now!

  • BINOMO
    BINOMO

    Recommended Only For Experienced Traders!

How To Download Tick Data in MetaTrader 4 & 5

This post describes how to download and save tick data offline, from both MT4 and MT5.

Functional code samples (MetaTrader indicators) have been provided via GitHub, along with instructions on how to download and use them to begin extracting tick data from MetaTrader 4 or 5.

Each tick data point extracted using this post’s implementation contains:

  1. Timestamp (in seconds or milliseconds)
  2. Bid price
  3. Ask price
  4. Bid/Ask Spread

The remainder of this post is organized as follows:

  1. The case for collecting tick data.
  2. Anatomy of a simple Tick Data indicator.
  3. Differences between MT4 and MT5 versions.
  4. Indicator Installation Instructions.

The case for collecting tick data

Traders can benefit in a number of ways by collecting tick data directly from their broker.

This ensures exact consistency (barring any unrelated issues, technical or otherwise) between tick data stored offline and that available via the MetaTrader platform.

Possible use-cases include:

1) Backtesting trading strategies that require tick-level precision.

2) Sampling price data by synchronizing it with e.g. speed of tick arrival instead of block intervals (e.g. M1, M5, etc).

This practice addresses the negative impact of time based intervals effectively ignoring the frequency of price change at different times of day.

For those interested, Mandelbrot and Taylor [1967] were among the pioneers in establishing that sampling by transaction frequency improves statistical soundness:

“Price changes over a fixed number of transactions may have a Gaussian distribution. Price changes over a fixed time period may follow a stable Paretian distribution, whose variance is infinite. Since the number of transactions in any time period is random, the above statements are not necessarily in disagreement.”

3) Developing strategies, tools, indicators etc. outside the MetaTrader environment (e.g. in Python, R, Julia, Java, C/C++ etc.)

Best Binary Options Brokers 2020:
  • BINARIUM
    BINARIUM

    The Best Binary Options Broker 2020!
    Perfect For Beginners and Middle-Leveled Traders!
    Free Education.
    Free Demo Account.
    Get Your Sign-Up Bonus Now!

  • BINOMO
    BINOMO

    Recommended Only For Experienced Traders!

4) Monitoring the evolution of Bid/Ask spreads both inside and outside MetaTrader.

5) Drawing inferences from time-weighted average bid/ask spreads (TWAS) vs. your strategy’s evolution (both in real-time and otherwise).

6) Strategies targeting small gains can benefit from optimizing execution based on the evolution of underlying asset TWAS data.

7) Connecting a real-time FX tick data feed via ZeroMQ to non-MQL trading strategies or R&D software.

.. and the list goes on.

Anatomy of a simple Tick Data Indicator

The indicators implemented in this post have the following structure:

1) Initialization -> OnInit()

This function is called when the indicator is loaded on a chart in the MetaTrader terminal.

For our purposes, the only activity required here is:

  • Open a new CSV file for writing tick data to, e.g. EURUSD_TickData.csv
  • If the file already exists, append data to it instead of creating a separate file for the same asset.

Code listing:

2) Tick Processing -> OnCalculate()

This function is called each time a new tick is received.

Here we’ll need to:

  • Check if a file is open for writing the tick’s bid, ask and spread values to.
  • If yes, write tick to file.
  • If no, throw an error highlighting the failure.

Code listing:

3) Termination -> OnDeinit()

This function is called when the indicator is removed from the chart, the chart is closed with the indicator still deployed on it, or the terminal is shut down correctly for any reason.

All we need to do here is check if the file being written to is still open, and close it.

* Important Note: You must remove the indicator from the chart before attempting to open the CSV file being written to. MetaTrader will have exclusive read/write access to the file while the indicator is running.

Code listing:

Differences between MT4 and MT5 versions

This implementation uses MetaTrader’s MqlTick structure in both the MetaTrader 4 and 5 versions.

For your reference, the definition for MqlTick is:

There is one subtle but important difference between its use in MetaTrader 4 and 5:

MqlTick.time_msc will return a timestamp in seconds (in MetaTrader 4) and in milliseconds (in MetaTrader 5)

Therefore, for MetaTrader 4 users in particular, it makes sense to use MetaTrader 5 for collecting tick data as subsecond sampling isn’t available in MetaTrader 4.

Other minor differences include using the comma (‘,’) delimiter in FileOpen() operations in MetaTrader 4, as opposed to tab (‘\t’) in MetaTrader 5.

MetaTrader Indicator Installation Instructions

We’ve uploaded functional MetaTrader 4 and 5 versions of this Indicator to our GitHub page under tools -> MQL4 and MQL5 respectively.

First, simply Right-Click and Save-As on the following link to save the file to your computer, and follow the instructions below them:

Instructions:

    Launch MetaTrader, and open your data folder (File -> Open Data Folder)

MetaTrader Open Data Folder

If you want to open the CSV file, you must first remove the indicator from the chart.

To do this, Right-Click anywhere on your chart and select Indicator List:

MetaTrader Indicator List

Then select the indicator from the displayed list, and hit Delete to remove it from your chart:

Delete Indicator from MetaTrader chart

To access the CSV file, click File -> Open Data Folder, and once inside, head over to the MQL x \Files (‘ x ‘ described as above) directory and open the CSV file that will have been saved here.

Saved MetaTrader Tick Data

The next post in this series discusses how to automate tick data collection using R, MetaTrader and a VPS instance.

As always, we hope you’ve enjoyed this tutorial, and look forward to any feedback you may have for us ��

Code samples have been kept as simple as possible to enable the programmer in you to thrive in extensibility, and exercise your creative freedom as best as you can!

Should you have ideas/feedback on how we can extend this implementation further, please do feel free to leave a comment below – we’ll try our best to either release an update, or resolve your query directly.

Also, kindly share this post using the buttons provided, with any colleagues and/or networks you feel would benefit from the content. Or just share it anyway to help us spread the word! ��

You may also wish to read:

Platform MetaTrader 4

Another Forex trading software

A platform for trading on the Forex market, or a trading terminal, is nothing but software that allows you to attend the international currency market interactively and make various transactions on it. Brokerage companies can also call platforms trading customers, but for end-users, all of these names mean the same thing.
The trading terminal is the main tool of the trader. The MetaTrader 4 trading terminal is software, and more precisely, a combination of hardware and software that provides interaction between traders and dealing centers in various types of operations (trading and non-trading).
Terminals with a wide range of functions and capabilities are provided by dealing centers to their clients, as a rule, on a free basis, in the form of distribution files for their subsequent installation on the user’s personal computer. One of these terminals is the MetaTrader 4 trading platform, the most popular and widespread today. This platform works both in real and in demo mode.

Trading platform

The system allows you to select several modes for transactions called – instant execution, trailing stop, 2 market, 2 stop orders, and 4 pending. The introduction of these functions has contributed to increasing the level of comfort of working with the program. The implemented functions make it possible to send orders from the schedule with a single click. There is a built-in tick chart that helps determine entry and exit points fairly accurately. MetaTrader 4 has fairly rich functionality that will help implement a wide variety of Forex strategies. All of these parameters distinguish this platform from other applications, providing users with a wide selection of settings to simplify and organize work.

Convenience and high level of security

MetaTrader 4 has been designed to meet the highest safety standards. Data transmission from the client terminal to the servers is encrypted; there is support for RSA signatures. For beginners who are taking their first steps in the Forex market, it is recommended to review MetaTrader 4 in a demo mode: learn the program interface, functionality, learn how to analyze the market and trade using virtual money. To open a virtual or real account, you need to download a terminal from the site of the selected dealing center. More details on how to download, install, and work with MetaTrader 4 are described below.

You are not logged in! To download unlimited files you must log in to your forum account!

You are not logged in to the MT4talk forum!

  • Total number of registered users: 49,211
  • Registered users today: 65
  • Newest registered user: tatigo2020
  • Total number of topics: 11,648
  • Total number of posts: 37,852

Online users: 1,770 guests, 107 Members:

MT4talk is a User Generated Content website. All content uploaded to MT4talk by our users (MT4talk forum members) is User Generated Content.

All User-Generated Content shall be for information purposes only. While MT4talk shall endeavor to provide you with accurate information on its Website, MT4talk shall not be responsible for the accuracy or reliability of User Generated Content. As such you agree to access the Website and use the Services at your own risk. You shall be solely and exclusively responsible for all User Generated Content you upload or post on the Website. You hereby grant MT4talk (i) an irreversible, non-exclusive, royalty-free and fully-paid, worldwide license to reproduce, distribute, publicly display and perform, prepare derivative works of, incorporate into other works, and otherwise use and exploit your User Generated Content, and (ii) the right to include the User Generated Content on the Website. You hereby irreversibly waive any claims and assertions of moral rights or attribution with respect to your User-Generated Content.

Only open source forex trading software used to automate online trading decisions/signals (“Forex Trading Robots”) shall be uploaded by you onto the Website. MT4talk prohibits the uploading of copyrighted, hacked or illegal versions of forex trading robots on to the Website. MT4talk may remove any copyrighted hacked or illegal versions of forex trading robots from its Website and may close your Member Account (defined below) should you upload copyrighted, hacked or illegal versions of forex trading robots on to the Website. Forex Trading Robots that have been uploaded on the Website, may undergo a simulated back-test on an actual forex account by our tester team, solely for the purposes of providing you with a starting point for your own back-test and for educational purposes only.

To use the MT4talk forum, you must agree on the Terms of use and Privacy & Cookies Policy!

CFTC RULE 4.41 – HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS, IN GENERAL, ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.

Disclaimer – No representation is being made that any Forex account will or is likely to achieve profits or losses similar to those shown on backtests in this forum. In fact, there are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. Hypothetical trading does not involve financial risk, and no hypothetical trading record can completely account for the impact of financial risk in actual trading. All information on this forum is for educational purposes only and is not intended to provide financial advice. Any statements posted by forum members or the MT4talk EA Tester Team about profits or income expressed or implied, do not represent a guarantee. Your actual trading may result in losses as no trading system is guaranteed. You accept full responsibilities for your actions, trades, profit or loss, and agree to hold the MT4talk team and forum members of this information harmless in any and all ways.

Affiliates Disclaimer – The site may contain links to affiliate websites, and we receive an affiliate commission for any sign up that trade by you on the affiliate website using such links. Our affiliate partner includes the following: FXopen, FBS, LQDFX, MyForexVPS, KickEX.

Download MetaTrader 4

Download MetaTrader 4 for PC to receive the most powerful and convenient tool for technical analysis and trading in the markets. During the first launch, you will be prompted to open a free demo account allowing you to test all the features of the trading platform.

Features of MetaTrader 4

  • Powerful trading system with support for 3 execution modes and 8 order types
  • Unlimited number of charts and 50+ analytical tools
  • Algorithmic trading, Expert Advisors and MQL4 IDE
  • MetaTrader Market where you can buy indicators and trading robots
  • Trading signals allowing you to copy deals of other traders
  • News and alerts informing you of the important market events

Trade Forex with the most popular and powerful trading platform.

MetaTrader 4 iPhone/iPad

Millions of traders have already chosen MetaTrader 4 iPad/iPhone to work in the financial markets anytime and anywhere.

Join them for free.

  • Access to Forex from anywhere in the world 24 hours a day
  • Connection to 2 000+ broker servers
  • 30 popular technical indicators and 24 analytical objects
  • Full-featured trading system: 2 execution modes and 4 order types
  • Real-time symbol quotes
  • Up to 10 open charts opened simultaneously
  • Financial news
  • Email and chat

MetaTrader 4 can now be placed in your pocket allowing you to trade Forex at any time!

MetaTrader 4 Android

There are numerous Android powered smartphones and tablets, and any of them can be used to trade Forex via MetaTrader 4

  • Round-the-clock access to the market
  • Connection to 2 000+ broker servers
  • 30 technical indicators and 24 analytical objects
  • Full-featured trading system: 2 execution modes and 4 order types
  • Real-time symbol quotes
  • 3 chart types and 9 timeframes (periods)

Download MetaTrader 4 Android and manage your trading account wherever you are and whatever you do!

If you do not have access to Google Play — download MetaTrader 5 in APK format (for Android 4.0 and higher)

Best Binary Options Brokers 2020:
  • BINARIUM
    BINARIUM

    The Best Binary Options Broker 2020!
    Perfect For Beginners and Middle-Leveled Traders!
    Free Education.
    Free Demo Account.
    Get Your Sign-Up Bonus Now!

  • BINOMO
    BINOMO

    Recommended Only For Experienced Traders!

Like this post? Please share to your friends:
Binary Options Brokers, Signals and Strategies
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: