helene
16th February 2004, 03:39 AM
Hi all,
Was wondering if anyone could help me with a coding issue I have.
When running my exploration in Metastock, I have some rejected stocks with the following error messages for the exit price:
Error found in LONG trade [XFJ] on 11-Feb-2002 caused by Invalid Exit Price Data.
Details: [Exit Price(4281.841309)] < [Exit Price Low(4302.500000)]
Error found in LONG trade [XFJ] on 12-Feb-2004 caused by Invalid Exit Price Data.
Details: [Exit Price(4044.815674)] < [Exit Price Low(4091.000000)]
Error found in LONG trade [XHJ] on 31-Dec-2002 caused by Invalid Exit Price Data.
Details: [Exit Price(3442.092529)] < [Exit Price Low(3462.800049)]
I think that there must be an error in my code somewhere but I cannot find it and am having trouble working out why the system is exiting on these days and where it is getting the exit price data from. The code for my system below - the first part is the code is for the formula used in the system:
Fml("Guppy MMA (Short Term)")>Fml("Guppy MMA (Long Term)") AND Mov(C,3,E)>Mov(C,15,E) AND Mov(C,15,E)>Mov(C,30,E)+0.4*ATR(30) AND C>Mov(C,15,E) AND Ref(H,+1)>H
LongEntryTrigger := Fml("Entry Conditions Index");
LongEntryPrice := Ref(H,-1);
LongEntryPrice := If( OPEN > Ref(H,-1), OPEN, Ref(H,-1));
LongExitTrigger := ExtFml("TradeSim.TrailingStop",
TRIGGER,
LONG,
1.75*ATR(30),
L,
LOW);
LongExitPrice := HighestSince(1,Fml("Entry Conditions Index"),L) - 1.75*(ATR(30));
LongExitPrice:= If( OPEN < (HighestSince(1,Fml("Entry Conditions Index"), L) - 1.75*(ATR(30))), OPEN, (HighestSince(1,Fml("Entry Conditions Index"), L) - 1.75*(ATR(30))));
LongInitialStop:= Ref(H,-1)-1*ATR(30);
ExtFml("TradeSim.Initialize");
ExtFml("TradeSim.EnableDelayOfEntryByOneBar");
ExtFml("TradeSim.EnableProtectiveStop",0);
ExtFml("TradeSim.SetExitPriceToInitialStop");
ExtFml("TradeSim.SetStopGapPriceToOpen");
ExtFml("TradeSim.RecordTrades","INDEX SYSTEM",
LONG,
LongEntryTrigger,
LongEntryPrice,
LongInitialStop,
LongExitTrigger,
LongExitPrice,
START);
Any help would be greatly appreciated.
Regards
Helene
:?: :?: :?:
Was wondering if anyone could help me with a coding issue I have.
When running my exploration in Metastock, I have some rejected stocks with the following error messages for the exit price:
Error found in LONG trade [XFJ] on 11-Feb-2002 caused by Invalid Exit Price Data.
Details: [Exit Price(4281.841309)] < [Exit Price Low(4302.500000)]
Error found in LONG trade [XFJ] on 12-Feb-2004 caused by Invalid Exit Price Data.
Details: [Exit Price(4044.815674)] < [Exit Price Low(4091.000000)]
Error found in LONG trade [XHJ] on 31-Dec-2002 caused by Invalid Exit Price Data.
Details: [Exit Price(3442.092529)] < [Exit Price Low(3462.800049)]
I think that there must be an error in my code somewhere but I cannot find it and am having trouble working out why the system is exiting on these days and where it is getting the exit price data from. The code for my system below - the first part is the code is for the formula used in the system:
Fml("Guppy MMA (Short Term)")>Fml("Guppy MMA (Long Term)") AND Mov(C,3,E)>Mov(C,15,E) AND Mov(C,15,E)>Mov(C,30,E)+0.4*ATR(30) AND C>Mov(C,15,E) AND Ref(H,+1)>H
LongEntryTrigger := Fml("Entry Conditions Index");
LongEntryPrice := Ref(H,-1);
LongEntryPrice := If( OPEN > Ref(H,-1), OPEN, Ref(H,-1));
LongExitTrigger := ExtFml("TradeSim.TrailingStop",
TRIGGER,
LONG,
1.75*ATR(30),
L,
LOW);
LongExitPrice := HighestSince(1,Fml("Entry Conditions Index"),L) - 1.75*(ATR(30));
LongExitPrice:= If( OPEN < (HighestSince(1,Fml("Entry Conditions Index"), L) - 1.75*(ATR(30))), OPEN, (HighestSince(1,Fml("Entry Conditions Index"), L) - 1.75*(ATR(30))));
LongInitialStop:= Ref(H,-1)-1*ATR(30);
ExtFml("TradeSim.Initialize");
ExtFml("TradeSim.EnableDelayOfEntryByOneBar");
ExtFml("TradeSim.EnableProtectiveStop",0);
ExtFml("TradeSim.SetExitPriceToInitialStop");
ExtFml("TradeSim.SetStopGapPriceToOpen");
ExtFml("TradeSim.RecordTrades","INDEX SYSTEM",
LONG,
LongEntryTrigger,
LongEntryPrice,
LongInitialStop,
LongExitTrigger,
LongExitPrice,
START);
Any help would be greatly appreciated.
Regards
Helene
:?: :?: :?: