[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Difference betwee OOS and IS



PureBytes Links

Trading Reference Links

Hi Louis --

The objective function is the formula that is used to give a single valued metric to each and every run of a system.  It measures the "goodness" of that run.   It allows comparison among alternatives.

Selecting the objective function that works best for You is the First Step in trading system design. 

Please read Chapter 4 again for an introduction to objective functions.  Then skip ahead and read Chapter 20 to see how the objective function is used to select the "best" among alternative systems.  And read Appendix A for a visual method of assuring yourself that you are satisfied with the objective function you are using.

I strongly recommend that you work through the examples in the copy of QTS that you already have, and thoroughly understand the concepts of objective function, in-sample / out-of-sample, and walk forward.

I'll make that even stronger.  Do Not begin testing trading systems until You understand objective functions and have selected The objective function by which You will measure Your success!

Thanks for listening,
Howard



On Tue, Apr 22, 2008 at 6:42 AM, Louis Préfontaine <rockprog80@xxxxxxxxx> wrote:

Hi Howard,

Thanks for the code and the information.  What exactly is doing the CMO Oscillator?  I tried to look for information on the web but did not find anything convincing.  It sure looks interesting and I will try to find more about it, but right now this look like mystery to me.

Something I wasn't sure in your book, is what you mean by objective function.  Do you mean choosing between RAR, or CAR, or K-Ratio, etc.?  I know this sound like a stupid question after I've read 75% of the book, but... well...  I wasn't sure.

I will try to follow the steps as you write them below.  However, I am still worried about MCS; I mean, in the steps you don't use any random optimization and you said not to worry about them.  I say that because it seems to me that in the walk-forward it can be easy to get lucky with some very good curve-fitting results.  And the more complex the rules, the more chances there is to get a very lucky result!  Well, this was my whole point: in the walk-forward I only get to see the absolute best return, and if there is no random optimization I can't rule out the luck factor!

Thanks!

Louis

p.s. Mike, thanks for the suggestion.  Is Pardo's book really good and is using afl code or codes that can be implemented easily to Amibroker?

2008/4/22, Howard B <howardbandy@xxxxxxxxx>:

Hi Louis --

If the system you are working with is actually the crossover of two simple moving averages, the results you get will probably not be very good.  I often suggest a simple system when I am trying to make a point that requires a system and I do not want the definition of the system to confuse the other point.  You will need a system that is more sophisticated to show good results.  Try the CMO Oscillator in the code posted below.

// CCT CMO Oscillator.afl
//
//    A CMO Oscillator
//
//

//    Two variables are set up for optimizing
CMOPeriods=Optimize("pds",61,1,101,5);
AMAAvg=Optimize("AMAAvg",36,1,101,5);

//    The change in the closing price is summed
//    into two variables -- up days and down days
SumUp = Sum(IIf(C>Ref(C,-1),(C-Ref(C,-1)),0),CMOPeriods);
SumDown = Sum(IIf(C<Ref(C,-1),(Ref(C,-1)-C),0),CMOPeriods);

//    The CMO Oscillator calculation
CMO = 100 * (SumUp - SumDown) / (SumUp + SumDown);

//Plot(CMO,"CMO",colorGreen,styleLine);

//    Smooth the CMO Oscillator
CMOAvg = DEMA(CMO,AMAAvg);
//    And smooth it again to form a trigger line
Trigger = DEMA(CMOAvg,3);
//    Buy when the smoothed oscillator crosses
//    up through the trigger line
Buy = Cross(CMOAvg,Trigger);
//    Sell on a downward cross, or 6 days,
//    whichever comes first
Sell = Cross(Trigger,CMOAvg) OR BarsSince(Buy)>=6;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

Plot(C,"C",colorBlack,styleCandle);

PlotShapes(Buy*shapeUpArrow+Sell*shapeDownArrow,
    IIf(Buy,colorGreen,colorRed));
Plot (CMOAvg,"CMOAvg",colorGreen,
    style=styleLine|styleOwnScale|styleThick,-100,100);
//Figure 20.2 CMO Oscillator

Now -- back to the issue of validating a trading system --

Tomorrow is out-of-sample.  You want to increase your confidence that your trading system will be profitable when you trade it tomorrow.  In order to do this, observe what happens after you have optimized a system over an in-sample period, then tested it on the immediately following out-of-sample data.  The automated walk forward process helps you do this.  Every step gives one more observation of the in-sample to out-of-sample transition.  If the cumulative out-of-sample results are satisfactory to you, then you have increased confidence that your real trades are likely to be profitable.  No guarantees.  The best we can hope for is a high level of confidence. 

At this point, do not worry about Monte Carlo. 

Just concentrate on:

1.  Select the objective function that You feel most comfortable with.
2.  Design and test the systems of interest to You.
3.  Experiment to find the length of the in-sample period.
4.  Perform the automated walk forward analysis.
5.  Examine the out-of-sample results.
6.  Decide whether or not to trade your system.

Thanks for listening,
Howard
www.quantitativetradingsystems.com




On Tue, Apr 15, 2008 at 7:03 PM, Louis Préfontaine <rockprog80@xxxxxxxxx> wrote:

Hi,

I've been experimenting with walking-forward, and I have some questions regarding how it works.

I ran a complete random optimization or buying/selling using the variables I set (a MCS in fact), and systematically OOS results were worst than IS.  I don't understand how it works, because whatever if the sampling is IS or OOS it is always the same variables that are in place.

Anyone could explain how this work?

Thanks,

Louis




__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___