StockFetcher Forums · General Discussion · BackTesting<< >>Post Follow-up
5 posts
msg #33854
Ignore Uppercut
11/9/2004 5:02:09 PM

I am trying to backtest a screen using a method posted by Cegis. My idea was to offset this every day for a year, download the results and see how my screen did day-by-day for fifteen days. I am getting a lot of erroneous information for stock prices. It looks like just a lot of randam errors (stock split calculations, older historical information for stocks that just began trading, etc.). I thought I might post my formula just in case something else was wrong; although the only thing I can foresee is too many set statements.


set{zero, close 30 days ago}
set{one, close 29 days ago}
set{two, close 28 days ago}
set{three, close 27 days ago}
set{four, close 26 days ago}
set{five, close 25 days ago}
set{six, close 24 days ago}
set{seven, close 23 days ago}
set{eight, close 22 days ago}
set{nine, close 21 days ago}
set{ten, close 20 days ago}
set{eleven, close 19 days ago}
set{twelve, close 18 days ago}
set{thirteen, close 17 days ago}
set{fourteen, close 16 days ago}
set{fifteen, close 15 days ago}

Show stocks where parabolic sar 31 days ago was above close 31 days ago
and close 30 days ago is above parabolic sar 30 days ago
and +DI(45) 30 days ago is above 30
and close 30 days ago is above 5
and average volume(10) is above 75000

add column zero
add column one
add column two
add column three
add column four
add column five
add column six
add column seven
add column eight
add column nine
add column ten
add column eleven
add column twelve
add column thirteen
add column fourteen
add column fifteen

date offset 1

123 posts
msg #33855
Ignore jpistell
11/9/2004 8:12:15 PM

How can you back test the script performance without an exit? Without an exit you'll only get limited feedback out your scripts abilities.

What about draw down?

What about "time in the market"
(i.e. I'll prefer many small gains from very short term holds that have small draw downs vs. multi-month gains that have significant draw downs).

235 posts
msg #33856
Ignore cegis
11/9/2004 8:26:11 PM


Well, since it IS my technique that you're trying to implement, please let me comment:

- First, it all looks ok EXCEPT the average volume phrase should also have the "30 days ago" phrase. This is something that I've overlooked frequently, and it's easy to do :-).

- Secondly, although there's nothing wrong with going back the full 30 days, you only really need to go back 16, so you can get the following 15 day's worth of data. The only thing about using 30 is that you'll be missing the most recent 15 days worth of data.

- Lastly, again there's nothing wrong with it, but you don't really need the set{} statements. You can just "add column 30 days ago {zero}". I only mention this because SF puts limits on the use of set{}s, so it may be an issue if you are using set{}s for other purposes in a filter. The 15 set{} you have should not be a problem in this filter, though. (I've used more than 15 in some of my filters with success...)

- One other thought came to mind: SF may use "zero", "one", ... etc. as "reserved words". In other words, SF may recognize these words and do something unexpected (to you) with them. You may want to try "day0", "day1", ... or "d0", "d1", ... (This is a wild guess, but possible...)

If these suggestions don't help, it may need a look-see by TomB...



P.S., I've been using this technique quite a bit over the past few weeks and have not noticed anything obviously wrong...

123 posts
msg #33857
Ignore jpistell
11/9/2004 8:34:19 PM

Given SF's limitations there still is a mountain of excellent data that it produces.

Here's my $0.02.
How well does your script do when the market is trending positive vs negative?

Create your script and "date offset" it into a friendly market, and then into a hostile market. I use symbol MDY (S&P mid caps) as an overall reference. As of today, Nov. 9th., Take a look at a date offset of 85 vs. date offset of 55. You'll see your script work thru favorable markets and downright hostile times.

IMO, its how well your script "keeps your powder dry" that makes for a super cash multiplier.

Here's how I interpet your scripts performance:
Monday July 12, 2004 = 85 days back: date offset is 85
==1st week.==
11 picks all parallel the market with midly negative overall perofmance. Poor win/loss ratio
==1st Month.==
All 11 picks are neg. and parrrell the markets performance.
==3rd Month==
2 winners, 9 losers. Market's all the way back to flat, your down 9%

Tuesday August 24, 2004 = 55 days back: date offset is 55
Rougly 30 Trading Days later, the market been thru hell and its looking a lot better (read:oversold)
==1st week.==
10 picks that are slightly ahead of the market. win/loss ratio is far better (but so is the market).
==1st Month.==
Picks are net neg. and is just behinds the markets performance.
==3rd Month==
7 winners, 3 losers. Market's + 11.25%, your scripts at 14%.

Set a goal to out perform the market 2:1 and be sure to write it to work in the bad times as well as the good.

5 posts
msg #33858
Ignore Uppercut
11/9/2004 11:40:27 PM


Thank you for the insight about overlooking the average volume phrase. I realized your second point some where in the middle of playing with the backtesting script you provided but forgot to change it. I knew there was a limit on the set statements, but when I saw that it returned data I thought maybe since I was not defining a variable that I used directly in my equation StockFetcher would let me get away with it. I will try changing the named variables and see if that makes a difference.


I agree with everything you said. When I saw Cegis backtesting script, it occured to me that you could test a screen based only on Entry Point, and then take the rest of the data and create a rule for an exit strategy. So while I appreciate your feedback, I think you overlooked the purpose of my screen.

At any rate, thanks for the help guys.

123 posts
msg #33865
Ignore jpistell
11/10/2004 1:19:16 PM

Sorry, I couldn't see any meaningful data coming from the string of closes. No OHLC, no deep historical data to plot indicators. Maybe a raw sell stop at X% and take profits at X%.

IMO, SF has an interesting Filter Performance Window that allows a decent foundational review, albeit non descript.

5 posts
msg #33868
Ignore Uppercut
11/10/2004 3:44:10 PM

Please elaborate on the "Filter Performance Window"; I am not familiar with this.

123 posts
msg #33874
Ignore jpistell
11/10/2004 7:00:56 PM


Create your script page, example:
Fetcher[Show stocks where parabolic sar 31 days ago was above close 31 days ago and close 30 days ago is above parabolic sar 30 days ago]

Then click column: "results 3 months ago"

This leads you to a window with a column marked "Performance"<---Click it.

This launches a new window that has all kinds of historical performance data.

You'll find:
The filters Quantity of hits
The quantity of winners vs losers (aka advance/decline ratio)

It'll break down the Filters NET performance over:
and to today

This Performance is also broke out in gains vs. losses (over time) and
Filter Performance v.s Index Performance. (over time)

Its really robust considering the low cost of SF.

5 posts
msg #33875
Ignore Uppercut
11/10/2004 7:35:05 PM

Oh yes, I am familiar with this. That mirrors the purpose behind my script. The only expception being, I wanted this information for every stock that had triggered my entry point for the past 250 days, as opposed to looking at it one stock at a time. That was the key benefit I saw in Cegis's backtesting method.


StockFetcher Forums · General Discussion · BackTesting<< >>Post Follow-up

*** Disclaimer *** does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. does not recommend particular securities., Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.

Copyright 2016 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus