What is Algotrading, 7 golden rules to begin with algotrading

What is Algotrading, 7 golden rules to begin with algotrading


What is a trading platform

A trading platform in finance is a computer software program that can be used to place orders for financial products over a network with a financial intermediary. It is possible to trade many financial products, over a communication network with a financial intermediary or directly between the participants or members of the trading platform.

The most common instruments traded are currencies like EurUsd, stocks, bonds, commodities and futures (derivative products).

How does a trading platform work

Each trading platform is provided by financial intermediaries that make it possible to trade in financial markets. The most common financial intermediaries are brokers, market makers, Investment banks or stock exchanges.

Such platforms allow electronic trading to be carried out by users from any location and are in contrast to traditional floor trading using open outcry and telephone based trading. Sometimes the term trading platform is also used in reference to the trading software alone.

Electronic trading platforms typically stream live market prices on which users can trade and may provide additional trading tools, such as charting packages, news feeds and account management functions. The most common trading platform is Metatrader 4. It is used by almost all the online Brokers and it lets people trade financial markets easily. It is even programmable for algotrading. We will see in the next paragraphs what is the meaning of algotrading.

The definition of a trading idea

Algotrading is a way to see something that you do everyday in a different manner.

Think for a moment about what you do while trading everyday. You have a preference for some instruments over others, you have a preferred indicator over others and so on… This set of behaviours shape your strategy, defining your private rules while trading. Of course, there are more detailed strategies and less detailed ones, but what it is important, it’s the concept of a set of rules that every trader follows while trading. That is the trading idea. What I mean is: if you are trading manually, you already have your own trading idea.

Algotrading is just a way to automate your trading idea into a financial algorithm. Let’s see now some hints to help you putting your strategy into an automated algorithmic trading robot.

How to shape a trading idea into a self-running algotrading strategy

First of all, you need to take a piece of paper and start to scribble down, drawing all what you do manually into logic flows. Remember that what you do manually is 99% of the times not replicable with an automated trading algorithm. You need to think easy and make your strategy as simple as you can, after all you are a human and can decide for your own when you are at a crossroad, your algotrading robots do not choose what to do, they just follow the rules you give them.

There are pros and cons about arbitrary choices, because when you take a decision different from what is your strategy, you can make profits or losses, it depends on you; while if a robot takes always the same decisions according to precise rules, you can measure performances and evaluate whether a strategy is good or not.

That’s why we think that it is important to make it simple. A trading robot must be simple and if you have many combinations for a single strategy, just divide them into different algorithms operating separately, otherwise you run the risk of writing so complex flows that you finish working on them when you are too wise to accept what you have done and you always start back again with a better idea. There is not a perfect idea, you need to run your trades with looking good strategies and adjust them during the time.

Pay much attention on the amount of money your robots use for each trade and spend some time to write rules to let your robots manage money as well as the strategy itself. The common mistake for all those starting with algotrading is to focus too much on the strategy and too little on the money management. The other point I’d like to suggest to algotraders, is to pay attention to the selling strategy, because many times I found myself with a really strong entry strategy and a really weak exit one. This is because usually the manual exit strategy was too much based on personal point of views and not on a strong well defined strategy.

In order to clarify all the thoughts of this paragraph, here is a short list of suggestions for you when you start working on algotrading:

  • Make up your mind with a piece of paper, drawing what you normally do manually in an ordinated flow
  • Think easy, do not look for too complex strategies and if the strategy you use manually is complex, try to simplify it as much as you can
  • Think well about entry and exit strategy, focusing well on both ones, defining precise rules for both of them
  • Pay attention to money management as you pay attention to the strategy itself
  • Do not wait for the perfect strategy, just start, there is no perfect strategy.

Introduction to Metatrader 4 and Mql4 language

Now that the strategy is well defined (it is a really time consuming activity), you just need to put your logic flows into a trading robot. A trading robot is just a code running in some platforms. As I explained in the first paragraphs of this article, Metatrader 4 is a really good platform where to start with algotrading. Trading algorithms in Metatrader are called Expert Advisors and can be written in mql4 language, the programming language of Metatrader.

How to take your financial algorithm and start writing in mql4 language? There are many ways to do that. We have written some algotrading lessons that you can find here:

Another way is to follow our Youtube channel and look at our video lessons, in order to learn easily, by writing a working Expert Advisor from scratches.

Of course you will need to go to mql5.com and start studying more for deeper knowledge after these first introductive lessons.

Freelance to code Expert Advisors

Backtesting and trading

Once you have your Expert Advisor coded, you have your algotrading framework ready to operate. That is what many people think, unfortunately it is not enough. Backtesting is necessary to test your algotrading robot.

What is a Backtest and why so important? Backtesting literally means running your Expert Advisor over historical data prices of a financial instrument and showing past performances. In case of positive performances, you can suppose that it could work in the future, if not, it needs to be improved and optimized. We will not talk about optimization in this article, but you just need to know that optimization is atleast the 20% of the whole process of creating an Expert Advisor as a matter of time spent.

In order to run a backtest you just need to go to the Tester area of your Metatrader 4 and run it.

 Metatrader 4 Tester for Backtest

Tester strategy Expert Advisor

The raw data for every backtest is high quality historical data that you can find in our website for a lot of instruments.