View Full Version : no mans land
richterm
30th March 2004, 08:52 AM
How do I program Tradesim not to exit if the trigger day is in the zone where the closing price is less that the buy price but more than the protective stop?
How do I set the opening price to be no more than 3*ATR(30) on the enter date
I have programmed metastock to read:
EntryPrice:=InitialStop + 3*ATR(30) ;
NewEntryPrice:=If(L>EntryPrice,0,EntryPrice);
NewEntryPrice:=If(H<EntryPrice,O,EntryPrice);
thank you
Martin richter
Jose
30th March 2004, 06:22 PM
Post the whole TradeSim Exploration code, as well as Entry & Exit MetaStock code, and I'll see what I can do.
jose '-)
richterm
30th March 2004, 10:36 PM
Jose, thanks here it is
EntryTrigger:= Cross(C,Ref(HHV(H,20),-1)) AND
Mov(C,100,S) > Ref(Mov(C,100,S),-50) AND
C >=1 AND C<=10 AND
ATR(30)/C > .025 AND
ATR(30)/C < .075 AND
Mov(C,50,S)*Mov(V,50,S) >= 500000 AND Mov(C,50,S)*Mov(V,50,S)<5000000;
InitialStop:=LLV(L,5);
EntryPrice:=InitialStop + 3*ATR(30) ;
NewEntryPrice:=If(L>EntryPrice,0,EntryPrice);
NewEntryPrice:=If(H<EntryPrice,O,EntryPrice);
ExitTrigger:=ExtFml("TradeSim.TrailingStop", trigger, long, 2.5*ATR(30),H,C);
ExitPrice:= O;
ExtFml( "TradeSim.Initialize");
ExtFml("TradeSim.GetSymbolLength")<=3;
ExtFml( "TradeSim.SetExitPriceToInitialStop");
ExtFml( "TradeSim.SetStopGapPriceToOpen");
ExtFml( "TradeSim.EnableProtectiveStop",0);
ExtFml("TradeSim.SetExitPriceToInitialStop");
ExtFml( "TradeSim.EnableDelayOfEntryByOneBar");
ExtFml("TradeSim.EnableDelayOfAllExitsByOneBar");
ExtFml( "TradeSim.SetStartRecordDate", 01,01,1996);
ExtFml( "TradeSim.SetStopRecordDate", 31,12,2003);
ExtFml( "TradeSim.RecordTrades", "x20dh",Long,
EntryTrigger,
NewEntryPrice,
InitialStop,
ExitTrigger,
ExitPrice,
START);
Martin
Jose
31st March 2004, 04:42 PM
---8<----------------------------
InitialStop:=LLV(L,5);
EntryPrice:=InitialStop+3*ATR(30);
NewEntryPrice:=If(EntryPrice<L,L,EntryPrice);
NewEntryPrice:=If(EntryPrice>H,H,EntryPrice);
EntryTrigger:=Cross(C,Ref(HHV(H,20),-1))
AND Mov(C,100,S)>Ref(Mov(C,100,S),-50)
AND ATR(30)/C>.025
AND ATR(30)/C<.075
AND Mov(C*V,50,S)>=500000
AND Mov(C*V,50,S)<5000000
AND C>=1
AND C<=10
AND O<=NewEntryPrice;
NoExit:=C<NewEntryPrice AND C>InitialStop;
ExitTrigger:=ExtFml("TradeSim.TrailingStop",
trigger,long,2.5*ATR(30),H,C) AND NoExit=0;
ExitPrice:=O;
ExtFml("TradeSim.Initialize");
ExtFml("TradeSim.GetSymbolLength")<=3;
ExtFml("TradeSim.SetExitPriceToInitialStop");
ExtFml("TradeSim.SetStopGapPriceToOpen");
ExtFml("TradeSim.EnableProtectiveStop",0);
ExtFml("TradeSim.SetExitPriceToInitialStop");
ExtFml("TradeSim.EnableDelayOfEntryByOneBar");
ExtFml("TradeSim.EnableDelayOfAllExitsByOneBar");
ExtFml("TradeSim.SetStartRecordDate",01,01,1996);
ExtFml("TradeSim.SetStopRecordDate",31,12,2003);
ExtFml("TradeSim.RecordTrades",
"x20dh",
Long,
EntryTrigger,
NewEntryPrice,
InitialStop,
ExitTrigger,
ExitPrice,
START)
---8<----------------------------
jose '-)
raultrader
16th April 2004, 06:24 AM
Martin, we have the same problem!
And Jose, thanks for your input to the forum. Your code gets closer on this one. I tried it but I'm still having trades that exit in the NO MAN'S LAND! Any suggestions?
Thank fellows for being there!
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.