Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

Xiao si

In Sample and Out of Sample Size

Recommended Posts

I see an ongoing debate in some forums about the duration of the data used to design, test, and optimize trading systems.

 

On one side i hear that some like Sunny Harris use 12 months of data only. Other still demand that anything less than a couple of years is just fitting to noise.....

 

If we go back too far we end up seeing a mess of noise related to the top and subsequent rapid decline of 2008. Before that and it was the late stages of the bull market.

 

I also hear some talk that now the markets are more mean reverting than prior to 2008, when they were more trendy.

 

My opinion from all of this so far is that one year of recent data is probably better to build a system that works well as the markets 'currently' behave.

 

This leads to the Out of Sample period reserved for proving the consistency of the systems performace.

 

I'm interested in opinions of the systematic traders here as to what they personally like to use for these data samples and why.

 

Also, what is your preferred roadmap for development of these strategies? example:

-develop the idea or concept

-test the basic entry

-test the entry with basic trade mgt.

-optimize the basic trade management

-back-test in sample

-etc....

 

Thanks in advance to all those systematic traders in the house:thumbs up:

 

Cheers,

 

 

XS

Share this post


Link to post
Share on other sites

It's all very complicated - Thomas Stridman's 'Trading Systems That Work' is probably the best book for reading up on this topic. Especially important are his thoughts one percentage-change scaled backtesting rather than dollar-based tests.

 

I use data prior to the in-sample as my out of sample (there's absolutely know reason why the market one year prior to the in-sample is any more likely to resemble it than the year after the in-sample does).

 

If you're testing a fixed percent stop-loss, say, then you're going to want to test this over a long period to get a result that reflects changes in market volatility. If, however, your stop was a dynamic, volatility-based stop, then there would be less of an argument for this.

 

Also, it depends on how frequently your system trades. If you were testing a long term trend-following system then you'd want at least 10 years in sample, I would say. Whereas an HFT firm may use just the last year or two. Significant sample size is the important factor.

 

I would definitely think about how you can remove variables from your system so that there is very little optimisation to be done.

 

Hope that helps.

Share this post


Link to post
Share on other sites
It's all very complicated - Thomas Stridman's 'Trading Systems That Work' is probably the best book for reading up on this topic. Especially important are his thoughts one percentage-change scaled back-testing rather than dollar-based tests.

 

I use data prior to the in-sample as my out of sample (there's absolutely know reason why the market one year prior to the in-sample is any more likely to resemble it than the year after the in-sample does).

 

If you're testing a fixed percent stop-loss, say, then you're going to want to test this over a long period to get a result that reflects changes in market volatility. If, however, your stop was a dynamic, volatility-based stop, then there would be less of an argument for this.

 

Also, it depends on how frequently your system trades. If you were testing a long term trend-following system then you'd want at least 10 years in sample, I would say. Whereas an HFT firm may use just the last year or two. Significant sample size is the important factor.

 

I would definitely think about how you can remove variables from your system so that there is very little optimization to be done.

 

Hope that helps.

 

Thanks BH, i share your view on simplicity.

 

XS

Share this post


Link to post
Share on other sites

Xiao si, are you talking about EOD or intraday systems?

 

I know that most use 30% of the data for development and the remaining 30% for out of sample testing. Some argue that the in sample should be long enough to include a variety of market conditions. I agree. At least 10 years for EOD and 5 years for intraday is what I use. Other do not agree. This is trading.:)

 

As far as the roadmap you outlined, in my opinion it is a time consumig and inefficient process. It can be compared to trying to divide decimal numbers by hand instead of using a calculator. More and more traders turn to machine generated strategies. If you like indicators and evolutionary algorithms then Adaptrade is a popular program. If you like price patterns only then Price Action Lab is another popular program. The use of such programs automates development and testing with significant advantages. Good luck to you!

Share this post


Link to post
Share on other sites
Xiao si, are you talking about EOD or intraday systems?

 

I know that most use 30% of the data for development and the remaining 30% for out of sample testing. Some argue that the in sample should be long enough to include a variety of market conditions. I agree. At least 10 years for EOD and 5 years for intraday is what I use. Other do not agree. This is trading.:)

 

