All, I've been intermittently playing around with the enhanced system tester for several months now - must say it is very tricky. I have picked up several tips from this forum, so as a thank you, here's a contribution - a stepwise "Time Scan" simulation.
In order to test trading system ideas, it makes sense to test a large diversity of securities, and also to conduct the system tests over multiple time periods to understand how the system performs under different market conditions. The first part is easy in the EST - hundreds or even thousands of securities can be included in a simulation with a few clicks. I found the second part much more difficult, and it took me a long time to figure out a formula that works for stepwise scanning over several years and months, while systematically looking at different holding periods. IMHO, the difficulty is mainly related to very few date functions available within Metastock.
Anyway, here's an example solution for a simple Buy and Hold system, which can be easily modified to include various entry and exit rules, in order to compare with a Buy & Hold baseline. In this example, the system buys all available stocks in the first week of every Quarter for two years (2007 & 2008), and then holds those stocks for 1, 2, 3, or 4 Quarters. For my purposes, each "quarter" has 63 trading bars (or each month has 21 bars, and the whole year has 252 bars). Regarding the <5 condition for DayofMonth function - I found this to be necessary to take into account situations where the first few days of the month fall on a weekend or holiday.
Optimizations tab:
OPT1 (Year) - Min 2007, Max 2008, Step 1
OPT2 (Month) - Min 1, Max 12, Step 3
OPT3 (HoldQtrs) - Min 1, Max 4, Step 1
Buy tab:
Year()=OPT1 AND
Month()= OPT2 AND
DayofMonth() < 5
Sell tab:
HoldDays:=Barssince(Year()=OPT1 AND
Month()=OPT2 AND Dayofmonth()<5);
HoldDays>=63*OPT3
The result of running this system test is 32 sequential buy & hold tests within the same simulation, which
makes it very convenient to directly compare results from different entry
times and holding periods. After including additional entry and exit trading rules within above, it becomes possible to objectively compare the performance of those trading rules with the simple B&H system. I hope this is useful for some of the forum readers when trying out simulations in EST.
Now for the long time experts out there, here's a question... how to test various time-periods within the same simulation in EST, where each scan is bounded by specific dates? The motivation for doing this is to focus on specific time periods where the market was trending up, trending down, moving sideways, exhibiting high volatility etc. I tried assigning specific dates using the OPT function, but it did not work (see below for my failed attempt at a B&H simulation for two specific time periods).
{ Desired B&H time periods:
1. Jan 2, 2008 to Mar 30, 2009
2. Apr 1, 2009 to Jan 31, 2010 }
Optimizations tab:
OPT1 (Dates) - Min 1, Max 2, Step 1
Buy tab:
If(OPT1=1, YR:=2008,
If(OPT1=2, YR:=2009,
YR:=3000 ));
{last assignment intentionally false}
If(OPT1=1, MNTH:=1
If(OPT1=2, MNTH:=4
MNTH:=30 ));
{last assignment intentionally false}
If(OPT1=1, DAY:=2
If(OPT1=2, DAY:=1,
DAY:=300 ));
{last assignment intentionally false}
Year() = YR AND Month() = MNTH AND DayofMonth() = DAY
Sell tab:
Same approach as above... needless to say, it does not work and results in an error msg "Not a recognized name, constant or operator".
Any ideas to solve the problem?