PDA

View Full Version : Random Entry


dilmun99
18th June 2004, 08:20 PM
I am starting to test a variety of exit strategies. To keep things neutral, I started using a random entry (<0.1) setup. However, it occurred to me that each time I ran the exploration in Metastock, I would get a different set of trading signals, since each time you run the random number generator you get a new set of random numbers (seems obvious now, but it wasn't then!).

To test it, I ran the exact same exploration twice and then ran a Monte Carlo on it. As I suspected, the stats were different, although not wildly so. (Average Profit varied by 5% over 6 years ).

As such, it seems to me that there are limitations to testing using the random number generator, or comparing a system to random entry, since the trades will be different every time you run it.

Is this right or am I making some horrible goof? Attached below is the code I was using:

{Random Entry, ATR Exit}

{ This is the ?LONG? trading part of the recording process }

ARC:=3;
Period:=10;
Volatility:=ARC*ATR(Period);
LongInitialStop:=CLOSE-ARC*ATR(Period);
ShortInitialStop:=CLOSE+ARC*ATR(Period);
BandLong:=ExtFml("TradeSim.TrailingStop",BAND, LONG,Volatility,CLOSE,LOW);
BandShort:=ExtFml("TradeSim.TrailingStop",BAND, SHORT,Volatility,CLOSE,HIGH);

LongEntryTrigger :=ExtFml("TradeSim.Rand")<0.1;
LongEntryPrice := CLOSE;
LongExitTrigger := (L<=Ref(BandLong,-1));
LongExitPrice := CLOSE;
LongInitialStop:= CLOSE-ARC*ATR(Period);

ExtFml( "TradeSim.Initialize"); { Initialize internal variables }
ExtFml("TradeSim.EnableProtectiveStop",1);
ExtFml( "TradeSim.SetStartRecordDate", 1, 1, 1997);
ExtFml( "TradeSim.SetStopRecordDate", 1, 1, 2003);

ExtFml( "TradeSim.RecordTrades", "Random Long Short ATR Exit", { Trade Data Filename }
LONG, { Trade Position Type }
LongEntryTrigger, { Entry Trigger }
LongEntryPrice, { Entry Price } LongInitialStop, { Initial Stop }
LongExitTrigger, { Exit Trigger }
LongExitPrice, { Exit Price }
START); { Trade Recorder Control }

{ This is the ?SHORT? trading part of the recording process }

ShortEntryTrigger:= ExtFml("TradeSim.Rand")<0.1;
ShortEntryPrice := CLOSE;
ShortExitTrigger := (H>=Ref(BandShort,-1));
ShortExitPrice := CLOSE;
ShortInitialStop:= CLOSE+ARC*ATR(Period);


ExtFml( "TradeSim.RecordTrades", "Random Long Short ATR Exit", { Trade Data Filename } SHORT, { Trade Position Type }
ShortEntryTrigger, { Entry Trigger }
ShortEntryPrice, { Entry Price }
ShortInitialStop, { Initial Stop }
ShortExitTrigger, { Exit Trigger }
ShortExitPrice, { Exit Price }
CONTINUE); { Trade Recorder Control }

Thanks
Andrew