DeBry.com - Research - MetaStock - Columnists
MetaStock® Plug-ins and more
PRODUCTS  |  SUPPORT

 

Using the Explorer to do a multiple-security quasi-system test

By Jon DeBry,
Last Update: 11:00 AM MT May 20, 1999

In my pursuit of the Holy Grail, I had found a formula that looked pretty good based on visual inspection of charts, but only gave a signal every two or three years. This made the System Tester an impractical way to test this formula. I needed a way to test the signal on all 9,000 of my securities.

Given the nature of my signal, I devised a way to use the Explorer feature in MetaStock to run a quasi-system test.

First off, I wanted to filter out securities that didn’t have a buy signal in the last year, so my filter is:

Filter
BarsSince( fml( "Holy Grail") ) <= 250

(The "Holy Grail" function simply returns 1 for a buy or 0 otherwise.)

Now we need to get the performance after the signal. We’ll assume that we buy at the open the day following the signal. The formula for the open the day after the signal is:

ValueWhen( 1, Ref(Cross( Fml("Holy Grail"), .5), -1), OPEN )

Now my signal is a super-short term signal, so I want to see the performance 3 days after the signal. First I need the close three days after the signal:

ValueWhen( 1, Ref(Cross( Fml("Holy Grail"), .5), -3), CLOSE )

And now I put the two previous formulas together to get the performance since the signal:

Performance (column A)
(ValueWhen( 1, Ref(Cross( Fml("Holy Grail"), .5), -3), CLOSE ) - ValueWhen( 1, Ref(Cross( Fml("Holy Grail"), .5), -1), OPEN ))/ValueWhen( 1, Ref(Cross( Fml("Holy Grail"), .5), -1), OPEN ) * 100

Now that’s pretty useful, but it would be even more useful if I could see how the performance compared to the S&P 500 during that same time period. To do this, we need to use the "P" variable, which allows you to reference a selected plot. Before running this exploration, you must open the S&P 500 and select the price series (this becomes the "P" variable). Note that with the "P" variable, we can’t reference the open or close, the "P" variable just gives us the close, so we’ll use the close on the day of the signal instead of the open the day after. This is a slight inconsistency in my methodology.

Performance of S&P 500 (selected as "P" variable) (column B)
(ValueWhen( 1, Ref(Cross( Fml("Holy Grail"), .5), -3), P) - ValueWhen( 1, Cross( Fml("Holy Grail"), .5), P))/ValueWhen( 1, Cross( Fml("Holy Grail"), .5), P) * 100

To get the relative performance, subtract the S&P’s performance from the securities performance and add 100 (thus, if the security matched the S&P, the relative performance would show 100, if the security trailed, the value would be below 100, and if it exceeded, the value would be above 100). The formula is:

Relative Performance (column C)
((ValueWhen( 1, Ref(Cross( Fml("Holy Grail"), .5), -3), CLOSE ) - ValueWhen( 1, Ref(Cross( Fml("Holy Grail"), .5), -1), OPEN ))/ValueWhen( 1, Ref(Cross( Fml("Holy Grail"), .5), -1), OPEN ) * 100) - ((ValueWhen( 1, Ref(Cross( Fml("Holy Grail"), .5), -3), P) - ValueWhen( 1, Cross( Fml("Holy Grail"), .5), P))/ValueWhen( 1, Cross( Fml("Holy Grail"), .5), P) * 100) + 100

Now when I run this exploration, I’ll only see the securities with signals in the last year, and I’ll see how well they performed in the three days following signal as compared to the S&P 500. Here’s my report:

To get the average performance from this report, copy the report (mouse click in the report window then press Ctrl+C) and paste to Excel. Then sum up the numbers and divide by the number of securities to get the average. My Holy Grail signal outperformed the S&P 500 by 2.7% in the three days following the signal. Not bad, and something I will investigate further.

Doing a system test this way fits my Holy Grail formula well, but for most formulas, you’ll want to use the full-featured and powerful System Tester. The System Tester allows you to optimize inputs, set commissions and slippage costs, set stops, set equity amounts, etc. Using the Explorer just gave me an idea whether my Holy Grail was an indicator worth pursuing further.

What is my Holy Grail? I’m not going to reveal that! Would you?


Jon DeBry is a former Equis programmer who now does MetaStock programming and consulting.  If you'd like Jon to write a formula for you, or even do a study similar to the one above, send mail to jdebry@debry.com.

 

Contact Us | Disclosure/Disclaimer


Adaptick, Inc.
Salt Lake City, Utah