Technique help to reduce over-fitting
Forums › ProRealTime English forum › ProOrder support › Technique help to reduce over-fitting
- This topic has 63 replies, 12 voices, and was last updated 3 years ago by Paul.
Tagged: overfit, overfitting, robustness
-
-
08/27/2020 at 6:00 AM #142667
Hi everyone,
Today, there is a few tools/technique to avoid over-fitting, namely probacktest walk forward analysis with OOS, avoid too much variables (subjective, right?), monte carlo, robustness tester by Vonasi, avoid trade in low time frame (subjective also, right?) and etc…
I like to see if there is other techniques to help avoid over-fitting, here I’m sharing 2 more that I use occasionally:
1. Optimize variables together with possibility to trade on different bar, example as below
1IF timeok AND Not OnMarket AND close > open AND C1 AND (oddtest = 1 or barindex mod oddtest > 0) THENC1 can be for example C1 = close > Average[Period], then you optimize oddtest and Period.
oddtest with range 2 to 10, step 2, but can be increased according to the need
Period range and step depending which way to analyze the optimization:
a) No. of combination exceeding 100: the top result will be selected and the more occurrence of a Period value at the top can means higher chance when trade opened at different combination of barindex, it is more resilient. PS: Con is PRT always arrange result to highest gain%, but we know highest gain% not always means a better strategy
b) No. of combination not exceeding 100: exact the optimization table to excel, sort the average gain and win rate, then rate them accordingly (depends which that you like)
Note: PRT optimization windows is limited up to 100 combinations. Con of this technique is limited no. of variables can be studied at a time, basically use it when you have dilemma to choose which value for a certain variable
2. Design variables to conflict each other when optimizing it too overfit, example as below
123456789SLpoint = SL * 0.01 * closestartBreakeven = MIN(atrH1, 75)startBreakeven = MAX(startBreakeven, 50)trailingATR = MIN(atrH1, SLpoint)trailingATR = MAX(trailingATR, startBreakeven)SET STOP %LOSS SLAs you know, higher stop loss can contribute to high win rate. Above code is having,
- SL (stop loss) as % of asset value, higher can contribute higher win rate
- trailingATR = points gained for trailing start, lower can contribute to higher win rate
In this case, if you optimize SL to be as high as possible to gain higher win rate (indirectly total gain too), then it can impact trailingATR which also contribute to win rate. So the optimization has to balance by itself for highest gain.
Maybe you have other technique that you used during optimization to reduce over-fitting to share?
1 user thanked author for this post.
08/27/2020 at 8:21 AM #14267308/27/2020 at 11:33 AM #142703Thanks, Nicolas. I was hoping IG will deploy that version soon.
Btw, the 1a) idea is quite similar like Vonasi robustness tool, today due to the fact that the signal can be hidden by the on-going trades, so here is to help creating more test scenarios to reveal whether strategy was lucky to ignore some bad signals.
08/27/2020 at 2:03 PM #142712I found your 1a) and in a same time Vanessi robustness tool very interesting but, something disturb me :
At least 50% of our results in our optimisation windows don’t even give 50% number of trades compared to our “classic backtest” on the same period.
I give an exemple : My strategy take 300trades/year, average 1/day on the last 2 years, and when i use Vanessi Robutness Tool, the half of simulation will give less than 150 or 100 trades/year. If those the scenario would be 100 trades during 6 months i would trust, but it’s not the case. VanessiRobustnessTool cut a big parameter for small UT Strategy : The average trades per day
So, are we supposed to trust a scenario where our strategy take 3 times less trades than ordinary ? is it really a feasible scenario ? i don’t think so. A difference of 20 or 30% on the number of trades on a same period would be still possible, but not more.
What do you think guys ?
Thanks for all your great work on the forum Dow Jones.
08/27/2020 at 3:03 PM #142715Not sure who this Vanessi chap is?
The point of my ‘Vonasi Robustness Tester’ and also my ‘Strategy Every Bar’ tests is to see trades that we might not see in a normal back test. In a normal back test we might open a position and that position could be open for 1000 bars. In that 1000 bars there could be 1000 bars that meet our entry criteria to start a trade but our normal back test has shown us none of them.
Even if the robustness tester only shows us 10 of those trades then we have at least 10 more trades to analyse for performance. 10 trades isn’t many but more information is always better than no information!
An ideal robustness test would show us 100% of all possible trades available on our chart. If PRT could add a test tool that simply checks on each bar whether trade entry conditions are met and then tests 100% of all possible trades and adds up the results and creates an equity curve then that would be a very powerful tool for checking for over-fitting or just getting lucky and hitting a lot of winners whilst missing a lot of losers. This tool wouldn’t work for all strategies – for example strategies that are on the market 100% of the time reversing position would be impossible to test.
08/27/2020 at 3:29 PM #142717The “Vanessi” Robustness Tester is a very powerful instrument; i’m using it since months and i can tell you that it’s fundamental in building a portfolio.
I only use it, ignoring methods like walk forward that i don’t like so much for some reasons.
As Vonasi said, it is necessary that the strategy is of a certain type (not always on the market or with few trades over the years).Once you master it you will be able to filter overoptimized systems from performing ones; i’ve tested and looked with my own eyes how bad robustness strategies went bankrupt and good ones mantained nice performances.
Managing regular optimization and robustness test checking will give you the possibility to mantain performing porfolios.08/27/2020 at 3:30 PM #142718are we supposed to trust a scenario where our strategy take 3 times less trades than ordinary ? is it really a feasible scenario ? i don’t think so. A difference of 20 or 30% on the number of trades on a same period would be still possible, but not more.
I agree with you totally, if the strategy normally take 300 trades/year, then not acceptable to have too little trades. Actually when using Vonasi tool, I need to adjust the setting, not following the default 10-10, 20-5, 21-5, but something like adjust the 10, 20 and 21 to something lower, these values are used to modulas the barindex thus, the higher value, it will gives less trades, because it means it allows trade on every 10 bars, 20 bars and 21 bars. For me, it depends on strategy too, I think Vonasi is fan of high time frame strategy, thus 10, 20, 21 makes sense for high time frame as probably not aimed for high frequency trades. As I’m fan of high frequency trades, generally the strategy should have 2-4 trades/day, thus I need to adjust it lower, to something between 3 to 10, e.g. 5-21, 6-21. So I guess overall, need to apply accordingly to the goal of the strategy
Same concept for the technique 1a), you will adjust the oddtest value accordingly to suit the need, but in this usage, it may allow lower trades, because your analysis is not based on single oddtest, but oddtest can give you the “top” parameters in all combination of oddtest, thus help to narrow down the range
Btw, I have a mistake on giving my example above, oddtest should start with 1 to 10, step should be in odd number, e.g. 1 or 3, when oddtest = 1, it means no bar will be skipped, so you will see the original result. When oddtest increase in the step of 3, the backtest will then skip barindex in modulas of 4, 7, 10
oddtest with range 2 to 10, step 2, but can be increased according to the need
But I find Monte Carlo assessment sometimes helpful for me, for example recently, I analyze one of my strategy that looks good on profit curve to see that the strategy has been focus too much on low profit trade (see attachment), and not good enough to cut stop loss earlier, so I go back to update it. I think what important in these assessment is also to be able to see if any room of improvement to the strategy, instead of just to have a nice graph (on top of nice equity curve).
Honestly, I cannot take any credit here, rather I should thank to all the fantastic developers in this forum, that enable me to learn more and more 🙂 (I’m really new here and continuous learning)08/27/2020 at 3:42 PM #142720are we supposed to trust a scenario where our strategy take 3 times less trades than ordinary ? is it really a feasible scenario ? i don’t think so. A difference of 20 or 30% on the number of trades on a same period would be still possible, but not more.
I agree with you totally, if the strategy normally take 300 trades/year, then not acceptable to have too little trades. Actually when using Vonasi tool, I need to adjust the setting, not following the default 10-10, 20-5, 21-5, but something like adjust the 10, 20 and 21 to something lower, these values are used to modulas the barindex thus, the higher value, it will gives less trades, because it means it allows trade on every 10 bars, 20 bars and 21 bars. For me, it depends on strategy too, I think Vonasi is fan of high time frame strategy, thus 10, 20, 21 makes sense for high time frame as probably not aimed for high frequency trades. As I’m fan of high frequency trades, generally the strategy should have 2-4 trades/day, thus I need to adjust it lower, to something between 3 to 10, e.g. 5-21, 6-21. So I guess overall, need to apply accordingly to the goal of the strategy
Not really, i use 10-10 20-5 and 21-5 on 5m timeframe and the number of trades of the results is pretty similar to the original backtest. Anyway it should be changed to better fit the strategy, i use the original values for comfort and also in order to “standardize” results.
Also, how would you know what is the better number to change?
08/27/2020 at 3:53 PM #1427215m timeframe and the number of trades of the results is pretty similar
Yeah, for 5m like MoD seems ok too, but I find these sets give too little trades when I’m playing on 1m time frame
how would you know what is the better number to change?
Not sure I can say better number, but I test with several sets actually, changing Qty lower and increase the Random to maximize the combination up to 100. I maintain Qty no less than 4 and ensure no less than 25% of trades vs the trade no. from the strategy, e.g. if strategy has 300 trades, I want it to have no less than 75 trades
1 user thanked author for this post.
08/27/2020 at 4:08 PM #142723Hi, I personally do not use anything but when I build a trading system I ALWAYS stop at 31/12/2017 with any time frame …. after checking that from 01/01/2018 to today the system is similar both in performance and in drawdown …. if the result is not good I do not change anything and delete immediately without changing the variables that would fix it for the past but the future would probably be a disaster ….. if it is ok instead I put it in demo for a period minimum of 4 months up to one year based on the number of operations ….. after this second verification I can put it in real ….. as long as it continues to be completely similar to the performance of the Backtest.
08/27/2020 at 4:17 PM #142725as long as it continues to be completely similar to the performance of the Backtest.
Yes but without a robustness test how do you know that your back test didn’t just get lucky and hit all the winners and your forward test didn’t just get lucky and hit all the winners? It’s the trades that you don’t see in your back and forward test that are the ones you really need to see to know that you didn’t just get lucky.
1 user thanked author for this post.
08/27/2020 at 4:20 PM #142726I personally do not use anything
That’s fine, it is not necessary must use tool, the way how you back test is also a technique. I recently also starts to adopt this way but wasn’t sure if it will work well yet. For the first set result (until 2017), you will perform WFA as well I suppose?
08/27/2020 at 4:38 PM #142735Yes, however, I stop in December 2017 and to date it is more than 2 years so I put it in demo for at least 6 months or a year …. so before putting it in real it is about three years that the trading system is as if it were active. …. then it depends on the number of operations if in three years they are 40 you are right but if they are 400/500 I don’t believe in luck ….. however in doing so I have trading systems since 2018 and to date they are still active with good performance.
08/27/2020 at 5:33 PM #142741The “Vanessi” Robustness Tester is a very powerful instrument; i’m using it since months and i can tell you that it’s fundamental in building a portfolio.
I only use it, ignoring methods like walk forward that i don’t like so much for some reasons.
As Vonasi said, it is necessary that the strategy is of a certain type (not always on the market or with few trades over the years).
Once you master it you will be able to filter overoptimized systems from performing ones; i’ve tested and looked with my own eyes how bad robustness strategies went bankrupt and good ones mantained nice performances.
Managing regular optimization and robustness test checking will give you the possibility to mantain performing porfolios.
I think i did not understand something in the VRT protocol : Do you adjust qty and random to fullfill optimisation window with the original backtest’s similar number of trade (20% more or less) ?
If not… That mean that you are using every data of the optimisation window in your excel sheet. And, you will agree with me, one %WinningRate Data on 40 Trades as not the same statistic value compared to a %WinningRate Data on 500Trades. To create a good protocol the data have to be build from a number of trades closes to each other. I can’t put a data from 40 trades and another one of 300 trades in the same curve. Even a robust strategy can stagnate during 1 month and so get a bad result on a little number of trades, that’s why every exported data must me from the same number of trades.
If yes… i missed something in the main topic and i’m sorry. Used like this, i agree, it could be a powerful tool.
To me , and like Dow Jones said, our tests must me run on a same number of trades if we want exploitable data.
By the way, sorry for Vanessi, Vonasi :p
Cordially
08/27/2020 at 5:53 PM #142742Hi Dow Jones ….. Yes, of course the WFA must be used is a great tool … but I feel at ease with the system described above it gives me security and also results … of course out of 50 trading systems only one it’s working …. then you have to be careful to put it in demo for some time and not everyone has this patience …. the important thing is NEVER reoptimize it if it’s not good, otherwise you deceive yourself.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on