In continuation of previous article Set main rules where I described main particularities of this simple strategy, I am now exposing main data obtained from some back-test and the arrangements I did in order to improve the stability and profitability.


First of all, I wish the strategy to produce as many losses as possible but in the same time, not to cause too much drawdown or (worst) completely destroy the account. Second, I need at least 100 executed positions so in this case a 3 month test should be enough. Third, once obtained the results I will have to understand how many times the strategy fails, why and when.


Here are the 3 months back-test results:

As we see, the strategy did not burn the account which is actually a good sign considering there is not even 1 single way to protect the downside risk (except the stop loss and default margin call). However, there is a large imbalance favoring the losing trades, indeed ending equity returned a value of 37.329$ meaning a 25% net loss caused by 97 losing trades.

The strategy is based in a fast timeframe (15minutes) but considering the particularity of the rules, there are far more than expected losing trades. The problem is directly connected with the core rule it-self, because it's very well known that in low liquidity market hours, price rarely experience large moves and moving average indicator shows bad signals. So, giving this as a true fact, I started analyzing every single position.

In the picture below you can easily understand what paricularly took my attention.

There is an impressive amount of losing trades during low liquidity market hours, so meaning from 19.00 gmt until the 7.00 gmt, for a total of 33 losing trades and only 9 profitable ones. This is well enough to proceed with the first improvement on the code!

Trading hours

Making the strategy to not open any position between 19 - 7 GMT just required few lines in the code easily found in Dukascopy Wiki. But as soon as I solved the first problem I immediatly came to another one: what about floating trades opened before 19.00GMT? Well, I had to check every single position and I came to a total of 20 floating positions, where 14 losing and 6 winning. So I decided to implemet the code as shown below, in order to cut any open position when not in trading hours.

  • Main settings:
  • Setup of close order engine:
  • And additional rule in "onTick" method:

This small arrangement not only helped to improve the profitability (as explained later) but also solved an important issues: the strategy now stop at week ending time and starts only on Mondays when London session starts, completely avoiding any possible opening gap (which caused bad losses in first test).

Take profits & Stop loss

During these operations since last test was made in visual mode, I also considered to enlarge the amount pips take profits. Basically, everytime the signal is right, price goes further than the 40pips target, but most of times it reverses after 50-55 pips, while stop loss seems to be correct. See the example:

So, for the moment I enlarged the target to 45 pips, obtaining a R/R of 1:2,5. Time for a new test.

New test

Here are the results:

The situation completely reversed! With some quick arrangement, the strategy returned “only” 68 losing positions, and a total of 44 winning ones (40%).

Another crucial aspect is on the overall behavior of the strategy during the 3 months test, causing a max equity drawdown of 25% which, considering the position size is fixed to 1mln and it is not calculated in terms of % risk, is a great result.

Positions analysis

Considering all the good results I obtained in last test, I decided to continue in analyzing deeper the situation and understand what could be next steps to obtain an even better result. In this case, the visual test becomes extremely important: I want to understand what are main events causing the 68 losses.

Studying the chart I came to some important facts.

First of all, there are some missing positions! I mean, in some cases the strategy did not even open the position, look the example picture:

As you can see price is in trading time, and reached the red EMA but there is no long position open. Since the profitability is very high, even 1 single position is much important.

Second, there are particular situations where price prints a lot of spikes, without clearly changing direction. This is a very well known event! All these particular situations, can be summarized in 3 cathegories.

: here we see how price is trying to turn up causing 3 losses in a row, followed by 1 profitable one.

Speaking in statistical terms, this actually is almost a breakeven but I can't deny that 3 losses in a row are quite scary when considering to put such a strategy in a live account.

Second: there is a congestion of factors with both losing (3) and winning (3) trades.

This could be considered a positive event since returned an huge profit, while it is really not!

The reason is simple: we are back-testing! What if price reversed 3 pips before the target?

Third: we see the beauty of the strategy and 1 of the reasons why I will keep on trying to stabilize it further and deeper.

When price bounces off the slower EMA, there is always potential for a good bounce, despite the fast timeframe.


During last days I tried some different setups (larger stop loss, hedging position...) but all of them returned worse results. So I actually decided to:

  1. Run the strategy in demo forward test: I want to understand if the “missing position” event is an issue related to the back-test data or if it is about a mistake in the code.

  2. Analyze if the introduction of another indicator will help to avoid 2 – 3 or even 4 losses in a row.


This simple EMA-based strategy gives good results with interesting drawdown and profitability data. It can be used both in manual and automated trading, and can be implemented in many different subjective ways. During next days I will keep analyzing and trying new solutions in order to obtain even better results, and I will expose them as soon as I will be ready (hopefully before month ending).


I made the code free and downloadable from Dukascopy forum, so anyone can use it to test in different setups and eventually implement with some additional arrangements. In the page I also added a test showing 7 months results, where still the strategy shows good ending equity, meaning a very interesting opportunity.

I strongly reccomend to setup the smallest size possible (0.001mln) if used in a real account because it is not yet optimized for real trading since is missing anything money-management related. I'm not responsible of your loss, consider yourself advised.

I hope people will find my work interesting, feel free to comment and ask/propose anything you want here in the comments section or via PM.

Thank you for reading.

Translate to English Show original