| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Simple Shelley Backtester https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=606 |
Page 1 of 6 |
| Author: | garyfritz [ Sun Jun 03, 2012 7:52 pm ] |
| Post subject: | Simple Shelley Backtester |
Anyone who's put up with my ravings long enough knows I am singularly unimpressed with forward testing as a way to verify an EA. Run an EA for 2 weeks (which is longer than many do) and you know how it performed in those two weeks. I want to know how it behaved over a lot longer period than that, and I want to be able to test different inputs and different code. I want a good backtest. Empty4 has Strategy Tester. Nobody trusts it but it's slightly better than nothing. But ST can't test a multi-pair strategy like Shelley. Neither can Tradestation, my go-to backtester. EAs can't backtest it because they only execute in realtime. But indicators CAN. As an experiment I took Simple Shelley 1t and converted it to an indicator that tracks trade profits. I dump the results to a file, and transfer those to Excel for plotting. These are VERY PRELIMINARY results -- it took much longer than I anticipated to mash the EA into indicator shape, and I have some other commitments that mean I won't be able to spend much more time on it for a while. I think they're correct (or close), and I wanted to share them so we could get a better idea for how Shelley performs. I based this on Simple Shelley -- and I can't use MPTM on an indicator -- so these tests currently have only a 20-pip adaptive TP and a 30-pip adaptive SL. No jumping stops, no timeout, no nothin' except TP and SL. So one would hope we could improve upon these results. So how'd it do? I ran it on M15 charts to get reasonably accurate execution, which limited me to 3 months of tests. Since it runs only once every 15 minutes, it is NOT totally accurate -- the basket might have touched the TP within the M15 candle and then reversed, and you wouldn't see that. M1 would have been better but I have only 6 weeks of M1 data. Here are the results, with 4 different basket-open times: Profits are in pips. I included 0400 GMT (blue) because that was the default value (default BasketSendHour is 7, and I'm on a GMT+3 crim) and it turned out to be the best performer. Interesting things to note: * London and Sydney opens did about equally well. Both of them and NY started out losing in March, then LON & SYD took off in late March. * NY open did pretty poorly, hitting about 55% wins, though it has made over 3000 pips in the last month! * If you'd opened up a basket at LON, NY, and SYD opens, you'd have taken nearly a 5000-pip drawdown in March -- but you'd have made over 10000 pips since then! * If you'd also added in the 0400 GMT basket, your DD would have been around 4000 pips, but you'd be up over 15000 pips since then! I want to test what it would look like if you opened a basket every hour... or better yet, what happens if you open a new basket as soon as the old one closes. So Shelley looks pretty promising in this test. More importantly, this proof-of-concept shows that we can use Empty4 to backtest at least simple EAs. I hesitate to post the tester just yet because, frankly, it's a mess. I tried to minimize the changes to the EA, isolating the "tester indicator" changes so it would be easy to apply them to other EAs, but it turned out not so easy. There are EA-specific things scattered throughout the code so I ended up making changes all over. Other things to do: * Clean up the code some * Add jumping stops and a few other features * Get a long history of M1 data on all symbols so it can accurately test more history * Test different TP, SL, JSL values * See what times of day perform the best * Test open-a-basket-every-hour trading and continuous-basket trading * Enhance the indicator to plot a single-page equity curve and some performance stats * Extend the EA logic to test the "open pair X when its slope goes > 0.8, close it when it goes < 0.7" idea * Test individual pairs and see if some pairs work significantly better or worse than others Steve, if you see the value of this, I (and/or probably some of our other hard-core coders) would volunteer to design a set of library calls to provide the functions you're used to using -- looking at the current price, placing orders, querying orders, etc. Then you could call e.g. SHOrderSend instead of OrderSend, and the EA library would pass it on to OrderSend. But then you could just change an "#include <EALibrary.mqh>" line to "#include <TesterLibrary.mqh>", and shazam you can backtest your EA. I think that would be possible with minimal interference to your normal coding style. That's the only way something like this is practical. It's a BIG job to convert one of your EAs to this testing approach, and by the time I get it working, you've probably already posted 3 new releases. If you're willing to make this change, it will IMHO HUGELY increase the value of the EAs you develop, and save untold hours forward-testing EAs or parameter sets that ultimately don't work out very well. This changes the current "keyhole view" of EA performance to a broad landscape. I think you'd like the view. |
|
| Author: | alex_forex [ Sun Jun 03, 2012 8:51 pm ] |
| Post subject: | Re: Simple Shelley Backtester |
Awesome Gary Thanks for your lights Cheers Alex |
|
| Author: | michaelhryu [ Sun Jun 03, 2012 10:50 pm ] |
| Post subject: | Re: Simple Shelley Backtester |
Hi Gary! Thank you very much for sharing your test results!! Very intersting, indeed. I have the following questions: 1. Have you taken DST into account? 2. Do you use your local (computer) time, or broker time? |
|
| Author: | garyfritz [ Sun Jun 03, 2012 11:50 pm ] |
| Post subject: | Re: Simple Shelley Backtester |
That's a very good question, since the test spanned DST and non-DST times. Those times are absolute GMT times, 3 hours behind my crim. I probably shouldn't have said they were "GMT" because the crim runs at GMT+3 during DST, GMT+2 during non-DST. So 00:00 crim time always corresponds to 5pm NY time, DST or no. It's my understanding that all FX times worldwide are based off NY time, DST or no, but I'm less sure about Frankfurt/London/Sydney/Tokyo. I believe their start times are also based on NY time, so their local-time start shifts depending on NY DST and local summer time. I think it's always true to say London starts 5 hours before NY, and Sydney starts 9 hours after NY. Can anyone confirm? 00:00 crim time = 17:00 NY = NY close time. NY opens 9 hours earlier (8am - 5pm NY time) so the NY open is 00:00 - 9 hrs = 15:00 crim time. So I should have started the NY test at 15:00 crim time = 12:00 (currently) GMT. London open is 5 hours earlier = 10:00 crim time, Sydney is 9 hrs later = 00:00 crim time, which is also NY close time. Please DON'T take these numbers as gospel, as I'm still debugging and verifying this tester, and I'm sure there are still errors. But I think the overall picture is correct. Here is a chart of profits over the last 3 months vs. basket-open time (crim time). It says nothing about how smoothly the profits grew or what drawdowns you suffered, only the total profits over that period. From this test, at least for the last 3 months, it looks like anytime around the NY open is a TERRIBLE time to open a basket. It's at the very bottom of a bad-performance range. Anytime from about 22:00 - 12:00 crim time (13:00 - 03:00 NY time) is good, but 12:00 - 22:00 (03:00 - 13:00 NY time) should be avoided. (However notice from my chart in the first post, NY has looked just fine since the start of May. You might have been testing it very profitably for the last few weeks but over the last 3 months it did badly.) |
|
| Author: | michaelhryu [ Mon Jun 04, 2012 3:33 am ] |
| Post subject: | Re: Simple Shelley Backtester |
Hi Gary, Thank you very much again for your detailed answer! My broker, FXDD, is also a GMT+3 currently. And I am in California; PST is GMT-7 during the summer, of course. Is your local time GMT-5 or GMT-6, please? Just for curiosity. |
|
| Author: | monkeh [ Mon Jun 04, 2012 3:42 am ] |
| Post subject: | Re: Simple Shelley Backtester |
Gary, unbelievable! if you to continue with library code and steve will implement it in his EA, i can start pulling in tick history data for 3-4 years if help is needed to do the backtesting. |
|
| Author: | stimpy [ Mon Jun 04, 2012 3:52 am ] |
| Post subject: | Re: Simple Shelley Backtester |
This is awesome Gary. With you all the way on this one. |
|
| Author: | garyfritz [ Mon Jun 04, 2012 4:12 am ] |
| Post subject: | Re: Simple Shelley Backtester |
Thanks for the kind words, guys! Michael, I'm in Colorado -- GMT-6 in MDT, GMT-7 in MST. More importantly for FX, I'm at NY-2. |
|
| Author: | mackaozy [ Mon Jun 04, 2012 6:36 am ] |
| Post subject: | Re: Simple Shelley Backtester |
Hi Gary Thanks for your hard work doing this it's great information. With regard to the London open we are now in BST (British Summer Time) here in London, which is GMT+1. So for 2012 start of BST (clocks go forward so to goes to GMT+1) is 25th March End date of BST (clocks go back so it goes back to GMT) on 28th October. These dates will change every year by a few days. London open is always 0800am UK time no matter what time it is in NY so this will vary when we have BST or GMT here in London. Thanks |
|
| Author: | fxozgirl [ Mon Jun 04, 2012 7:28 am ] |
| Post subject: | Re: Simple Shelley Backtester |
Hi Gary, thanks for your hard work on this testing...it's very encouraging with what you've done so far. In regards to Sydney opening 9 hrs after NY...Sydney is actually the first market to open each week, so (and I've probably got this completely wrong), by setting Sydney 9 hrs after NY, you are missing one session a week???? Hmmm...I might be completely confusing this, so sorry if I am |
|
| All times are UTC | Page 1 of 6 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|