+ Reply to Thread
Results 1 to 7 of 7

Thread: MQL5 Range Breakout Systems

  1. #1
    Administrator Jim's Avatar
    Join Date
    Apr 2010
    Location
    South West England
    Posts
    383

    MQL5 Range Breakout Systems

    Following a discussion on LinkedIn I've ported our simple MT4 "Turtle Trading" robot to an object oriented MQL5 version. I've taken the opportunity to add in some money management code for good measure. Here's the result of our first backtest:

    GurooEx04-EU-W1-11-4-MM2-10.png

    To summarise the results: 52% profitable trades, profit factor 1.94, Sharpe ratio 0.29, max. drawdown 30%

    This was performed on a weekly chart of EUR/USD going back to 1999. We used the Turtles standard "slow" settings of entering on an 11 week breakout, and exiting on a 4 week breakdown. Money management was set to risk 10% of the account on each trade!

    Here's the source code:

    GurooEx04.zip

    If you discover any bugs in it or you have any other suggestions please let us know either by commenting on this thread or by using our contact form.

    Thanks,

    Jim
    Reality is merely an illusion, albeit a very persistent one - Albert Einstein

  2. #2
    Junior Member Mintaka's Avatar
    Join Date
    Apr 2010
    Posts
    29
    I am just wondering why on a weekly chart? Just a random choice?
    If you keep your mind humble, pride will vanish like morning mist - Dilgo Khyentse Rinpoche

  3. #3
    Administrator Jim's Avatar
    Join Date
    Apr 2010
    Location
    South West England
    Posts
    383
    Hi Mintaka,

    Long time no see! How's things going?

    It wasn't a random choice exactly. MT5 now allows you to backtest using weekly or monthly bars, so I thought I'd give that a try on a long term system. One of the standard turtle settings is 55/20 daily bars, so I went for 11/4 weekly bars instead.

    The results are intriguing, don't you think?

    Cheers,

    Jim
    Reality is merely an illusion, albeit a very persistent one - Albert Einstein

  4. #4
    Junior Member Mintaka's Avatar
    Join Date
    Apr 2010
    Posts
    29
    Hi Jim, I did the back test using your MQL5 version.
    My results are: 52% profitable trades, profit factor 1.77, Sharpe ratio 0.26, max. drawdown don't know.
    This was also performed on a weekly chart of EUR/USD from 1999.01.03 till today 2011.06.06.
    It looks similar more or less. I also used the same setting of entering on an 11 week breakout, exiting on a 4 week breakdown. I will try the back test on Math calculation and on 1 Min OHLC.

    We used the Turtles standard "slow" settings of entering on an 11 week breakout, and exiting on a 4 week breakdown.
    Here is the graph.
    M5USDEURTesterGraphReport2011.06.06.jpg

    I also tested GBP/USD less promising - the same setting.
    If you keep your mind humble, pride will vanish like morning mist - Dilgo Khyentse Rinpoche

  5. #5
    Administrator Jim's Avatar
    Join Date
    Apr 2010
    Location
    South West England
    Posts
    383
    Hi Mintaka,

    Thanks for the extra info. I'd hazard a guess you had the Money Management Method set to the default of zero (i.e. fixed lot size)? My test had MM=2, plus 10% risk!!!

    My D/D number was from the Equity Drawdown Relative box.

    Cheers,

    Jim
    Reality is merely an illusion, albeit a very persistent one - Albert Einstein

  6. #6
    Junior Member Mintaka's Avatar
    Join Date
    Apr 2010
    Posts
    29
    Hi Jim,
    You guessed very correctly. The Money Management Method was set to zero.

    Here some new graphs of the new tests. The same setting with the single difference the change of the tick quality.
    The first graph is on 1 minute OHLC and the second on the open prices only.
    MQM5TGR2011.06.071minOHLC.jpg

    MQL5 USDEUR TGR 2011.06.07open price only.jpg


    It went very quickly, both of them. I also tried on Math calculation but didn't work. I mean it didn't allow me to start the back test. Any idea why not? It looks like the the tick quality setting of MT5 isn't compatible with the MQL5.
    Last edited by Mintaka; 06-07-2011 at 05:08 PM.
    If you keep your mind humble, pride will vanish like morning mist - Dilgo Khyentse Rinpoche

  7. #7
    Administrator Jim's Avatar
    Join Date
    Apr 2010
    Location
    South West England
    Posts
    383
    Hi Mintaka,

    Math calculation mode doesn't actually do a backtest at all. Here is what the MT5 manual says about it:

    This mode allows you using the Strategy Tester for mathematical computations. It does not require and therefore does not load historical data and information about symbols, and it does not generate ticks. In the tested Expert Advisors, only OnInit(), OnTester() and OnDeinit() are called sequentially.
    I've never tried it, but I think the idea is that it allows you to use the MetaTrader 5 genetic optimiser for solving mathematical problems that are potentially nothing to do with forex trading.

    Your first graph seems to suggest that using M1 OHLC to speed up a long optimisation run wouldn't adversely affect the results too much, which is good to know. For your second graph the manual says:

    In this mode, OHLC prices of minute bars are also generated, but the Expert Advisor is started only at the beginning of the bar (at the Open price) that corresponds to the selected testing period.
    I think it means that in this case it only generates one tick a week! That would explain why it looks so different to the others.

    Cheers,

    Jim
    Reality is merely an illusion, albeit a very persistent one - Albert Einstein

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts