PDA

View Full Version : Forward Looking Errors


connolly
19th April 2006, 08:16 PM
I think I may have a 'look ahead error' and I am not sure if it is in the MS or TS part of my program. The custom formula I created in MS calculates on the last day of data which I think means that it has no Look-Ahead elements. Is this always true?

I have a problem because get different trades in my final MS/TS simulations in forward tests v. back tests. When I eliminate all data after 2/28/06 and run a MS/TS test, I get identical trades until I get closer to 2/28 than if I run a test as of today 4/18/06 and look at the Trade Log for trades before 2/28. This phenomenon happens no matter what my end date.

Since I use no random elements or settings, and the Trade Databases are the same for both the shorter and longer tests before 2/28, something must be "seeing" that something is different after 2/28 for the two tests- No?

Jose
21st April 2006, 10:23 AM
Connolly, without looking at your MetaStock code used, there is no real way of determining if any hindsight is being used in the code.


jose '-)

connolly
21st April 2006, 12:02 PM
Jose:

Without burdening you with reviewing my formula (yet!), it is my understanding that if any element of a formula 'looks-ahead' it will not calculate (draw a line on a chart) on the last day of data.

For example, even if I use (c>ref(c,-1) or c>ref(c,1)) where the system has an option to look back OR possibly execute a forward looking element it won't calculate even if the first look-back element is true.

Just to clarify: 1) is calculation on the last day of data a good test of forward elements 2) are there other general things that you would look for 3) should I just give you my formula?

Jose
21st April 2006, 12:32 PM
MetaStock can plot forward-looking code with the help of the LastValue() function. e.g. LastValue(C>Ref(C,100)) will plot to the last bar.

Other "cheats" are all the ZigZag-based functions, such as Peak()/Trough(), etc.

Another more subtle one:
entry:=Close>Open;
entryPrice:=Open;


Anyway, the easiest solution would be to take a look at your code.


jose '-)