Why do algorithms stop working? - page 2

 
trustfultrading #:

Hi,

In my opinion, there is one main reason for this. Overoptimization.
You even wrote the problem yourself. "(and a bunch of filters on top of this)".

Yes markets change, but if you have a system that uses the basic market characteristics (reversal, trend, momentum) then the strategy will still work in 20 years. The more you optimize, the more susceptible a strategy is to market changes. So when people write that a strategy doesn't work anymore because of market changes, it's because that strategy has been heavily optimized. That doesn't have to be a bad thing, but then you have to re-optimize the strategy more often.

Traders are constantly trying to create a nice backtest, as soon as the strategy is then traded live, this then behaves differently or in most cases even suddenly makes a loss. In this case, it has nothing to do with the change of the markets. The strategy was over-optimized and over-fitted to historical data.
When I develop strategies, I optimize a maximum of 4 parameters. Better are 3.
You write that your strategy consists of a moving average crossover entry signal. You have already used 2 parameters probably for the period.  If you now add "(and a bunch of filters on top of this)", this is already critical. After that, you might still have an active SL and a TP. Furthermore an extra exit signal?
With so many parameters, I can create the most beautiful backtest in the world for you. But outside of the tested data, the strategy will almost certainly lose money. And this is not because the markets have changed overnight ;D

This is just my opinion on the subject....

I get what you mean with overoptimization. I need to walk forward test more and apply less filters. I have a crossover system and besides that I'm gonna use a confirmation line for entries and a certain RSI (over extended) zone in which not to trade. Then PT and SL and that's it. I also read in a book about algo trading strategies today that it's better to use a limited amount of filters in order to avoid overoptimization. 


I'm gonna go deep now on different crossovers and check on a week to week basis when they work best and how long it takes before they stop working and why. It should give me a lot of insights. 


It's still not very clear to me when you decide if a system is viable enough to apply live and when it's time to call it quits. 


It seems now that the holy grail is to create an algo that adapts itself to every situation based on a set of formulas, but I don't know yet how to create that so that's gonna take some time. 


Thanks for the input so far, all.

 
Danny Verpoorten #:

I get what you mean with overoptimization. I need to walk forward test more and apply less filters. I have a crossover system and besides that I'm gonna use a confirmation line for entries and a certain RSI (over extended) zone in which not to trade. Then PT and SL and that's it. I also read in a book about algo trading strategies today that it's better to use a limited amount of filters in order to avoid overoptimization. 


I'm gonna go deep now on different crossovers and check on a week to week basis when they work best and how long it takes before they stop working and why. It should give me a lot of insights. 


It's still not very clear to me when you decide if a system is viable enough to apply live and when it's time to call it quits. 


It seems now that the holy grail is to create an algo that adapts itself to every situation based on a set of formulas, but I don't know yet how to create that so that's gonna take some time. 


Thanks for the input so far, all.

I think your attitude is great. You are willing to invest time and work to get better.

Personally, I'm not a fan of walk-forward tests. Simply because of the sample size.

You can try the algo which adapts itself. I just optimize my strategies every few years. That is enough for me.

A strategy must pass several conditions and tests before I let it trade live. Then I set a strategy stop loss and a time stop loss. After I have decided to trade the strategy live, I don't touch it anymore. Either it gets stopped out or performs well ;)

Strategy development is not that complicated, but there is more to it than just creating a nice backtest. And I am also constantly still learning and improving ;D


I made two optimizations to show the problem of over-optimization. Hope it helps ;D


 

At the end of the day it boils down to what is acceptable to you? Do you accept a 1 year period of of stagnation or even a loss like on the positive picture of trustfultrading ?

For me personally i know i can not live with that. I will start doubting the algorithm and pull the plug. So i need a at least 100 trades a month before even consider a strategy to put live, that way i know within days or weeks it no longer holds.

