Why backtests are useless, EAs are flawed and their parameters are bad [DISCUSS]

Darwin

Trader
Oct 22, 2013
7
0
17
Hi, I am Darwin and I am new here.

tl;dr In the next weeks, I am planing to release my private Walk Forward Analyzer, but before I do this, first I want to make sure that also the beginners in mechanical trading understand why common backtests are quite useless and why walk forward analysis is better in so many ways, so I decided to start this discussion.

I WILL RELEASE THIS TOOL FOR FREE AND OPEN SOURCE!

And as people keep asking why I release free stuff and why I post this thread on multiple forums (actually, I want to post it on all of them, so tell me if I have missed one), let me explain my motivations:
I am targeting a job in the trading-economy, and this is not easy to get. Beeing known in the community would help me a lot to accomplish this goal, so I decided to release some of my private tools for free and/or open source to make myself a name over the next months. I am not here to sell you stuff, keep that in mind, please!


For the record: I do not claim that WFA is the holy grail in system testing, but I argue that it is way better than normal backtests.




THE GENERAL APPROACH TO SYSTEMATIC TRADING

Take a trading logic => Generate an EA that trades exactly like it => Optimise Parameters => Do a backtest => Trade it live => $$$

BUT: Everybody that has ever had an EA that was a money-printing machine in the backtests (and this is very, very easy to be done), knows that a good backtest does not imply profitable live trading.
And that is the problem. We need a test-method on whichs evaluation we can rely!




STATEMENT 1: Your parameter choices are not good

Well, every EA consists of 2 things:

1. the logic/script itself
2. the parameters (like periods for moving averages, stop loss values etc. Just everything that can be adjusted!)

The first thing is static and "given". And a lot traders only focus on this part.
But, an EA can behave in very different ways, depending on the parameters. And there can be billions of possible parameter-combinations (=parameterset). There are 3 approaches to determine the parameterset for live trading.

1. the intuitive approach (non adapting):
The trader just chooses the parameters based on his expert knowledge.
But, there are just too many possible parametersets. You can't just "guess" them without evaluation and testing.
It does not matter how good you are, you are never good enough to "think through" this huge amount of possibilities in a reliable fashion!

2. the "optimise on all data" approach (non adapting):
The trader chooses the parameters based on all past data.
So, the configuration/parameters that worked best for the last 12 years, for example, are chosen to be traded live.
But, to stay up-to-date it is not a very good method to optimise the parameters on so much and therefore OLD data.
Because the market today is not the same as it was 12 years ago.

3. the "optimise on the last few years" approach:
The trader chooses the parameters based on the last few years of data.
But you can not just take this approach without testing how this "optimisation method" would have worked in the past.
And this is exactly what a walk forward analysis will do: "Optimise on the last few years", but it tests this approach on all data in the past!




STATEMENT 2: A non-adapting EA can never make longterm profits

I mean, there is an infinite amount of possible trading-systems AND an infinite amount of ways the market can change AND an "infinite" amount of possible parameters for your trading-system.

Considering this, would you really want to bet money on the fact that you have a trading system that will always work, in the same way, without adaption, on all future market conditions? I would not.

"But why shouldn't I be able to put a traders knowledge into a script and trade it?"
Its simple: A trader always learns, he takes input from many sources, he has knowledge about the markets and therefore he adapts his trading strategy so he can always be as close to the markets as possible.
A simple EA script can't do this, a Walk Forward Analysis can (to some extent).

Reason #1 why there are many "profitable" EAs out there
The EA really works, it has a sound strategy and was developed properly. But the markets always change, and they can change in infinite ways.
So, at some point, the traded market-inefficiency WILL(!) change, and the EA can not adapt to this change and therefore will lose its profitability.

Reason #2 why there are many "profitable" EAs out there
is that some of them, sound or unsound systems, are just lucky.
If you send 10.000 people to a casino and let them play for a while, just due to chance, some of them will make profit over some time.
The same is for EAs, if there are enough of them, some will really make profit (even if they are in fact useless).
But as they keep trading, they will lose, as the probabilities are against them (same as in a casino).

Reason #3 why there are many "profitable" EAs out there
is the huge risk some EAs take (grid trading, martingale systems etc).
These EAs take very huge risks to make small profits. But somewhen, the risk strikes, and at that point, the EA will to lose (all) money.

Reason #4 why there are many "profitable" EAs out there
is the small timespan on which they are profitable. Its no magic to make profit for months, but its hard to make it for many, many years.




STATEMENT 3: A backtest does not tell you anything about the future performance

Well, don't get me wrong, I strongly hold the opinion that simulations on the past are the only way to really test a trading system.
But what does a backtest tell you? Just that your system performed well on the past.

But is trading really about having a system that represents the past?
No, trading is about designing a system on the past and then trade it in the future.

THIS IS A FUNDAMENTAL DIFFERENT QUESTION THAN WHAT A BACKTEST CAN TELL YOU!
You want to answer the question "how good is my live trading performance" with the answer to the question "how good did my system perform in the past". That logic is flawed, of course.

"But if I use out-of-sample data to verify my backtest..."
Out of sample testing is a good idea. But you only have one optimisation-dataset and one test-dataset, which is not very reliable. Walk forward analysis, somehow, is out-of-sample testing on steroids. It uses the same method, but generates 10-1000 opti/test dataset-pairs.

"So, are all backtests useless?"
No, it can help you to get sound and good trading systems, if done right.
But my point is that a good performance in a backtest does not make sure the system is also good in live trading.

Trading is a game of probabilities, and the probability that an EA is profitable, only based on a good backtest, is very, very low.

"But why should a system that performed good over the past simply stop working"
The main reason is, and that might be the most important one, OVERFITTING.
That means, the EA tackles an "random" inefficiency of the market that was just there in the past, but that was no real thing.

I found a very good picture that explains overfitting:

CIqiSuF.jpg


You see? There are infinite of such useless "relationships" in the price data, and most EAs tackle one of them which gives them very good backtest results, but that was just due to luck, and these "relationships" will not hold in the past.
And as there are a lot more of these overfitted solutions than sound ones, the chances are very high that you optimised towards such an overfitted system.

The other reason is that the markets always change. So even if you have a non-overfitted, good performing backtest, you will run into serveral problems that you can read in Statement 2



THE SOLUTION: WALK FORWARD ANALYSIS

A Walk Forward Analyser is an external program that can take EVERY EXPERT ADVISOR and, using Metatrader4, do the analysis.
SO YES; YOU CAN CONTINUE TO USE YOUR ALREADY WRITTEN EAs!

Well, some of you will already know how a walk forward analysis works. For the others here is a short overview, as I will explain the process in more details in a future thread.

A WFA takes, for example, the data from 2000 to optimise your system, then tests it on 2001 (which is, from the point of optimisation, the "future" or "live trading").
Then it walks forward and optimises the system on 2001, test it on 2002. Then optimise on 2002, test on 2003 etc.
Do this until you walked through your whole data and only consider the "live trading" in your evaluation.

You see? With this simple tactic you can tackle the 3 problems I have described above, the lack of adaptability, the need for a evaluated parameter selection process and the uselessness of a "past-performance"-backtest.


And then, when you want to trade the system live, you do the exact same thing that you have tested:
1) Optimise on the last available data, with the same optimisation settings you tested in WFA
2) Trade it in the future, with the same procedure you tested in WFA

And that is the main difference to normal backtests: YOU TRADE YOUR EA IN THE EXACT SAME WAY AS YOU TESTED IT!!!



So, this is what I wanted to say, now feel free to tell me what you think about this topic, please :)
- Darwin
 

Darwin

Trader
Oct 22, 2013
7
0
17
Come on, no opinion on this fundamental topic at all?
No experiences or thoughts to share?

-Darwin
 

Enivid

Administrator
Staff member
Nov 30, 2008
19,201
1,499
144
Odesa
www.earnforex.com
I don't see how the proposed forward optimization model eliminates the curve fitting problem. It still fits the input parameters to the latest available curve, which isn't necessarily representative of the future market.
 

Darwin

Trader
Oct 22, 2013
7
0
17
I don't see how the proposed forward optimization model eliminates the curve fitting problem.

First of all, curve fitting is not just a problem of fitting too much.
You could take a random trading strategy, evaluate it on, lets say 2010-2012 and then most of the profitable ones would be "overfitted", meaning they would not make profit on 2013. (I once tested this using a few hundred algorithmic generated strategies)

