StockFetcher Forums · Filter Exchange · HOW TO DESIGN A SYSTEM (NOT JUST A FILTER)<< 1 ... 39 40 41 42 43 >>Post Follow-up
marine2
963 posts
msg #115919
Ignore marine2
10/15/2013 12:28:54 AM

Yeah, like I need another investment book like the Octo-mom needs another kid :-) My wife told me, if I bought another investment book we would need to move to a house with a library room :-)

amtmail
34 posts
msg #115981
Ignore amtmail
10/16/2013 7:08:29 PM

Please Kevin can i enter at the middle of the day since some times the filter showed one stock at middle of the day then it disappear at the end of the day because the price goes higher.

Kevin_in_GA
4,599 posts
msg #115982
Ignore Kevin_in_GA
10/16/2013 7:29:49 PM

Yes - I've occasionally done that. It generally works but it is technically outside of the system rules that I used for the backtesting.

amtmail
34 posts
msg #117332
Ignore amtmail
12/12/2013 1:04:58 AM

when i back test the system i put (select by RSI(2) ascending), is this correct or it should be( select by volume descending) ?

Kevin_in_GA
4,599 posts
msg #117333
Ignore Kevin_in_GA
12/12/2013 8:41:00 AM

No - I already answered this question earlier in the thread. You sort by zscore(16) but you need to put the following in as well:

Here is the specific code I use in the backtest for sorting:

SET{PRICERATIO, CLOSE / IND(^spx,CLOSE)}
SET{RATIOMA16, CMA(PRICERATIO,16)}
SET{RATIOSTD16, CSTDDEV(PRICERATIO,16)}
SET{DIFF16, PRICERATIO - RATIOMA16}
SET{ZSCORE16, DIFF16 / RATIOSTD16}

sort by zscore16 ascending

Kegger
3 posts
msg #118752
Ignore Kegger
3/25/2014 2:04:29 PM

Can someone help me a little? I must be doing something wrong. I backtested this filter (the original posted filter) from the period of 1/1/2002 - 1/1/2004 and started with a initial account of 100,000 and ended with an account balance of 721,957! These results are wildly different than the original results so clearly I'm missing something. Here are the exact settings I used:

Entry filter:
/*FIRST DETERMINE HISTORICAL RATIO OF S&P STOCK TO THE SPY OVER THE LAST 16 DAYS*/
SET{PRICERATIO, CLOSE / IND(^SPX,CLOSE)}
SET{RATIOMA16, CMA(PRICERATIO,16)}
SET{RATIOSTD16, CSTDDEV(PRICERATIO,16)}
SET{DIFF16, PRICERATIO - RATIOMA16}
SET{ZSCORE16, DIFF16 / RATIOSTD16}
SET{THRESHOLD16, RATIOSTD16 * 2}

/*NEXT, SET CRITERIA NECESSARY TO TRIGGER A PAIR TRADE*/

SET{UPPERBAND16, RATIOMA16 + THRESHOLD16}
SET{LOWERBAND16, RATIOMA16 - THRESHOLD16}

zscore16 below -2
williams %R(16) below -94
close below lower Bollinger Band(16,2)
close above MA(200)


Exit Criteria:
SET{PRICERATIO, CLOSE / IND(^SPX,CLOSE)}
SET{RATIOMA16, CMA(PRICERATIO,16)}
SET{RATIOSTD16, CSTDDEV(PRICERATIO,16)}
SET{DIFF16, PRICERATIO - RATIOMA16}
SET{ZSCORE16, DIFF16 / RATIOSTD16}
SET{THRESHOLD16, RATIOSTD16 * 2}

zscore16 above -1

Selection Method:
SET{PRICERATIO, CLOSE / IND(^SPX,CLOSE)}
SET{RATIOMA16, CMA(PRICERATIO,16)}
SET{RATIOSTD16, CSTDDEV(PRICERATIO,16)}
SET{DIFF16, PRICERATIO - RATIOMA16}
SET{ZSCORE16, DIFF16 / RATIOSTD16}
select by ZSCORE16 ascending


Commission per trade: 5.95
Max Holding Days: 20
Shuffle Entry: No
Entry Price: open
Conditional Entry: No
Use Match Date Close: No
Exit Price: open
Maximum Trades Per Day: 2
Maximum Open Positions: 5
Maximum Selected Stocks: 10
Close OPEN Positions at End: No
Allow Multiple Positions Per Symbol: No
Force Same Day Trade: No

FWIW - I tried adjusting max trades per day, max open positions, and max holding days and they affected the results down a little, but still I was ending around 600-700K everytime. The original results from Kevin showed much different results for this time period. I tried looking through other posts but this thread is extremely long so apologies in advance if this has already been asked before.

Kevin_in_GA
4,599 posts
msg #118755
Ignore Kevin_in_GA
3/25/2014 6:38:18 PM

Maximum Trades Per Day: 2
Maximum Open Positions: 5
Maximum Selected Stocks: 10

+++++++

The original equity curve posted was using 10 positions, with compounding. All the above variables should be set to 10. However, you are probably going to get a different result as I have not seen a high degree of alignment between SF backtesting and other backtests.

Also, I used 8.95 per trade and allowed 0.02 in the bid/ask spread.

Kevin_in_GA
4,599 posts
msg #118756
Ignore Kevin_in_GA
3/25/2014 6:39:36 PM

Also, make sure you are only selecting S&P 500 as the market (the very first line in the original filter).

Kegger
3 posts
msg #118768
Ignore Kegger
3/26/2014 10:02:17 AM

Ah ha! I missed that very first line! What huge difference that made. Using those settings the numbers are a lot more in line with what I expected to see. Also, I didn't see an option in SF to control the bid/ask spread, I'm guessing you tested this somewhere else. Anyway, thanks for the help and the quick response!

Of course, this all begs the question, why were my returns so much higher? I understand now that I was correlating stocks to an index that they don't belong to, probably ruining the entire basis of the pair trade that this system was built on. So is there any value to exploring this or was it just dumb luck that the returns were ridiculous? I guess there is only one way to find out....more testing!


Kevin_in_GA
4,599 posts
msg #118775
Ignore Kevin_in_GA
3/26/2014 11:51:12 AM

One issue you are encountering is survivorship bias - the stocks that SF lists today do not include all of the stocks that were traded in 2002. Many, many delisted stocks that are not reflected in your backtesting, especially among small and microcaps. In your backtesting you are unintentionally selecting only those which have survived and prospered (this usually leads to better results than you should have gotten).

My suggestion is to use a more recent timeframe. I develop and optimize my systems using 1/2/2007 - 1/2/2012 since that contains a massive drop as well as a huge recovery. Any good system should be stable to lots of different market conditions.

Then test the system against the out-of-sample period 1/2/2012 - 1/2/2014 and see how well it did. This gives you a better idea of how the system handles new data and is more reflective of how it might trade going forward.

I also use the S&P 500 since the list does not turn over all that fast, thus minimizing survivorship bias.

StockFetcher Forums · Filter Exchange · HOW TO DESIGN A SYSTEM (NOT JUST A FILTER)<< 1 ... 39 40 41 42 43 >>Post Follow-up

*** Disclaimer *** StockFetcher.com 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. StockFetcher.com does not recommend particular securities. StockFetcher.com, 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 2022 - 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


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.