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

RE: Random Entry



PureBytes Links

Trading Reference Links

I wrote it. It needs a DLL and the proper functions to work.
You can download the whole package from
http://www.mechtrading.com/tradestation/random.html.

Dave DeLuca
Tradeworks Software

> -----Original Message-----
> From: Michael Stewart [mailto:MPST@xxxxxxxxxxxxx]
> Sent: Thursday, September 30, 1999 11:43 AM
> To: Clint Chastain
> Cc: Omega
> Subject: Re: Random Entry
>
>
> Clint
>
> I cannot remember who wrote this!
>
> {* SYSTEM  : Random Trader
>  Use     : Generates random entries for testing exits.(?)
>  Inputs  :
>    Period - the range of the random number
> generator. Larger values
>             will generate fewer trades.
>     Seed   - the seed value for initializing the
> random number generator.
>              Ignored if zero, else can be used to
> reproduce a series of
>              random trades. Initializing the
> random number generator with
>              the same seed value will generate
> the same sequence of numbers.
>
>   When "Seed" is greater than zero, the same
> sequence of trades will be
>   generated whenever the system status is toggled
> off and on (as long as
> "Period"
>   remains unchanged).
>   When Seed equals zero, a different sequence of
> trades will be generated
> every time.
>
>   NOTE: Do not call Randomize if you are calling
> Random_Seed. Only call one
> or the other ONCE.*}
>
> Inputs: Period(10), Seed(0);
>
> Vars: NumberToMatch(1), {Could be any number less
> than 'Period'}
>       GoLong(1),        {Generate a buy order
> when matched}
>       R1(9999),
>       NullVar(0);
>
> { Include your Exit System code here, or IncludeSystem. }
> if MarketPosition <> 0 then begin
>   ExitLong at Lowest(L, 6) stop;
>   ExitShort at Highest (H, 6) stop;
> end;
>
> if currentbar = 1 then begin
>   {Initialize the random number generator. The
> return value is not used.}
>  if Seed > 0 then
>   Nullvar = Random_Seed(Seed)
>  else
>   NullVar = Randomize;
> end;
>
> { Only generate trades when this system is flat. }
> if marketposition = 0 then begin
>
>  {Get a random integer within our input range.
> The greater the value of
>   "Period", the less likely we will be to match
> our target number.  }
>  R1 = Random_Int(Period);
>  If R1 = NumberToMatch then begin
>
>   { Decide on buy or sell. Random_Int(2) will
> return a 0 or 1. }
>   if Random_Int(2) = GoLong then begin
>
>    {Generate an order to buy}
>    Buy;
>   end
>   else begin
>
>    {Generate an order to sell}
>    Sell;
>   end;
>  end;
> end;
>
>
>
>
>
>
>
> >Hi all:
> >
> >Does anyone have any TS coding that generates
> random entries that they
> would
> >be willing to share with the list?
> >
> >I may be wrong, but I seem to recall this being
> discussed several times in
> >the past.
> >
> >Thanks,
> >
> >Clint
> >
>
>
>