I have been trading since the last 7 months I managed to apply different trading strategies and tried many trading systems at last i was able to develop my own strategy with which i can feel really safe,this strategy has a good risk-reward ratio.2 months later i converted my strategy into coded form and developed my friend EA.I used strategy tester from 1st April to 22nd with my EA.The strategy tester tells that my EA generated 81$ profit in these 22 days,but when i applied strategy at my own by scrolling the charts i was shocked that this EA nearly generated 350$ in the same days this makes my kinda confused that Is there something wrong with the strategy tester because I didn’t find any mistake in my calculations.Any help?
often when people try to backtest a strategy “by eye” they tend to use information they can see, which was not available at that point in time, when the trade would have been executed in the past. this is very general, but without further specification about your system it is not really simple to give helpful advice.
Actually my system is based upon the cross of two moving averages.I only close my trade when my trade signal is removed by the moving averages.Do’t u think so that the visible information is enough to test it?
I have done something similar, had a developer create 2 EAs for me. I have been a software developer before, but not in MQL4 language. My experience was similar to yours, that when you look at a price chart for a time slice, you think you should get a better result. There were several “unintended consequences” I didn’t take into consideration when I wrote down the logic for my trades. It actually took 3 tries working with the developer to get it better.
One thing I found that when I started, I used a “symmetrical” entry & exit logic. When price closes/goes above the 34 EMA and when the 5 EMA goes above the 34, enter trade. When the 5 EMA goes back down below the 34 EMA exit the trade. (There were some other conditions based on my indicators, also).
I found that an “asymmetrical” exit worked better. Make your exit different than the entry rules. I found that exiting when the price closed below (for a BUY) or above (for a SELL) the 41 EMA it worked a lot better.
Here are a couple of things to try:
- After you have run your test in the strategy tester, click on the Open Chart option. Use the PLUS (+) key to expand the bars to as wide/big as they will go. It should look something like this.
Then look at where you think it should have entered / exited and see if your EA did it correctly.
-
Play with the optimization settings. That is how I figured out that the 41 EMA was the optimum EMA exit rule. If you don’t know how to use the optimizer, post back here & I will walk you through it.
-
Try using a different period, switch it from 1 hour to 30 minutes, or 1 hour to 4 hour. For my 2 EAs, I tested from 15 minutes to 4 hours. I found the best was a 1 hour chart, with the 4 hour being second best.
-
When I tested my BUY EA on the GBP-USD for the period Jan 17,2012 to Feb. 2, 2012, a nice long up trend, here is what it did:
30 minute test -$7.40 (at 0.1 lots) 1 hour test +$75.90 (at 0.1 lots)
That run was from about 1.530 up to about 1.580. If you had just entered a BUY and left it alone, you should have made about $500. The GBP-USD is just “jerky” / “bouncy” enough that my EA did not work well on it.
However, the tests I did on the EUR-USD were much better.
I suspect something similar is happening to you.
Here is the picture of the chart for GBP-USD for Jan 2012:
Steven Currie
You cannot rely on Strategy Tester for accurate results. It does NOT use tick data and typically historical broker data is full of gaps and spikes. Garbage In Garbage Out.
Yupp U get it.I have the same problem.I have already tried those steps which u mentioned in your kind answer.Don’t u think so that we shouldn’t believe on strategy tester any more?
SteveCsd Thank you for your Kind answer.Optimization is not a good thing in fact it really confuses a person and it makes use crazy trying different strategies and systems all the time.Am i right?
You do need to understand how to apply it. Having done software development and testing for many years, one thing you learn is to only change one parameter at a time. If you are working with EMA crosses, only change the numbers in the optimizer for one of the EMAs. Then run your test & see the results. Some people may change more than one parameter at a time. You can run tests with the optimizer and change 2 of the parameters, for instance let’s say you are using EMA and some number related to a stochastic indicator. But I would not test more than 2 parameters at one time.
The other thing to consider is that the optimizer is not going to fix logic that won’t work. It can help find optimum settings for a method or logic that works.
Another way to look at the strategy tester is a first line high level filter. If a method or strategy fails in the strategy tester, it sure as heck is not going to work on a live account.
Optimization can be a powerful tool to learn about which strategies will absolutely not work in live trading but many traders don’t use it correctly. The most powerful tools when using optimization are to 1) use a large sample size and 2) break up the data into two parts: “in sample” and “out of sample.”
Many who get poor results from optimization use all the data to run the test, to find the “best” result or simply do not test on a long enough time period in sample. The result is that the strategy is doomed to failure because often times the best optimized result relied on luck to achieve those results.
The optimization should only be done on the in sample period. The out of sample should only be used to validate systems after they have been thoroughally tested in sample. Once the out of sample data is used for validation, you shouldn’t go back and redo the optimization in sample to improve the out of sample result. That is the same as optimizing over the whole period. The out of sample is supposed to give you an idea of what trading the strategy live will produce as far as results. If you’re interested in this subject, I suggest reading the book “Evidence Based Technical Analysis” which goes into greater detail on the pitfalls of optimization, and how to do it correctly.
Thanks FXEZ i will take a look at the book.Well it seems like some sort of new information to me and i love getting educated.U are right that the best results are achieved by luck through optimization so U are saying that we should cut the whole chart into small periods and then do backtesting step by step seprately with each piece of chart(sample)?
That seems like a legit reason to me I will take this thing in to my consideration.This may take a long time but at lease i will help improving my system.Would u like to share something more about optimization?
One thing I can add has to do with granularity. When optimizing, it is important NOT to use too low a granularity or too high a granularity for the data. Let me explain. If you are testing a range from 10-2000, the granularity or step value might need to be higher with the high values than the low values. For instance from 10 - 20 a step value of 2 may be appropriate, while from 20-100, a step value of 5 might be appropriate, while from 100-500 a step value of 10 may be better then moving up to a step value of say 50 or 100 from 500 to 2000. The reason is that the lower numbers need smaller increments to effectively cover the range, while the higher values need a less granular step value because if you go by a step of 1, over the range from 10-2000 you are opening the door to luck to too great an extent and the results might not be repeatable in the future. If you can’t replicate the results, then what’s the point in optimizing?
I just use two periods: an in sample and an out of sample period, the former for testing / optimizing and the latter for validation (as if it were a live test).
Using multiple periods of optimization then test is more of a walk forward optimization strategy put forward by Robert Pardo in his book “The Evaluation and Optimization of Trading Strategies 2nd edition” that goes in depth on this subject. There is a greater risk with walk forward optimization of over optimizing the data or producing worse results than just optimizing over a longer period then using an out of sample period for validation. In sample is typically 70-80% of the data and out of sample is the 20-30% that remains, but those are not hard and fast numbers. I haven’t found where walk forward optimization has given better global results over using a single optimization/validation but I keep testing the theory.
The reason (my view) you tend to get more stable results using more data is that you don’t end up optimizing for local fits that fall apart out of sample as often as you do when you use walk forward optimization.
Actually i am new in Automated trading and the information looks hard to me.Of course i will take a look at the book and then may be i will be able understand you easily.
can you post this EA?