Thoughts on how to avoid curvefitting

Forums ProRealTime English forum General trading discussions Thoughts on how to avoid curvefitting

Viewing 15 posts - 1 through 15 (of 36 total)
  • #92018

    So from reading, studying, testing and creating algorithms i have a couple of tips to bring to the forum.

    As every post i make regardig “how to ..” my opinions on things, are based on my own experiences and thoughts from what i have read in books and heard from listening to podcasts.

    So how can we create stuff that is not curvefit to the point of just breaking when put into live?

    1. Never optimize on all of your data
    2. Put it in demo to see that it is in fact doing what it is supposed to do. Patience is key.
    3. You are trying to find patterns within the chart/data, make sure that the pattern you’re trying to trade, is in fact a pattern that happens again and again and again. If your trying to “buy the dip” then you should basically buy every dip you can find in the chart. if you’re only buying the dips that go in your favor, then im gonna guess that you have “picked out” the very best trades from optimizing aka you have curvefit your algo too hard and suddenly the code is not buying the pattern you want in the future, but rather backtest is just picking out the best dips that have happened in history, future dips will look different tho, so make sure your algo is not too spesific and fit to the data.

    So what does this mean? Well it means that your code shouldn’t be looking “too good”, do not aim for perfection, aim for robustness. If you manage to buy “every dip” and your still profitable but with less win%, then i would trust the “buy every dip” code rather then a 90% win rate dip-buying code.

    Don’t make codes trying to be exact and perfect, make systems that are easy. Easy to explain, easy to show and easy to code.

    One of my favorite quotes from trading are (and as always im paraphrasing) “Make sure your code doesn’t fit like a glove, it should fit like a mitten. More wiggle room for the price, more chance for failure, but also more robust when it comes to new data”

    My best algos to todays date are in fact my “loosest” ones. The ones with less code, the ones with a “loosely” defined exit (wiggle room) and the ones that do indeed get faked out here and there.
    My worst algos to todays date are the ones that have the most conditions, less wiggle room and more room for being stopped out JUST before the price bounces or what have you..

    if you got 10 conditions with 10 different variables for trying to buy a dip, then it sounds like the code is trying to find exact same patterns as backtest, rather then just trying to buy a dip.

    Dosnt mean it wont work, but i would feel better having only 5 conditions even if it means reducing my win rate or even profit.

    Remember that “buying dips” (mean reverting) or buying a breakout (momentum) can be measured using 100 different indicators, but that dosnt mean you should include 50 of them, 1 or 2 might do the trick.

    When i started out there was one thing i just could not get out of my head, and it has really bothered me to this day: Does indicators work? Should you focus only on “higher highs and lower lows”? What indicators work? What does not work? how can i know?

    For me at least, these questions have finally been answered: I have listened to hundreds of podcasts episodes that includes great pro and amateur traders that talk about their own strategies. I have read many books on the subject as well. I have heard about people using only the bollingerbands (combined with price action) and i have heard about others using only the RSI (combined with price action), i have read about people using both the RSI and Bollingerbands combined. I have read about people that swear that no indicators work, only price action can tell you where price might go. Ive listened to experts claiming that if you do not have multiple time frames in your code you cannot be successful, ive read about experts saying that if you do not have a dynamic code, or loads of decision trees, then you cannot be successful. Some say stop loss is key, others say stop loss sucks. Some use trailing stops, some dont. Some use profit targets, others dont.

    The final conclusion for me is that everything can work, if you know how to work it.

    Indicators can work, people use them and are making profits, i use them and im making profits.

    Pure price action can work, people use them and are making profits, i use them and im making profits

    Combination of both price and indicators can work. Decision trees can work. Multiple timeframes combined with indicators and combined with price can work. Stop losses are great and stop losses can be your worst enemy.

    Honestly i think that everything can work, if used correctly. These are all tools to create a strategy that is profitable. What makes a tool great for you, is knowing the “how, why and when” to use it. Not every tool fits every person and trading style. It comes down to you and your personality.

    Even tho it sounds cliche, mean reversion isnt for everyone, same with momentum strategies. Some do great on mean reverting strategies, others dont. They just dont seem to “get it”. Keep working at it tho and you will see the light eventually.

    7 users thanked author for this post.
    #92024

    Thank You jebus89 for taking the time to share your thoughts, experiences and summary of the hundreds of podcasts and books you have read!

    It is all valuable information and guidance … keep it coming please … whenever / whatever occurs to you.

    I use a mixed bag of all the strategies you mention above, I will use anything as long as it can be seen to work … as you say, the acid test is a decent Forward run on Demo with plenty of winning trades.

    Even after a successful Forward Test I would still monitor every Live trade until more and more confidence builds up.

    1 user thanked author for this post.
    #92030

    Honestly i think that everything can work, if used correctly. These are all tools to create a strategy that is profitable.

    You are absolutely right! I came across so many things while coding for others, that I’m now convince that “everything can work”.

    It is for this reason that I encourage the people I discuss with to remain open to all possibilities and not to sink into a trading sectarianism which is to say that its own method is the only one that works.

    #92035

    Everything works – except if you try to do everything at the same time in just one strategy!

    #92160
    CKW

    thanks again, another Interesting topic!

    So what does this mean? Well it means that your code shouldn’t be looking “too good”, do not aim for perfection, aim for robustness. If you manage to buy “every dip” and your still profitable but with less win%, then i would trust the “buy every dip” code rather then a 90% win rate dip-buying code. Don’t make codes trying to be exact and perfect, make systems that are easy. Easy to explain, easy to show and easy to code. One of my favorite quotes from trading are (and as always im paraphrasing) “Make sure your code doesn’t fit like a glove, it should fit like a mitten. More wiggle room for the price, more chance for failure, but also more robust when it comes to new data”


    @jebus89
    , if a system performance is “not so good” on most of the friday trades from the past 2 years. Will you add a condition to avoid friday trading? In consequence, do you consider it’s kind of curve fitting? or acceptable

    #92182

    @CKW

    Yes it is curve fitting if you think of it. Even just trying to make a strategy to be in gain is curve fitting.

    #92184

    Will you add a condition to avoid friday trading? In consequence, do you consider it’s kind of curve fitting? or acceptable

    I would consider it acceptable.

    What I often do is run  2 or more versions side by side on Demo Forward Test and then I / you could see if the  decision to exclude Fridays was justified!? 🙂

     

     

    #92187

    @CKW Hello again and im glad u liked my post. Adding a rule banning a day of trade seems to me pretty dumb. This is just me.

    Unless its 100/100 fridays all show loosing trades i would definitly not “ban friday trading”. Lets say you have a mean reversion code, trying to time a bottom and go long. Why would that not be working on fridays? It just seems “weird” that fridays can never be a positive day for mean reversion. Or breakouts, why should X-day never be traded.
    Lets say your strategy is some superweird thing like “buy at 12:00 if market is up 2+% for the day and its a thursday only”, thats a code i personally dont trust..  i would much rather see that there is a “move” happening in the market, and i want to jump on board on that move. be it a fake out or not, my money management will hopefully sort those things out.

    Im all about trying to “hop on board” be it mean reversion or breakouts. Finding “patterns” or a way to capture a “move” that seems to be happening again and again in the chart. Then betting on that the % winning trades and profit factor stays ish similar as backtest and then just run it and pray shit stays the same haha.

    #92188

    Would also say i agree with nicolas, every rule u add = curve fitting. You have a set of data, youre trying to extract profit from that data. What you need to do is extract as much as you can, from simple rules that curvefit as little as possible. For example, excluding a whole day is a very bad rule in my book. But saying “daily close > 200SMA” for S&P minis is probably not such a bad rule, as trading below the 200 day (or whatever variable u choose) seems to add more loosers as price chopps even more when its below than above.

    #92190

    But saying “daily close > 200SMA” for S&P minis is probably not such a bad rule, as trading below the 200 day (or whatever variable u choose) seems to add more loosers as price chopps even more when its below than above.

    …or better still setting a band either side of the MA200 so that you have a ‘no trading zone’ can work well and take out a lot of the whipsaw losing trades. You only go long if above the upper band and sell any long positions if price falls below the lower band.

    On a separate note I have also found recently that using weighted averages rather than simple or exponential has proven more robust in most strategies. I guess that a weighted average responds faster to recent moves and recent data is the most relevant to our strategies.

    3 users thanked author for this post.
    #92191

    hello, prohibit trading at the end of the month can change the results

    #92194

    Awsome input @vonasi and @fifi743.

    Will look at both your inputs when looking at my strategies next time.

    Regarding “not trading at end of the month” might be true for whatever strategies your trading, and it “might make sense” but it is indeed a bias, and as every other thing it includes more curvefitting. That being said unless it shows like 95% good results from doing it i wouldnt do it because who knows, the best day of the century might come the 28. february.

    #92221
    CKW

    i guess the prerequiste to add extra condition a, b, c,…. is the “core system” should at least generate an acceptable equity curve before anything else.

    #92240

    Yea i would say b efore adding stuff like “no trading on fridays” or “no trading at end of month” you should defnitily already have a “core” theory/code.

    #95514

    Hi guys bit late to convo but RE excluding a specific day. I’ve been backtesting on the AU200 futures and there are specific hours within the day which produce unfavourable results – usually post close of the real market and opening of the US markets. I’ve tested across 5 years worth of data. Would you consider excluding this time frame going forward? I’ve done the calc both ways and its very much favourable to exclude but wary of overfitting. Thoughts would be appreciated, cheers

Viewing 15 posts - 1 through 15 (of 36 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login