PDA

View Full Version : Set Loss Stop


Tony
30th August 2006, 09:25 AM
David,

Could I suggest the inclusion of a Set Loss Stop function in TradeSim.
This function would operate in a similar manner to SetProfitStop, but would stop out the trade at specified loss %. A corresponding SetExitToLossStop would complement this function. I have tried to use SetProfit Stop with negative values, but without success.

Thanks,

Tony

David Samborsky
8th September 2006, 12:34 PM
There is already a facility for stop losses.

You assign your stop to InitialStop which is passed to the RecordTrades as one of the parameters.

Then after the call to the Initialize function you have to call EnableProtectiveStop as in the following example.


EntryTrigger:=Ref(Cross(MACD(),Mov(MACD(),9,E)),-1);
EntryPrice := OPEN;
ExitTrigger := Ref(Cross(Mov(MACD(),9,E),MACD()),-1);
ExitPrice := CLOSE;

InitialStop:=Ref(C-20*ATR(10),-1);

ExtFml( "TradeSim.Initialize");

ExtFml( "TradeSim.EnableProtectiveStop",0 );

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