PDA

View Full Version : problem understanding initial stop


longshorts
2nd October 2004, 11:34 PM
Hi,
I am finding that if when doing an exploration a trade returns an initial stop error, i.e

===============================================

Error found in LONG trade [MCC] on 3-Apr-2003 caused by Invalid Initial Stop Data.
Details: [Initial Stop Price(1.127752)] >= [Entry Price(1.127752)]

that no other trades for that security turn up in the database.
If I set InitialStop:= 0 and run it again I will get say 11 trades for that security. Why is tradesim rejecting all the trades when only one is failing the initial stop test?

Explorer code is:
LongEntryTrigger:= Cross(C,Ref(HHV(H,20),-1))
AND Mov(C,7,S)>Mov(C,20,S)
AND OPEN<=(Ref(C,-1)+ATR(30));
LongEntryPrice:= OPEN;
LongInitialStop:=LLV(L,5);
LongExitTrigger:= ExtFml("TradeSim.TrailingStop",trigger,long,3.6*atr(30),h,c);
LongExitPrice:= OPEN;

ExtFml("TradeSim.Initialize");
ExtFml("TradeSim.SetStartRecordDate", 7,5,2002);
ExtFml("TradeSim.SetStopRecordDate", 30,8,2004);
ExtFml( "TradeSim.EnableDelayOfEntryByOneBar");
ExtFml( "TradeSim.EnableDelayOfAllExitsByOneBar");
ExtFml( "TradeSim.EnableProtectiveStop",0);
ExtFml( "TradeSim.SetStopGapPriceToOpen");
ExtFml( "TradeSim.UseClosingPriceAsStopThreshold");

ExtFml( "TradeSim.RecordTrades",
"cross20DH",
long,
LongEntryTrigger,
LongEntryPrice,
LongInitialStop,
LongExitTrigger,
LongExitPrice,
START);


Thanks
Longshorts

David Samborsky
4th October 2004, 01:34 AM
Error found in LONG trade [MCC] on 3-Apr-2003 caused by Invalid Initial Stop Data.
Details: [Initial Stop Price(1.127752)] >= [Entry Price(1.127752)]

Its saying that your InitialStop can't be higher or equal to your Entry Price otherwise the trade is stopped out before it is even taken !!

You problem appears to be in your InitialStop assignment.

LongInitialStop:=LLV(L,5);

longshorts
4th October 2004, 02:24 AM
Hi David,
I understand your explaination, I just don't understand why all subsequent valid trades seem to be completely ignored. Why should a particular security be completely excluded from a backtest just because on one occasion the open was lower than the fixed stop. If I was trading this system in reality, I would not go with that particular trade, but I wouldn't completely ignore it from that day forward. Tradesim seems to be doing this, but I am really keen to find out if this is the case and if there is any way around
Thanks,
Longshorts.

David Samborsky
4th October 2004, 11:39 AM
I understand your explaination, I just don't understand why all subsequent valid trades seem to be completely ignored.


You will find that the remaining subsequent valid trades are still written out to the trade database even though the explorer is reporting an error for that one particular trade ;-)

longshorts
4th October 2004, 08:38 PM
Ok David,
Now I see.
When I ran the explorer on just one security (mcc), MS reported that 100% of securities were rejected. Take out the initial stop and 11 trades come up. Made me think there was a problem, so I didn't even check the database. Bit of a trap for young players!
Thanks,
Longshorts

David Samborsky
5th October 2004, 01:15 AM
The Metastock external plugin interface standard is a bit limited at times which makes it difficult to design the plugins to be interactive and provide feedback for the user. I have tried to counteract this by providing the error log etc. :o