DSC_0079 Algo trading cover image by Zach Doty

MetaTrader4 (MT4) Software: A Beginner’s Algorithmic Trading Platform

Before we begin, you’ll notice this post deals with finance and investing, both of which are highly risky. This site and this post is strictly educational. Nothing in this post or on this website is intended as, nor should be construed as investment advice. Kindly first visit the Disclaimers page before you proceed, taking careful note of CFTC Rule 4.41 regarding hypothetical performance. Further, investing and trading is extremely risky, to the point that 90% of participants rapidly fail. As such, your participation in investing and trading could lead to loss of principal, and even further losses beyond that in some cases. Neither this site in its entirety, nor this post, nor any portion thereof, nor any resulting discussion or correspondence related to this site and post, is intended to be a recommendation to invest or trade mutual funds, stocks, commodities, options, or any other financial instrument. I will not accept any responsibility for any losses which might result from applications of ideas expressed on this site or in this post from the techniques or systems mentioned on this site or in this post. Nothing shown is the result of an actual trade. Neither past actual performance, not simulations of performance assure future results, profitable or otherwise.

Introduction: Why MetaTrader 4 (MT4) as a Beginning Algo Trading Platform

Alright! With the obligatory legalese out of the way, my journey into algorithmic trading and quantitative finance continues. Obviously to trade, you need to have a vehicle for doing so. Unlike the days of old where you would call a stock broker, most trading today is electronic. For many electronic trading use cases, you need:

  • A platform that at a minimum provides an electronic order management system connected to a broker
  • Who then deals with an exchange (Chicago Mercantile Exchange [CME], New York Stock Exchange [NYSE])
  • That eventually attempts to fulfill your request and back.

There are tons of software platforms and configurations which can be used to design and develop an algorithmic trading program. For the purposes of this education, MetaTrader 4 was selected as the starting platform. Though I’ve dealt with some other programs in the past such as NinjaTrader, yes, Robinhood (sigh), and TD Ameritrade’s ThinkorSwim, MT4 is the platform for this foray.

Advantages

  • Free (Obviously an important reason! Other platforms offer free trials, but with limited functionality.)
  • Free data (Close second for the most important reason. If your industry is remotely related to technology, you understand data is the new oil. While some vendors may provide free end of day data (E.g., Kinetick), what you need often has a price or cost associated with it. MT4 will offer viable free and live data, helpful to the beginner.)

For Mt4, we will get free live data from the Broker. Additionally, historical data is available from MetaQuotes and other online sources like Dukascopy.

  • Access to different markets (With some footwork, we can test and trade FX, Equities Indices, Equities (Stock), Commodities and Fixed Income instruments.
  • Ease of learning the coding language (The MQL4 language is largely based on the widespread C++ programming language. In addition to its popular base, MetaQuotes Language (MQL4) is well documented with lots of users, so many examples to learn from!)

 

Disadvantages

  • Lowest bar timeframe is 1min (If you’re doing more precise or higher frequency trading, this can be a drawback. However, A), we’re not doing HFT, B) if we were, there is a workaround. And we probably would some kind of integration with Rithmic for HFT-esque executions.)
  • Portfolio backtesting doesn’t come out of the box (If you’re simulating a multi-instrument algo strategy (Or in MT4 terms, Expert Advisor [EA]) you’ll be out of luck, and would have to test on another platform or find another methodology.)
  • Advanced statistical analysis doesn’t come out of the box either (It can be difficult to incorporate heavy statistical apparatuses in the algos. However, we can carry out statistical analysis on the data using Microsoft Excel or other statistical software (Python libraries, etc.). Performance analysis can be done using 3rd party software, more on that in the later.)

 

 

Other Possible Trading Software Platforms

 

Various reasons the above platforms listed aren’t being used includes, but not limited to:

1) Cost

2) Difficulty of learning the coding languages

3) Complicated user interfaces

4) Backtester and/or optimizer not included.

5) Software platform not well designed for building and trading algo strategies.

6) Limited access to markets

7) Poor community support and documentation

 

Why not MT5?

The main reason MT4 is being used over MT5 is because most brokers support the former but not the latter.

Some key differences between MT4 and MT5:

1) Different coding language (MQL4 vs MQL5). MQL5 is more difficult to pick up for beginners.

2) MT4 has been around longer and has better online support. There are many code libraries, templates and examples for MT4.

 

3) MT5 does not allow external data import (This is unfortunate- data management is a huge component of backtesting.)

 

Final Note: Why Forex as a Trading Instrument?

Convenience: Forex data isn’t (as) affected by many common market variables such as stock splits, futures contract roll-overs, expiries and dividends, etc. These factors can greatly complicate the testing and data cleaning process.

Data is available: Free data everywhere! Data on other instruments is much harder to obtain.

Can often extrapolate to other instruments: Algos built on forex can often be easily modified to fit CFDs on other instruments.

Principal instrument traded on MT4.

 

Wrap-Up

Thanks for tuning in- if you’re weird enough to like this, you might find my beginner’s foray into SQL interesting as well. Cheers!

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply