Sell in May and go away on ASCII Close Only data
Author: gbullr
Creation Date: 5/6/2013 9:15 PM
profile picture

gbullr

#1
I have a backtest for "sell in may and go away" that I would like to backtest w/ the FRED data for the DOW since 1900. The backtest worked for Data provided by yahoo (^DJI). FRED data has close only data and the backtest does not seem to work. I created a ASCII dataset w/ the FRED data.

Suggestions?

CODE:
Please log in to see this code.


Thanks for your help
profile picture

Eugene

#2
Aside from the impossible buying yesterday if today is November (change "bar-1" to "bar"), the code works. If your experience is diffferent, what do you think does not "work", precisely? How it should work?

P.S. It does not make difference if the DataSet has Close price only: the "missing" pieces are equal to the Close i.e. O=H=L=C.

P.P.S. Also, if you switch to Monthly data you'd want to start from bar = 1, not 20 (won't hurt on Daily data either).
profile picture

Cone

#3
<< Aside from the impossible buying yesterday if today is November >>

Well, for a backtest you can consider this legal peeking. It's just a quick and dirty way to buy on the last bar of October, a day which is known well in advance.
profile picture

Eugene

#4
Sure it's legal - just counterintuitive.
profile picture

gbullr

#5
Thanks guys.

I realize I am cheating it was done on purpose.

The problem is that when I run the backtest on the ASCII data it does not show any trades.

profile picture

Eugene

#6
Could you give us something to start with?

1. Symbol name. Leave a pointer to the FRED site or (better) attach the ASCII file itself.
2. ASCII DataSet settings
3. Single symbol or Multi-symbol mode
4. Selected position sizing
5. Data Loading settings
profile picture

gbullr

#7
Symbol Name: DJIA http://research.stlouisfed.org/fred2/series/DJIA
2. ASCII DataSet settings: Daily
3. Single symbol or Multi-symbol mode: Single
4. Selected position sizing: 100%
5. Data Loading settings: What does this mean?

I start the data on 1 / 1 / 1900 because I did not manipulate data enough to get the data formats the same and from 1895 to 1900 the date is in a different format than for the 1900 onwards data.


profile picture

Eugene

#8
QUOTE:
4. Selected position sizing: 100%


Please find 100% of Equity Sizing in the User Guide, and see How can this Cause Dropped Trades?
profile picture

gbullr

#9
I tried all sort of position sizes and it did not work.

Made sure that it worked w/ good data and then clicked on Dow data from 1900 which creates a chart w/ no trades despite trying position sizes anywhere from 5% to 90 %.

How do I get you the datafile?

profile picture

Eugene

#10
QUOTE:
I tried all sort of position sizes and it did not work.


It seems that actually you did not try all sorts (btw, "all sorts" is not clear/descriptive) because the code works perfectly with 1-share Raw Profit mode. Voila. Case closed.

QUOTE:
How do I get you the datafile?


It's not required now, but next time simply click on "Add Attachment(s)" before posting.
profile picture

gbullr

#11
I am sorry but when you say "voila case closed" I am not sure what you mean. I just tried on my computer 1 share raw profit mode and I don't get any trades in the backtest.

I tried to send you the WLF and or the CSV file and I got an error on both when I tried to attach. AM I doing something wrong?

Thanks.

profile picture

Eugene

#12
I'm at a loss what a WLF (fundamental data) file has to do with it. I'm not really interested in seeing the CSV file because I have downloaded it myself using the FRED link you supplied yesterday. The downloaded comma-separated data file had poor quality (not sure why you called it "good" then), namely it had omissions that would have prevent you from creating a DataSet out of it all without fixing it first. After fixing a dozen of errors in Notepad++ manually and importing it with appropriate settings, your strategy runs fine on DJIA and produces trades using any position sizing with All Data. For me, the case is closed.

If your experience is different from mine, I'd suggest that you download the file again, fix the errors in it, set 1 share in RP mode (and not Port Sim mode 1 share), choose "All Data", notice how many skipped trades there are (if any), and indicate what other settings are in use (commission, slippage, etc). Don't hesitate to provide screenshots of what you're seeing, your ASCII DataSet configuration. In other words, anything else that may help us reproduce the error quickly and effectively.

P.S. An error on attaching something might indicate that Flash/Silverlight browser plugins are disabled or not installed.
profile picture

gbullr

#13
I have downloaded the files. Fixed the errors (#nas) and I still get nothing.

I will put up screenshots in a bit.

Sorry..

profile picture

Eugene

#14
Please don't forget to indicate how many skipped trades there are (if any), what other settings are in use (commission, slippage, etc), Symbol Info Manager (if DJIA is included) etc.
profile picture

gbullr

#15
Chart: Meaning that datafile was uploaded correctly?
You can see:
Scale: Daily
Data Range: All Data
Position Size: 1 Shares(RP)

Other Settings: Apply Commissions to simulated trades is checked
Commissions 7.95




Performance: Showing no trades were done:


Preferences:


Thanks.
profile picture

Eugene

#16
Absolutely no luck reproducing it.

Actually, I think your saved code has a compile error. It simply did not run. Or a runtime error before it had a chance to trade a single time. Try compiling, and monitor the Editor tab after the Strategy's executed.
profile picture

gbullr

#17
Compiles successfully.

I don't what is going on. Really weird.

Any chance you can send me your data file?


Figured it out.

I had to format the entire date column in the CSV file in the same format.

Sorry.


profile picture

Eugene

#18
Well, I think it's my turn now to figure out how can one import a CSV file with different formats in the Date column.

EDIT

Good news. The FRED static data provider I created by your request will become available very soon. All you'll have to do is type in "DJIA" in the New DataSet Wizard, and never care about the data errors.
profile picture

gbullr

#19
Great Eugene.

Thanks very much.