In this article are described some concepts that can be used to optimize automated strategies.

The topics covered are:

  1. Minimizing cost
  2. Finding an optimal entry/exit within a short time period
  3. Using Big Data to optimize strategies
  4. Statistically evaluating a strategy

Minimizing costs

Costs arise from the spread and commission. Statistically, these costs are the only thing that will cause you to lose money from trades.
The spread is by smallest on the EUR/USD pair but even on this pair, it changes enormously throughout the day. A strategy should therefore follow the spread closely and only enter or exit positions when it’s at its smallest level.

The graph above shows how the average spread and its standard deviation evolves throughout the day. It is important to keep in mind that the spread may change between the moment when you place an order and the moment at which the position is really taken.

Finding an optimal entry/exit within a short time period

Trends are a central point to any strategy. If there were no trends, there would be no means to predict price movements.
It is hard to claim whether trends occur on larger time scales or not but is definitely the case for very short time scales.

Again on the EUR/USD pair: If the current tick is higher than the previous one, the next tick has 60% chance of being even higher. The inverse is also true for bearish trends.

It is necessary to try and identify the best entry and exit based on very short term trends, even if your strategy trades on larger time-scales.

Using Big Data to optimize strategies

Spread can be predicted very well by statistical methods. The best results are obtained with recurrent neural networks. They are very flexible and totally adapted to predicting sequences. The LSTM network is one implementation that gives very good results and you will find some good java implementations on the net if you're interested.

In the same way, the next few ticks can be predicted with some success using the LSTM or other similar methods.

Evaluating your strategy

You can evaluate a strategy via a contingency table such as the one below:

You can then use this online tool to calculate the chi² and check for independence :

The test finds that the predictions and actual results are independent. This is the same as saying that the strategy producing those results is no better than random.

There are more accurate statistical methods that take into account the amounts earned, lost and predicted but a simple statistical test like the one above is usually sufficient to differentiate a potentially interesting strategy from a bad one.


The idea is that even if your strategy is giving you strong bullish or bearish signals, you can usually wait a few ticks for a smaller spread and a micro-trend that can give you a good start.

The worst a strategy can do is be random, (if it’s worth than random you can just reverse it). This means that losses can only come from trading costs. There’s little you can do about commission but spread can be predicted and therefore minimized.

A strategy might seem profitable but especially if it makes very few trades, the results might very well be due to good luck. At least some basic statistical test can easily give you an idea of this.

finally If you are into programming, it's worth it to dive into the world of machine-learning.

Good luck and good trading.
Translate to English Show original