Hi-
I am trying to put together a script which will generate random trades and
adhere to the following rules:
1. It must exactly generate a predetermined # of trades per symbol in the time
period being tested
2. Of the trades generated, it must adhere to a predetermined subset of # of
days in each in trade (e.g. if the designated total # of trades that should
be generated per symbol in the period = 10 as per step 1, i'd like to be able
to constrain that 3 of the 10 trades are held for 2 days, 5 of the 10 are held
for 4 days, and 2 of the 10 are held for 1 day)
To address the first point, my initial pass at this was to generate entry
signals when the PercentRank of the current bar's random value (as compared to
all the random values in the array) was less than (# of desired trades) / (# of
bars in periods). This was close but does not consistently deliver the exact #
of desired trades. Without that working, I haven't attempted to get part 2
right yet.
Would appreciate it if anyone has suggestions on how to go about accomplishing
either part of this. Thanks in advance.
-B