Then there is this ever discussion about curve fitting. It is not a bad thing per se. While i agree with trustfull, the less parameters is better, there is nothing wrong with fitting the curve but you DO want to know if the curve you fit held up before and after the optimized period. You need to have confidence it your system in order for you to put it to the real test Live trading. Else you would just have a pretty back test and a product in the market.

 
I can only agree with this ;D
 
trustfultrading #:

I think your attitude is great. You are willing to invest time and work to get better.

Personally, I'm not a fan of walk-forward tests. Simply because of the sample size.

You can try the algo which adapts itself. I just optimize my strategies every few years. That is enough for me.

A strategy must pass several conditions and tests before I let it trade live. Then I set a strategy stop loss and a time stop loss. After I have decided to trade the strategy live, I don't touch it anymore. Either it gets stopped out or performs well ;)

Strategy development is not that complicated, but there is more to it than just creating a nice backtest. And I am also constantly still learning and improving ;D


I made two optimizations to show the problem of over-optimization. Hope it helps ;D


Thanks for the example. So if you don't like to use walk forward testing, what test do you do then to determine if it's viable or not? And on how long of a time period do you use these?


You seem to have a multi year plan for this. I can deal with a strategy not working for a week or two weeks but not much more than that. 

 
Danny Verpoorten:

For a while now I've been working on creating an algorithm based on a short term moving average crossing a longer term moving average (and a bunch of filters on top of this).


Initially the result can look great. However, when I then went back in time I always see that the algorithm that worked so great before, all the sudden stops working or even generates a significant loss. 

<Deleted>

Can someone explain to me why these things happen? I understand that momentum is a requirement for a good profit with moving average crossovers and also the ATR is important, but both were still fine for this symbol in the last year.


Any help would be greatly appreciated as I'm trying to solve this issue.

 
 I am interested in knowing what moving averages are you using and what time frames Reason I ask is, if you find a good trading strategy at times it may seem like it would have to be tweaked. As everyone here already stated, market changes, especially with all the stuff happening around the world, currency trading can be difficult to predict. 

   Point I am trying to make, you can place any moving average onto the charts, and they will work on many occasions, but you can also visualize they won't always work. I always like to use the 200 EMA on my charts even though I focus only on market structure. 200 EMA holds a lot of weight both above and below that MA.  

 

More you share a stretegy, more it is used, and less this strategy is profitable.


The consequence is that most strategies sold on the internet are just not working.

(please just don't answer martingale are profitable strategies because it is embarrassing)

If one of them is a good strategy, it will not be profitable in the future, just because with the volume, other parties will enter and change the market, it can be against you or before you.

 
The problem with not working of particular strategy which works before is due to the fact that market changes constantly without any notice.The causes may be varied and since EA works on limited parameters which cannot adapt to changes in market.Over optimisation can also causes losses.
 
Philippe Pauleau #:

(please just don't answer martingale are profitable strategies because it is embarrassing)

Good point, although the biggest part of MQL5 market which sadly is full of martingale EAs will disagree with you :). They get 5-star rated, recommended to friends as being "smart strategies", "different then other martingale EAs" etc. New nice-looking martingale curve looks too attractive... at first.
Agree with the rest of what you said too. If, for example, everyone starts trading news or breakouts... the strategy will stop working already because most people will get huge slippage.

 
Danny Verpoorten #:

Thanks for the example. So if you don't like to use walk forward testing, what test do you do then to determine if it's viable or not? And on how long of a time period do you use these?


You seem to have a multi year plan for this. I can deal with a strategy not working for a week or two weeks but not much more than that. 

Sorry for the late reply.
I use a simple out of sample test.
For a backtest I usually use 10 years. A strategy usually has more than 10k trades.
If you think in terms of weekly periods then you are probably scalping or do you have strategies that make over 100 trades per week? Or how do you know after a week that a strategy is no longer working?

And I still believe that 90% of the time, if a strategy doesn't work in the live market, it has nothing to do with changing markets. The trap of over-optimization is so big, and almost every algo trader (including me) falls into it ;D

Reason: