LTOptions at a 33% discount during the Year End Holidays.
Tell me More

BookingAlpha Option Trading Advisory

Sunday, April 20, 2014

50 Day Breakout system with 50 SMA - 100 SMA crossover confirmation

An automated system for trading currencies and futures.
I was recently contacted by a reader that specializes in currencies and commodities who trades a large portfolio. He has been successful over the years trading a very simple breakout/trend following system which he wanted to have automated and back-tested. In return for my efforts automating it and back-testing it, I would get, well, the system itself. And because neither him nor I believe in trading secrecy or selling systems, we decided to share it here on the site for free with the world. Thank you Pavel for your contribution.

The strategy
The system operates on the daily time frame based on closing price information.

Long entries are only allowed if the 50-day moving average is above the 100-day moving average.
Short entries are only allowed if the 50-day moving average is below the 100-day moving average.
If today’s closing price is the highest close in the past 50 days, we buy.
If today’s closing price is the lowest close in the past 50 days, we sell.

Extremely simple entry rules, although counter intuitive: Buy high to sell higher! Most traders operate on the principle of buy low - sell high. So, buying something that is already high is definitely mentally tough for many out there.

Stop loss and position size
The stop loss is adjusted according to the volatility of the instrument. That is, if the instrument is going through a volatile period, as measured by the ATR(100), then the stop loss distance will be greater and vice versa. The initial Stop loss is placed 3 ATR(100) below entry price for a BUY trade, and 3 ATR(100) above entry price in a SELL trade.

The position size is dynamically calculated in order to keep a constant risk% per trade. The larger the stop loss, the smaller the position size, so that if hit, the loss is the same as in any other position with a smaller stop loss distance and greater position size.

Having a dynamic stop loss and a dynamic position size, make the system flexible and adaptable to changes in the volatility of the instrument, and this is vital for its survival over the long run.

Target profit
There is no target profit! The goal of the system is to follow a trend for as long as possible. How does it do that?
Well, a long position is closed when price has moved three ATR units down from its highest closing price since the position was opened.
A short position is closed when price has moved three ATR units up from its lowest closing price since the position was opened.

So, this 3 x ATR rule that defined the original Stop Loss, is also used as a Trailing Stop mechanism. But it doesn't follow the absolute highest or lowest price reached as the typical trailing stop does. It only follows closing prices.

That's it! The % risk per trade is defined by the trader, and that number will automatically define the position size in lots for each trade in particular.

Back test results
I ran a test on the EURUSD currency pair using 3% max risk per trade.
First from January 1, 2000 to January 1, 2010
(Click on images to enlarge)

And then an Out of sample testing from January 1, 2010 to November 14, 2012.
(Click on images to enlarge)

The system is definitely a profitable system with a pretty smooth equity curve pointing in the right direction. Unfortunately it doesn't trade frequently, with only 3 - 4 trades per year. Of course it can ride a trend for weeks or even months. So, its time in the market is not insignificant, but the number of entries is small which will limit your returns. Because of that, Pavel trades this strategy in a portfolio of different instruments so he gets more signals in total. According to him:

"I trade it successfully on all futures, hence I have far more trading signals per year. Of course, you can talk about it on the website. You can mention that I trade it on all futures, not only currencies."

I thank Pavel for his contribution to the site and his willingness to share his success. Real profitable traders for the most part don't believe in system secrecy or not sharing their systems. They know that's only a part of the equation. Discipline to follow it, and the right psychological mindset ultimately will define success or failure.

Here's the link for you to download the ex4 robot. You will also get the source code in MQL language so you're free to inspect and modify as you like.

Download 50-Day Breakout system

Needless to say, you should do your own due diligence before using this system. I haven't tested it on all currency pairs let alone futures. It may not work for every instrument, and in others you might need to tweak the settings here and there.

Results - 2014
Results - 2015
Results - 2016

Related Articles:
Moving Average crossover Indicator for MetaTrader
LT Trend Sniper - a Forex strategy that works
The Turtles Trading system automated (Expert Advisor for download)
Design of a EURUSD Donchian breakout strategy with proven statistical edge
Forex Rebellion doesn't work

Go to the bottom of this page in order to see the Legal Stuff


  1. If you trade it on all futures like currencies, equities, metals, energies, softs, grains and rates, you can achieve CAGR of 20% with 25% drawdowns. You can use a little bit different modifications like ATR of 3.5 units, etc. I trade successfully the system mentioned above and most of portfolio managers, I know, trade very similar system. It is exactly what I get every year - 4 to 6 trades per instrument. I trade around 20 markets, it equals around 100 trades per year.

    You can trade it on more than 20 markets, but if you look at correlation matrix, you will see that the rest of futures markets correlate each other - EUR/USD and GBP/USD or silver and gold.

  2. Thanks for all the information and contribution once again Pavel. Very simple yet apparently efficient system.

  3. Hey,

    I'm a 20 year Computer Science major at the University of Colorado who has been investing/trading for a few years now, but as a CS student I'm becoming much more interested in the CS aspect of trading and developing trading systems much like this.

    I have a fairly simple trading system using 20-day and 10-day timeframes and moving averages that I'd love to develop and backtest. Might you be interested in sharing your knowledge on how you go about creating your systems and where to get started for a beginner like me? This is something I really love and I have time this summer to learn!

    Contact me at ,


  4. Hey Binka,

    As for automation of Forex strategies I would warn you that there's a lot of garbage out there and if you are truly a beginner you need to be aware of that so you don't waste hundreds of hours of your life.

    I wrote an article a while ago about useful resources which can be of great help to you.


  5. Hi Lazy Trader !
    Thank you very much for your effort in coding an EA. I saw this strategy in Andreas Clenow's book and it intrigued me. I tested the EA but it only seems to work on USD pairs .. I took a look at the code and although I know close to nothing about coding it seems that you have specified the pairs that it can trade. Can I just add the pairs that I want to trade that don't use USD or will it create some errors ?
    Thank you and have a great week-end !

    1. Hey Armacon,

      You should be able to trade any pair. The issue is that in backtesting mode, you can onlly backtest those pairs that involve the USD. Still, if you are able to redefine the functions, go ahead, that's why I shared the code! It would just take me too much work at this point.


  6. Nice work Pavel. It is true that it takes more than just a successful system to win at trading - you need discipline, focus, attention, etc. etc. Many personal qualities. And then, even if the system is fully automated, there is no guarantee of success as there are many brokers out there with different rules, accounts and systems, and then many different VPS providers with their differences, not to mention the very settings of the EA used! It is amusing and disappointing when folks think they have the only "holy grail" in existence, when in reality there are many successful ways to trade - but it is what suits the individual that matters most.

    So... can anyone answer Armacom's question please?

  7. Nice Work and Thanks !! I would use it for my investing portfolio.

  8. Thank God to honest people like yourselves that share your knowledge, what you know and create that the rest of us can't. You guys seem to be honest and have a desire to help. There is plenty of mony out there and we should help each other as you are. Thank you for that.
    I have beent trading the markets off and on and I am not a sofisticated trader, but lately I have been beaten badly lately. So I started thinking of automating ideas and decided to look for an EA but all I have found is... alot of scams. I just would like to be able to buy...if possible an EA created by honest people like you. Any recommendations of an EA that can help me get back on my feet? I would like to use yours but I need something to trade a bit more....Mario

  9. I have METATRADER 4 charts from

    Can anyone tell me how to apply one of these systems to a chart? e.g. one I have the EA downloaded, how do it transfer it so that it works on my charts?