Algorithmic Trading – What is it and how it works

The algorithmic trading is a form of trading where you use an algorithm, based on a set of predefined parameters, to open or close positions on your behalf.

Algorithmic trading seeks to eliminate the human factor (psychotrading) and instead follows predetermined strategies, based on statistics, that can be executed while the market is open by an algorithm with minimal supervision.

Many investors have long realized that machines can be excellent traders, since they are using the strategies without human interpretation.

What is Algorithmic Trading

the traditionAlgorithmic ng is trading through processes and logic, automating your trading system and executing trades with a robot. And for this, algorithms are usedhence its name.

algorithmic trading also called auto trading or high frequency trading and put your trading system into practice, with the parameters that you have previously established, without you having to intervene for anything other than opening the broker.

Thus, it is a computer program that determines the positions to be taken, the direction of the trend, the volume to be operated and, finally, the strategy to be established.

It is true that users will still have to come up with their own strategiesbut when applied correctly, these techniques can help traders take their hands off the wheel and let the math do the work.

Advantages and Disadvantages of Algorithmic Trading

As with any other trading system, there are pros and cons to using an algorithmic trading system. Let’s see which ones we consider most important:


  • Goodbye to Psychotrading: When operating according to a set of established rules, an automated trading system will execute its operations as indicated without entering into any other aspect that does not fall within the parameters of the algorithm.
  • Proven Strategies: Testing your algorithm against historical charts can generate insights into potential risk and rewards before you commit capital. This is possible, for example, with the strategy tester Metatrader 4 that simulates your trading strategy in real time and shows you with statistical data the profitability of your algorithm.
  • fast execution: An algorithmic trading system executes your trades much faster than a system if you do it manually. Since they are executed based on algorithms, algorithmic trading systems can place and close orders as soon as the set parameters are met, allowing you to minimize losses and make profits.

The precision of your operations manually will not beat an automated system. You will enter the market buying and selling when you have to, at the right time.


  • A control is necessary: an automated system should not fail, and in fact it almost never does, but you should have a minimum control and daily monitoring of your trading with algorithms.
  • You must align theory and practice well: The creators of automated trading systems and algorithms must understand well what is required of each other. Setting up an automated system well and putting it into practice is not easy.
  • The systems that are sold are not entirely reliable: Algorithmic trading systems claim to be able to do the impossible. Don’t be fooled by these claims and make sure you thoroughly check any new system.

Do Robots Work in Algorithmic Trading?

The vast majority of trading robots that you can buy in the market offer unreal results very well made up. The problem is that only for a very limited period of time.

If you carry out a good backtesting over a longer period of time and check the float of the account, you will realize the reality: they delay losses and there is a moment in the market when they can accumulate large losses.

This does not happen because it is a trading robot or is poorly configured, it happens because the strategy applied by the expert advisors is not profitable.

In short, if the strategy you automate does not offer profitability in a manual trading system, you have an automated robot that will never make you money.

If what you automate is a tested system with proven profitability, you have something that is constantly working well for you.

Automatic Trading vs Manual Trading: Which is better?

In my opinion, algorithms and algorithmic trading systems have their benefits, but the human factor of manual trading allows for greater reaction and flexibility.

systems algorithmic trading, they only react to what they are programmed to react to: vthey will understand when they have been told to sell and they will buy when they have been told to buy.

Sometimes I am asked the following question: Needed make a trading robot yes or yes to be profitable and make money? The answer is no. Algorithmic trading or an expert advisor is not the infallible formula to earn money.

algorithmic trading It is a methodology to do things in an orderly, methodical manner and maintain an objective approach. and real of things. It allows you to do things professionally and stay organized in terms of time and space.

You can also achieve this by implementing tools such as a trading plan, money management, keeping a track record up to date in your manual trading system. Our students that we have in our school are perfect masters of all these tools.

How to do Algorithmic Trading

Let’s see what the phases are and how an algorithmic trading system is designed:

Phase 1 – System Design

