PDA

View Full Version : How to set the stop to the low of the day before the signal?


LT
5th February 2004, 09:36 PM
Tradsim Users,

How do I get TradeSim to set my Initial stop to the low of the day before the buy?

The code below doesn't work. The initial stop SHOULD NOT be the low of the day I entered the trade. I can't set the stop on the low because I don't know what it will be until the market closes.

ExtFml( "TradeSim.Initialize"); ExtFml("TradeSim.EnableProtectiveStop",0);

Buy:= Fml( "MyBuy") = 1 ;
Sell:= Fml( "MyBuy") = 2 ;

LongInitialStop:=ValueWhen(1,buy=1 AND Ref(buy,-1)=2,L);
InitialStop:=L-.01;


EntryTrigger := Ref(Buy,-0);
EntryPrice := OPEN;

ExitTrigger := Ref(sell,-0);
ExitPrice := OPEN;

ExtFml( "TradeSim.Initialize");
{ExtFml("TradeSim.EnableDelayOfAllExitsByOneBar");
}

ExtFml( "TradeSim.EnableDelayOfEntryByOneBar");

ExtFml( "TradeSim.RecordTrades",
"Holy_Grail", {Trade Data Filename}
LONG, {Trade Position Type}
EntryTrigger,{Entry Trigger}
EntryPrice, {Entry Price}
InitialStop, {Optional Initial Stop}
ExitTrigger, {Exit Trigger}
ExitPrice, {Exit Price}
START); {Recorder Control}

Thanks,

LT

David Samborsky
7th February 2004, 03:27 AM
You can only really use the previous days low etc

InitialStop:=Ref(L,-1);

Becareful though, if the InitialStop exceeds(long side) your EntryPrice then the trade will be rejected. Better to use a volatility stop based on the average of a number of days which will give your trade much more room to breath before it gets stopped out.