As far as the roadmap you outlined, in my opinion it is a time consumig and inefficient process. It can be compared to trying to divide decimal numbers by hand instead of using a calculator. More and more traders turn to machine generated strategies. If you like indicators and evolutionary algorithms then Adaptrade is a popular program. If you like price patterns only then Price Action Lab is another popular program. The use of such programs automates development and testing with significant advantages. Good luck to you!

 

This is great stuff Equ....At the moment my focus is intra-day on the equity index futures in my time zone, so Asian, Australian and Eurpean. I'm actually using Adaptrade's Builder as well as developing my own systems as i learn to code.

 

I've got quite a bit of data now (thanks to a few on here) so i'll be working my way through some of that. I find that the last few years were pretty diverse in terms of market action. If i build a system on 2009-2010 data its more apt to perform on OOS data from 2010 - 2011 than if i use something that includes 2008. Talk about a rough patch.

 

Just wondered how people were using that period, avoiding it or using it?

 

Cheers,

 

 

XS

Share this post


Link to post
Share on other sites
...Some argue that the in sample should be long enough to include a variety of market conditions. I agree. At least 10 years for EOD and 5 years for intraday is what I use. Other do not agree....

 

I think it MUST be long enough to include a variety of market conditions.

Share this post


Link to post
Share on other sites
I think it MUST be long enough to include a variety of market conditions.

 

But should that variety include a period like we saw from July 2008 to December 2008? Should we expect a system to be able to trade through that huge increase in volatility and still be able to deal with a trending market?

 

I do think that different parts of the trading year are important though. I try and use data that covers all of these seasons evenly.

 

XS

Share this post


Link to post
Share on other sites
But should that variety include a period like we saw from July 2008 to December 2008? Should we expect a system to be able to trade through that huge increase in volatility and still be able to deal with a trending market?

 

I do think that different parts of the trading year are important though. I try and use data that covers all of these seasons evenly.

 

XS

 

I think it is crucial to see how your system will perform if a part of the history repeats itself again. If you know your system's weaknesses, you can prepare yourself what to do next. if your system is not performing well under a certain market condition, then you can either choose not to trade or add some filters to the system...just my thoughts...

Share this post


Link to post
Share on other sites
I think it is crucial to see how your system will perform if a part of the history repeats itself again. If you know your system's weaknesses, you can prepare yourself what to do next. if your system is not performing well under a certain market condition, then you can either choose not to trade or add some filters to the system...just my thoughts...

 

You know, i usually run it over that nasty 2008 decline just to see what it does, but I've never really looked it that way before...thanks, that's great advice.

 

XS

Share this post


Link to post
Share on other sites
But should that variety include a period like we saw from July 2008 to December 2008? Should we expect a system to be able to trade through that huge increase in volatility and still be able to deal with a trending market?

 

I do think that different parts of the trading year are important though. I try and use data that covers all of these seasons evenly.

 

XS

 

Hi XS,

 

Why don't you do out-of-sample testing using the 2008 months you mentioned? I would be curious about how my system would have performed in that high vola period.

 

Regards,

k

 

EDIT: Sorry, posted too late... ;)

Share this post


Link to post
Share on other sites
Hi XS,

 

Why don't you do out-of-sample testing using the 2008 months you mentioned? I would be curious about how my system would have performed in that high vola period.

 

Regards,

k

 

EDIT: Sorry, posted too late... ;)

 

Yeah, i think i'm going to start reserving that period for OOS testing and making a point of always testing over it.

 

Cheers,

 

 

XS

Share this post


Link to post
Share on other sites
Yeah, i think i'm going to start reserving that period for OOS testing and making a point of always testing over it.

 

Cheers,

 

XS

 

I would be careful with this approach if I were you. A lot of the strategies that I trade or track performed conspicuously well in that 2008 period (to the extent that the equity curve pretty much brickwalls). This is probably because they are contrarian in nature and therefore doing roughly the opposite of whatever your strategy is trying to do when it struggles in 2008.

 

