PDA

View Full Version : Exit next day on open after


Jackie
16th June 2004, 11:41 AM
Hi
This is my first posting. I'm probably missing something simple.

I wish to know how to exit the next day at the open price when the price has closed below my initial or protective stop.
Also I need to exit at open when the price gaps below the initial stop.

(My normal exit is fine and I exit the next day on open when the price closes below the 3.8*atr(30) trailing stop.)

I read somewhere that the SetStopGapPriceToOpen function no longer has any effect, and my following attempt is exiting me at the closing price the day after the price has closed below my protective stop.
What am I missing?


LongEntryTrigger:= Trigger;

LongEntryPrice := OPEN;
LongInitialStop:=Ref(CLOSE-2.5*ATR(30),-1);
LongExitTrigger:=ExtFml("TradeSim.TrailingStop",TRIGGER,LONG,3.8*ATR(30),HIGH,CLOSE);
LongExitPrice:=OPEN;
LongExitPrice:=If(O<LongInitialStop,O,LongExitPrice);
ExtFml("TradeSim.Initialize");
ExtFml("TradeSim.EnableDelayOfEntryByOneBar");
ExtFml("TradeSim.EnableDelayOfAllExitsByOneBar");

ExtFml("TradeSim.EnableProtectiveStop",0);
ExtFml("TradeSim.SetExitPriceToInitialStop");
ExtFml("TradeSim.UseClosingPriceAsStopThreshold");
ExtFml("TradeSim.SetStartRecordDate",31,12,1995);
ExtFml("TradeSim.SetStopRecordDate",31,12,2004);

ExtFml( "TradeSim.RecordTrades",
"test close below", { Trade Data Filename }
LONG, { Trade Position Type }
LongEntryTrigger, { Entry Trigger }
LongEntryPrice, { Entry Price }
LongInitialStop, { Optional Initial Stop }
LongExitTrigger, { Exit Trigger }
LongExitPrice, { Exit Price }
START); { Recorder Control }

If I remove the "enable delay of all exits by one bar" then my normal exits are exiting at the open on the day of the trigger and my protective stops are exiting at the close of the breach of the initial stop.
Any help would be appreciated....
Thanks in advance
Jackie

David Samborsky
17th June 2004, 12:37 PM
Starting with V4.2.1 of TradeSim.dll the following additions were made

From the Readme file http://www.compuvision.com.au/TradeSimReadme.htm

* The SetStopGapPriceToOpen function no longer has any effect. If Protective Stops are enabled and the InitialSop is breached then stops are handled according to the following pseudo code (long side example)


If UseClosePriceAsThreshold then

ExitPrice=Close

else

if Open < InitialStop then

ExitPrice = Open

else

if ExitAtStop then

ExitPrice = InitialStop

else

ExitPrice = UserExitPrice

Jackie
20th June 2004, 05:43 AM
Hi David,
Where is the error log is it the message log?

Sorry for stupid questions I'm still new
Jackie