In this phase we will define what functions our system will perform, what information we need, what output it will generate, and all the operational details What should we consider. Following an example of the system based on the moving average, in this phase we will do the following:

  • Function: Make investment decisions automatically
  • System: Cross between price and moving average of 20 periods.
  • Timeframes: 5m, 30m and 4h
  • Schedules: European Session.
  • We will operate News: Nope
  • We will operate Openings: Nope.
  • Platform: Meta trader 4.

Once the most important aspects of our system have been defined, the next step will be to write our algorithm and the conditions by which the system makes the decisions and the different decisions.

Phase 2 – The Algorithm

The idea with which we must work in this phase is that of letr the algorithm written in the most concrete way possible and taking into account all the details, in this way the implementation phase will become an almost mechanical phase.

Continuing with our example, the algorithm would be as follows:

  • Input data / Variables:
  • Price, MM20, Equity, N.
  • Main function: N=NumLots()
  • If the price crosses the MM20* from bottom to top: Buy N lots.
  • Put Stop below the tail of the previous candle.
  • Put take profit 20 points above the entry price.
  • If the price crosses the MM20* from top to bottom: Sell N lots.
  • Put Stop above the tail of the previous candle.
  • Put take profit 20 points below the entry price.
  • Close Main Function.
  • NumLotes function: // We calculate the lot number
  • Equity * (risk) / Lot size

After this, we must implement the algorithm. The implementation is nothing more than the encoding of the algorithm in some programming language.this language will largely depend on the platform where our system will run.

We are going to use the platform meta trader and his MQL4 programming languagesince it is a platform that can be easily accessed and the language MQL4 is based on the popular C++ programming language..

Phase 3 – Backtesting

This phase is the most important, its mission is to test our system, check its performance, and fine-tune some parameters.

We will have a first result to see how efficient and profitable our system is, and we will know in what market conditions it performs best.

We will discover another very important fact, the maximum drawdown, or the maximum loss that the system can generatewhich will be vital when deciding the size of the account and the margin that the system must have in order not to end up receiving a margin call.

To improve our health, it is recommended to apply a correction factor of 20% to the data obtained.

Phase 4 – Real Market

The considerations that we must have in this phase are technical, in the event that our system is of scalping or high frequency, the speed with which the data is received and the orders are executed is key, in this case it would be advisable to open an account with an ECN-type broker.

Examples of Algorithmic Trading Systems

Finally, I am going to show you a couple of examples of the type of input that would be made by a robot that we are working on at Traders Business School.

Example 1. AUD/USD

At the red arrow, the trading robot marks the entry for us, so just on that candle, when it exceeds the wick of the previous candle, it would make the entry.

Where would you place the stop loss and take profit?

  • Stop loss above the wick of the candle that marks the maximum point of volatility.
  • Take profit at the same pip distance as the stop loss, which would make our 1:1 entry (risk €100 to win another €100).

Example 2. USD/JPY

As in the previous entry, at the red arrow the trading robot marks the entry for us, so just on that candle, when it exceeds the wick of the previous candle, it would make the entry.

Where would you place the stop loss and take profit?

In the same place as the previous entry. We like to work with 1:1 inputs on the robot. We believe in a simple robot, easy to handle and with a tight risk profile.

  • Stop loss above the wick of the candle that marks the maximum point of volatility.
  • Take profit at the same pip distance as the stop loss, which would make our 1:1 entry (risk €100 to win another €100).


  • In my opinion for a beginning trader, one of the best ways to approach the market is by educating yourself. Whether trading algorithmically or trading manually, I think you must learn many other things before launching into the market with an algorithmic trading system which, in general, will not be created by and tested by you.
  • Once the algorithmic trading strategy is developed, the trader does not become a spectator, but a manager, so having previous training is essential. A system needs constant monitoring of behavior and results to ensure maximum profitability at the lowest risk.
  • My recommendation, as always, is try a time in demo first and measure your resultssince both manual and algorithmic trading allow it in the Forex market.

Leave a Comment