However, if I developed such a strategy now and then used 2008 for my out of sample period, then I would get a wildly optimistic and hopelessly wrong-headed impression of my strategy's likely performance.

 

. . . A much more interesting period to look at is 2007. This is when the volatility really started to ramp up, as all the higher tranched credit default swaps etc went belly-up behind the scenes - how did your strategy respond to this steadily increasing volatility? Did it adapt?

 

Hope that helps

 

Bluehorseshoe

Share this post


Link to post
Share on other sites
You know, i usually run it over that nasty 2008 decline just to see what it does, but I've never really looked it that way before...thanks, that's great advice.

 

XS

 

you are welcome, just shared a piece of my experience :)

Share this post


Link to post
Share on other sites

Great stuff guys thanks heaps...

 

There is a raging debate on this on another forum regarding OOS testing which then leads to the topic of optimization.

 

I sort of think that for my current tie frame, 15 minutes i need only a year of data to construct and 1 year for the first OOS period. Then i use a three to six month period reserved for optimizing...then WF from there. I know i'll get some flack for this...but that seems to work best. I think i'm getting too much variety in the market behavior if i use too much data to develop the system on. More recent data works better.

 

Opinions?

 

Cheers,

 

 

XS

Share this post


Link to post
Share on other sites

 

... More recent data works better.

 

 

 

Hi XS,

 

More recent data works only better, if your different walk-forward testing periods prove so. Otherwise you did just curve-fitting to the recent data.

 

Regards,

k

Share this post


Link to post
Share on other sites
Hi XS,

 

More recent data works only better, if your different walk-forward testing periods prove so. Otherwise you did just curve-fitting to the recent data.

 

Regards,

k

 

Exactly, and that's where the debate starts going about what is curve fitting and what is over fitting...Many are saying that curve fitting is ok for intraday systems as long as they prove themselves on OOS data. I'm still trying to get the difference between curve fitting and over-fitting.....

 

XS

Share this post


Link to post
Share on other sites

Xiao,

 

In my opinion you have to worry about presenting your setup to make the greatest possible amount of operational situations. This not only concerns to OOS, but the combination IS + OOS.

 

Why?

 

1) When you define an IS window period, you need to worry about the degrees of freedom for your model optimization. You need to make room for the model to find the best combinations of parameters to the setup´s rules. Thus, for ranges of 200 MA periods ex., you need to consider that the period will comprise your model extension.

 

2) Once granted an appropriate period, you must remember that the optimizer will (try to) set global maximum to your objective function, specifically for that IS window period. So you're training the model to get the best performance according to that market conditions. You are fitting your model to that market.

 

3) Once you finished the optimization, you will apply the model on the OOS next window period. And see how it behaves. The better will be the result, the better is the predictive capacity of your model. But you must remember the IS period. When you optimized, which was the IS period kind of market? Trend, range, up, down. And now, in the OOS? The market may be similar or completely different. What counts are the combinations: IS in trend and OOS in range, IS in uptrend and OOS in downtrend, OOS in range and IS in up trend, and so on.

 

The final analysis will be done on the cumulative results of all OOS windows. I use WFA precisely because of the various possible IS+OOS testing combinations and thus manage to evaluate the predictive capacity of the model in many different situations. So I can have more confidence when it comes to operational phase.

 

Another important aspect of the OOS window is the number of operations. It is not recommended to have windows with few operations. In my case its worries me more because the strategy (I prefer setups with high trades number) and less because of the statistics. That's because I consider all the operations of all OOS windows to analyze the possible distributions with MC.

 

That's my opinion. Sorry for my poor english and I hope you understood my point of view.

 

Regards

Marcelo

Share this post


Link to post
Share on other sites
Exactly, and that's where the debate starts going about what is curve fitting and what is over fitting...Many are saying that curve fitting is ok for intraday systems as long as they prove themselves on OOS data. I'm still trying to get the difference between curve fitting and over-fitting.....

 

XS

 

I think the point is not fitting or over-fitting. The point is if your parameter adjustment creates a completely different random animal. There is an interesting thread in the Adaptrade forum where a user tries to reverse engineer a system and he ends up getting a different each time he tries. I think this is not only fitting but random fitting:

 

Reverse engineering a known system - Adaptrade Builder | Google Groups

 

I like the classification of curve-fitted systems this guy has come up with:

 

Curve-fitting and Optimization | Price Action Lab Blog

Share this post


Link to post
Share on other sites
I think the point is not fitting or over-fitting. The point is if your parameter adjustment creates a completely different random animal. There is an interesting thread in the Adaptrade forum where a user tries to reverse engineer a system and he ends up getting a different each time he tries. I think this is not only fitting but random fitting:

 

Reverse engineering a known system - Adaptrade Builder | Google Groups

 

I like the classification of curve-fitted systems this guy has come up with:

 

Curve-fitting and Optimization | Price Action Lab Blog

 

Yes, i agree. I fact i have been only optimizing MM stops and Exits for sometime now. It makes sense as well if you are using indicators for the basis of a system and you optimize those that the curve fit is much more likely to fail, almost certin IMO. Them being the PAL, using only price patterns of course they are selling that particular POV.

 

I've noticed that the majority of systems that Adaptrade's Builder constructs are actually more Price Action based even if i do not narrow down the range of choices to this, especially the volatility systems.

 

Thanks for the link..curious of the others POV too.

 

Cheers,

 

 

XS

Share this post


Link to post
Share on other sites
Yes, i agree. I fact i have been only optimizing MM stops and Exits for sometime now. It makes sense as well if you are using indicators for the basis of a system and you optimize those that the curve fit is much more likely to fail, almost certin IMO. Them being the PAL, using only price patterns of course they are selling that particular POV.

 

PAL posted another article yesterday on their blog about curve-fitting. I think it points to programs that offer a lot of different stop options to nicely curve-fit results

 

Article link here

Share this post


Link to post
Share on other sites
I would definitely think about how you can remove variables from your system so that there is very little optimisation to be done.

 

I would possibly comment on this, even if the thread is no longer updated.

 

On another forum I had the occasion of discussing about the usefulness of optimizations and especially of walk forward optimizations with reference to the INS/OOS balance.

 

My point was basically as follows: WFO is probably NOT always a must in comparison with traditional optimization. In particular conditions of market and time, there's a chance that a WFO is NOT necessary and/or useful.

 

Just a specific case, to make my point clear.

 

I’m currently testing a (purely automated/mechanical) strategy with very few parameters, and most of them seem to be unrelated to any kind of periodical change in the market I‘m trading (QM futures contract). I basically started asking myself: is it necessary/useful to include these parameters in the optimization, if they don’t seem to be correlated to any specific change in market behavior? (i.e. they basically seem to casually change from one period to another).

 

One of my mechanical strategies uses a fixed stop loss and evaluates the opening session gap size before taking action. I would usually prefer to set the stop loss just once, by considering the general MAE of the historical backtest. As for the gap size, I usually cannot see any particular change between the sizes of 2002 gaps and the ones related to today’s markets (I can provide data for this). So, does it make sense to include these parameters in the optimization?

 

I agree with your suggestion about reducing the number of the parameters. In fact, my point is that a specific optimization may not be needed for strategies that have very few variables/parameters.

 

By the way, I was replied that in most cases even a strategy with no parameters at all can hide an "implicit" (over-fitting) adaptation to the markets because of the way it's programmed and conceived.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • Be careful who you blame.   I can tell you one thing for sure.   Effective traders don’t blame others when things start to go wrong.   You can hang onto your tendency to play the victim, or the martyr… but if you want to achieve in trading, you have to be prepared to take responsibility.   People assign reasons to outcomes, whether based on internal or external factors.   When traders face losses, it's common for them to blame bad luck, poor advice, or other external factors, rather than reflecting on their own personal attributes like arrogance, fear, or greed.   This is a challenging lesson to grasp in your trading journey, but one that holds immense value.   This is called attribution theory. Taking responsibility for your actions is the key to improving your trading skills. Pause and ask yourself - What role did I play in my financial decisions?   After all, you were the one who listened to that source, and decided to act on that trade based on the rumour. Attributing results solely to external circumstances is what is known as having an ‘external locus of control’.   It's a concept coined by psychologist Julian Rotter in 1954. A trader with an external locus of control might say, "I made a profit because the markets are currently favourable."   Instead, strive to develop an "internal locus of control" and take ownership of your actions.   Assume that all trading results are within your realm of responsibility and actively seek ways to improve your own behaviour.   This is the fastest route to enhancing your trading abilities. A trader with an internal locus of control might proudly state, "My equity curve is rising because I am a disciplined trader who faithfully follows my trading plan." Author: Louise Bedford Source: https://www.tradinggame.com.au/
    • SELF IMPROVEMENT.   The whole self-help industry began when Dale Carnegie published How to Win Friends and Influence People in 1936. Then came other classics like Think And Grow Rich by Napoleon Hill, Awaken the Giant Within by Tony Robbins toward the end of the century.   Today, teaching people how to improve themselves is a business. A pure ruthless business where some people sell utter bullshit.   There are broke Instagrammers and YouTubers with literally no solid background teaching men how to be attractive to women, how to begin a start-up, how to become successful — most of these guys speaking nothing more than hollow motivational words and cliche stuff. They waste your time. Some of these people who present themselves as hugely successful also give talks and write books.   There are so many books on financial advice, self-improvement, love, etc and some people actually try to read them. They are a waste of time, mostly.   When you start reading a dozen books on finance you realize that they all say the same stuff.   You are not going to live forever in the learning phase. Don't procrastinate by reading bull-shit or the same good knowledge in 10 books. What we ought to do is choose wisely.   Yes. A good book can change your life, given you do what it asks you to do.   All the books I have named up to now are worthy of reading. Tim Ferriss, Simon Sinek, Robert Greene — these guys are worthy of reading. These guys teach what others don't. Their books are unique and actually, come from relevant and successful people.   When Richard Branson writes a book about entrepreneurship, go read it. Every line in that book is said by one of the greatest entrepreneurs of our time.   When a Chinese millionaire( he claims to be) Youtuber who releases a video titled “Why reading books keeps you broke” and a year later another one “My recommendation of books for grand success” you should be wise to tell him to jump from Victoria Falls.   These self-improvement gurus sell you delusions.   They say they have those little tricks that only they know that if you use, everything in your life will be perfect. Those little tricks. We are just “making of a to-do-list before sleeping” away from becoming the next Bill Gates.   There are no little tricks.   There is no success-mantra.   Self-improvement is a trap for 99% of the people. You can't do that unless you are very, very strong.   If you are looking for easy ways, you will only keep wasting your time forgetting that your time on this planet is limited, as alive humans that is.   Also, I feel that people who claim to read like a book a day or promote it are idiots. You retain nothing. When you do read a good book, you read slow, sometimes a whole paragraph, again and again, dwelling on it, trying to internalize its knowledge. You try to understand. You think. It takes time.   It's better to read a good book 10 times than 1000 stupid ones.   So be choosy. Read from the guys who actually know something, not some wannabe ‘influencers’.   Edit: Think And Grow Rich was written as a result of a project assigned to Napoleon Hill by Andrew Carnegie(the 2nd richest man in recent history). He was asked to study the most successful people on the planet and document which characteristics made them great. He did extensive work in studying hundreds of the most successful people of that time. The result was that little book.   Nowadays some people just study Instagram algorithms and think of themselves as a Dale Carnegie or Anthony Robbins. By Nupur Nishant, Quora Profits from free accurate cryptos signals: https://www.predictmag.com/    
    • there is no avoiding loses to be honest, its just how the market is. you win some and hopefully more, but u do lose some. 
    • $CSCO Cisco Systems stock, nice top of range breakout, from Stocks to Watch at https://stockconsultant.com/?CSCOSEPN Septerna stock watch for a bottom breakout, good upside price gap
    • $CSCO Cisco Systems stock, nice top of range breakout, from Stocks to Watch at https://stockconsultant.com/?CSCOSEPN Septerna stock watch for a bottom breakout, good upside price gap
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.