It still fits the input parameters to the latest available curve, which isn't necessarily representative of the future market.

Yes, and we WANT to fit the input parameters to the latest available curve, as it is the best bet that the characteristics of this curve will go on in the future, and its also the only dataset we can work with. (best bet != certain)

And finally thats EXACTLY what a WalkForwardAnalysis is there for, to measure if and to what extent a given strategy, fitted on the latest curve, is representative of the future market.
And it does so by making ~100-150 of these "adapt on the latest curve, test on future market" tests.

Hope that makes it clear :)

Tough, WFA is no holy grail, and there is no guarantee that the traded inefficiency will hold in the future, but thats a different problem, eliminating not-working strategies.

But to test a strategy's ability to model meaningfull inefficiencies in the future markets based on the last available data, it is at least a lot better than a backtest.

-Darwin
 

hayseed

Master Trader
Jul 27, 2010
1,142
273
149
usa
Why backtests are useless, EAs are flawed and their parameters are bad [DISCUSS]- Darwin
//-----

lot of words in that first post......

//-----

Come on, no opinion on this fundamental topic at all?
No experiences or thoughts to share?

-Darwin

//-----

my thoughts and experiences suggest your threads title is incorrect on all three points......

backtests, ea's and parameters are something i use every day......h
 

Darwin

Trader
Oct 22, 2013
7
0
17
Well, I do not want to say that backtests are completly useless.
If you are a good trader and know exactly how to avoid curvefitting, how to choose robust parameters and where the dangers of a backtest are, you are of course able to get some good parameters for livetrading with it.

Tough, I argue that a WFA is better because it is more reliable, as it is very easy to get good backtest-results with an crappy EA that would never work, but it is quite hard to get good WFA results with such an useless EA. :)

Also, it can test your "optimisation & parameterselection" method on a whole decade, only taking 1 minute to set it all up - which makes it a lot more convenient. :)

Btw, did you read my thread? Because I never say that "backtests, ea's and parameters" are useless, I just say that a backtest is a dangerous method to optimise parameters for an EA ;)

-Darwin
 

hayseed

Master Trader
Jul 27, 2010
1,142
273
149
usa
hey darwin..... let's try this a different way......

the threads title states , Why backtests are useless, EAs are flawed and their parameters are bad [DISCUSS]- ,
//----

my comment was.....

my thoughts and experiences suggest your threads title is incorrect on all three points......

backtests, ea's and parameters are something i use every day......


or in other words....

my backtests are useful to me, my ea's sometimes go many months without a single loss, and all parameters are very well thought out......h
 

Darwin

Trader
Oct 22, 2013
7
0
17
hey hayseed,

ok, then of course you are right, never wanted to claim they are 100% useless for all traders. Just wanted a provocative title to start a discussion :)

Nevertheless, I claim that a walk forward analysis would help you find good EAs/parameters in an easier and more reliable fashion, no matter how good you are using backtests to optimise your parameters :)

The better you can handle normal backtests - the better your WFA results will be!

-Darwin
 

Emibluz

Banned
Aug 22, 2013
165
0
27
"But why should a system that performed good over the past simply stop working"

I think I understand why; earlier on while trading on a demo account my EA was such beautiful robot software; I enjoyed it. But on moving to live account, things changed. Even some colleagues that were on EA with their licensed brokers complained bitterly like we have been trapped in; the AFFILIATE link bottom doesn't show and can't tell me previous upsells indicating it is bugged. But why should my regulated broker scam me? What is next? Going offshore for more transparent competitive trading operations.
 

Darwin

Trader
Oct 22, 2013
7
0
17
I don't know what happened, but did you try to make very frequent trades, fast in, fast out on, small timeframes? With small profit targets? So skalping or similar stuff?

-Darwin
 
hey darwin..... let's try this a different way......

the threads title states , Why backtests are useless, EAs are flawed and their parameters are bad [DISCUSS]- ,
//----

my comment was.....

my thoughts and experiences suggest your threads title is incorrect on all three points......

backtests, ea's and parameters are something i use every day......


or in other words....

my backtests are useful to me, my ea's sometimes go many months without a single loss, and all parameters are very well thought out......h

Would you like to show proof?

Proof is he lost all his money then?
Joined Oct 22, 2013
Last seen Feb 20, 2014