PDA

View Full Version : tradesim results make no sense


gawdib
30th June 2004, 03:12 AM
I am using the following code on weekly data:

It says: when the stock SPY has this particular indicator show up on previous "bar", then buy all stocks in the exploration list at the open.

zz18:= Security( "c:\metastock data\leapstocks\spy" ,If(Fml("roc17good(4)") ,1,0) );

LongEntryTrigger:= Ref(zz18=1 ,-1); LongEntryPrice := 0;

LongExitTrigger := If(Fml("spxc"),LOW<=Ref(Fml("Stop buy 4"),-1),LOW<=Ref(Fml(" buy 3"),-1)); LongExitPrice := Fml("exitpricespxc") ; LongInitialStop := 0; ExtFml("TradeSim.Initialize");ExtFml("tradesim.settimestop",15);
ExtFml("tradesim.setstartrecorddate",1,12,1990);ExtFml("tradesim.setstoprecorddate",20,6,2004);ExtFml("tradesim.enablepricefilter"); ExtFml( "TradeSim.RecordTrades",
"JUNE26 combo roc e2", LONG, LongEntryTrigger, LongEntryPrice, LongInitialStop, LongExitTrigger, LongExitPrice, START);

When I apply the buy criteria as an indicator in a Metastock chart, I see that there are only 2 dates, that will allow a buy. 2/24/95 and 6/13/97. therefore , for example, should not it be that only the stocks that Monday June 16 have an open that day (basically all stocks in the exploration portfolio in exsistence June 16) should have a entry in tradesim that day?
Yet the following is the trade log, that shows a lot of ? impossible? buying after june 16. (and none on Monday June 16!, when the market opens),
Lots of entries June 18, 19, 20, 27, 1997. Then just one 8/01/97 and one 7/17/98, So these single stock outlyers make even less sense, since there is no existing buy signal on the previous bar in SPY.

Please be so kind as to explain what could be going wrong? thank you and regards, geoffrey

Jose
5th August 2004, 03:18 PM
Geoffrey, MetaStock's Security() function has a couple of bugs that can result in erratic data processing:

1) Avoid switching between periodicities;
2) Avoid using any formula within the Security() function.


"zz18:= Security( "c:\metastock data\leapstocks\spy" ,If(Fml("roc17good(4)") ,1,0) );"

To tell you the truth, I can't make sense of the line of code above.
This is most likely the source of any TradeSim exploration errors.

jose '-)