[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: ELS code to generate random entry or exit



PureBytes Links

Trading Reference Links

Thanks a lot. It seem to me that there are many way to generate random
entry. Is there any way to ensure a better random entry or exit
method to be used?

Thursday, February 20, 2003, 6:06:45 AM, you wrote:

AM> AceTrader wrote
>>Can any kind soul send me ELS code to generate random entry or exit
>>for testing my exit and entry strategies.

AM> Maybe I'm missing a point here, but this seems too easy:

AM> vars: dir(0), tradenow(false), exitnow(false);

AM> {Entries}

AM> {new entry at any time with 40% probability, except when position in
AM> same direction already exists}

AM> dir = random(100)-50;
AM> tradenow = (random(100) < 40);
if marketposition >>= 0 and dir < 0 and tradenow then sell;
AM> if marketposition <= 0 and dir > 0 and tradenow then buy;

AM> {OR... like above, but enter only when NOT holding any position}

AM> dir = random(100)-50;
AM> tradenow = (random(100) < 40);
AM> if marketposition = 0 and dir < 0 and tradenow then sell;
AM> if marketposition = 0 and dir > 0 and tradenow then buy;

AM> {exit at any time with 30% probability}

AM> exitnow = (random(100) < 30);
if marketposition >> 0 and exitnow then exitlong;
AM> if marketposition < 0 and exitnow then exitshort;

>>Thanks in advance.

AM> I hope this helps.




-- 
Best regards,
 AceTrader                            mailto:tradersh@xxxxxxxxxxxx