I have been programming my own automated backtesting script in PHP MySQL for the past 3 months, mainly because PHP is my thing but also because don't see how the common software can automatically run thousands of tests while I'm away. I have imported all the currency pairs in every timeframe from tickstory. I programmed a crossover strategy which executes via cron every 3 minutes. A currency pair, timeframe, stop loss, take profit and/or trailing stop is generated randomly.
This strategy executes via these rules:
buy (once) when ma50 > ema20 and ma50 > ma200
sell (once) when ma50 < ema20 and ma50 < ma200
Closes sell when new buy signal, closes buy when new sell signal.
So far after a couple of thousand runs the results are pretty much depressing. 😞
My best testrun was with USD/JPY H1 over a period of 10 years and 7 months:
- 2020 trades
- stop loss 26
- take proft 130
- win streak 4
- lose streak 21
- 1% risk per trade based on stop loss
- 21.83% wins
- 0.23% equitygain per week
- profit factor 1.08
I do get much better individual results with some other pairs in a D1 timeframe, like a profit factor of 4.50 but that only generated 80 trades in 10 years so I would have to increase the risk per trade to generate anything significant.
I think I can program just about everything now. If anybody has any advice what my next 10000 strategy runs should be about I'd be very happy to start programming something new.
My ultimate goals is to create something that generates 1 or 2% equity growth per week with a maximum drawdown of 10%.
Love the idea! I'm a programmer myself (although more C# and VB web applications), and I've written a few EA's over the last 3 years. Always chasing that one system that works on any pair, any time-frame.
What you are trying to do is very difficult. The first challenge is working with ANY indicator. Technical indicators like MA's are lagging and will give you more false signals than actual profitable trades. The reason for this is simple. Forex markets are consolidating +- 70% of the time. If you use any trend indicator, like MA's, you will get false signals about 70% of the time. And when markets eventually break out and move, you get your entry late (lagging indicator) and this result in small profits, or even losses.
I've even tried using MA's on multiple time-frames to catch the bigger trends. It works better but you are still stuck with the '70%' where you get false or mixed signals. What I found works for me is using price action and market structure to formulate (a) range-bound and (b)breakout strategies. To maximize profit potential you must cater for the 70% with a range-bound strategy and the 30% with a breakout strategy.
From time-to-time, in my local area (Garden Route, South Africa) I teach people how to trade forex. I've added a few screenshots of how I explain how forex markets are typically is structured, and some examples on how I use price action to make trade decisions. Not trying to sell you anything, I just thought it may give you an idea of what I mean. I found this approach to work better than relying on indicators alone when I code an EA. Not saying my method is the best, just that it gave me better results.
Another tip I can give you that worked for me. I also used fixed SL TP levels in the beginning. I used to calculate dynamic lot sizes based on a maximum risk % of my free margin. But I found this does not work for all currency pairs, and again it can mess with your results when markets are trading sideways.
So the best solution was to wait for entries around key support/resistance levels, and using a max risk% per trade to calculate my lot size, I then used the Daily ATR (Average True Range, e.g. 1xATR) to calculate the SL, which is then placed below/above the support/resistance level. To determine the TP level I search for a support/resistance level at least 3x SL, for a 1:3 Risk/Reward Ratio.
This approach works on any time-frame, any pair... but essentially it is a swing-trading strategy, so you get better results on 15mins to Daily.
Hope this help man, and good luck with developing the automated back-testing system. I think it's a great idea.