|Top Previous Next|
The discussion thus far has centered around avoiding the unintentional introduction of postdictive errors, and we have shown the classic example, which is buying today’s open after referencing today’s close or any other price that occurred today, since doing so is an impossibility in the real world...even though Mechanica gives you the flexibility to test that historically.
With any new system, and particularly one who’s performance blows the lights out early in the development stage, you should immediately try and disprove its results. One of the first things to search for in this circumstance is the existence of an unintentional postdictive error.
As we’ve seen, Mechanica’s today-centric orientation gives you the flexibility to introduce postdictive errors. Some users take advantage of this flexibility and intentionally invoke postdictive errors to stress-test candidate systems.
For instance, for a long-term trend following system that ordinarily buys on the open today (BUYOPEN / SELLOPEN) based on something that happened yesterday, you could simulate maximum slippage by (instead), buying the day’s HIGH for all trades taken in the long direction, and selling the day’s LOW for trades in the short direction.
Keep in mind that such a strenuous test may give misleading results by destroying the profitability. For a shorter-term system that trades, for example, only the e-mini stock indexes (typically very little slippage) a less strenuous stress test may be in order.
Another benefit of allowing such testing is to simulate during-the-day decision making where each new trade is entered with knowledge of those that were previously entered on the same day. Mechanica's include today feature lets you try this. It works in conjunction with Category-related keywords.
Yet another benefit is that you will see some really exceptional results. True, you can't replicate those in actual trading. But seeing the sometimes astonishing simulated results that can be produced could lead one to consider working to create predictive algorithms. One might, for instance seek to develop an algorithm that is reasonably good at predicting the low of today based on past market action. Then he could use the (predicted) low as a trade entry or exit price.
The discussion thus far centered around avoiding the unintentional introduction of postdictive errors when your system is being run (Signals side operation).
But let's say you are employing USERDEFINEDRISK to define risk instead of using Mechanica's built-in risk definitionor or you are passing a value to your SIZ code in SIZING[n]. In either case it would be possible to create an untentional postdictive error on the SIG side that later leaks to the SIZ side. This would affect not only Initial Size operations, but Resize operations as well.
Let’s look at an example of how to avoid this.
The code shown below, and the discussion that follows, will explain how to correctly pass information from the SIG to the SIZ side, without introducing a postdictive error. This example uses the SIZING[n] variable to carry the risk measure.
SYSTEM = 3 'mandatory system identification
'miscellaneous code here
COL3 = SMA[CLOSE,34] 'EXIT indic. (long and short)
COL4 = (CLOSE – COL3) 'risk in points
COL5 = ABS[COL4] 'abs. value of risk in points
COL6 = POINTVALUE
SIZING = COL5 * COL6 'Yesterday’s risk (per contract), in dollars