Free Easy Language Random Number Generator for use with TradeStation
What is it?
The Random Number Generator DLL (Dynamic Link Library) lets you generate random numbers that you can use in your Easy Language systems and indicators.There are two packages available - one for the 16-bit version of TradeStation 4.0 or earlier, and one for the 32-bit version of TradeStation 2000i. You can download either one at the bottom of this page.
How does it work?
There are four Easy Language user functions that call corresponding functions in the the random number generator DLL. You can use these functions in your Easy Language systems and indicators.Randomize: Initializes the random number generator.
Random_Seed: Seeds the random number generator with an integer value.
Random_Int: Returns a random integer value within the range zero to (n).
Random_Float: Returns a random floating point value within the range zero to something less than 1.
The random number generator is a generic version included with Borland C/C++ and Pascal (Delphi) compilers. It is similar to the random number generator included with Microsoft C/C++ compilers. I don't claim these are the best implementations of random number generators available, but they have been widely used for more than a decade.
See the comments included with the functions for more info on their use.
What is it good for?
You can use a random number generator to trigger specific random events. For example, the archive includes a sample system named "RandomTrader" that generates random entry orders and allows the frequency of trading to be adjusted with an input variable. Also, by using the "Random_Seed" function, repeatable sequences of random numbers can be generated. This could be used to generate repeatable sequences of random entry orders, possibly to test exit or money management strategies.How much does it cost?
Nothing, it's free. But you should understand that at this price there are no warranties expressed or implied. The responsibility for the use, misuse, or abuse of any part of the offered package is yours and yours alone.Files you will find in the zip file you download
RandFncs.asc - EL code for the four user functions wrapping the DLL functions. You can copy and paste these into the Power Editor.Randsys.asc - EL code for the "RandomTrader" system.
Readme.txt - Explanation and overview of the package which is pretty much the same as what you see here.
DRandom.DLL - The DLL with the 16-bit functions for use with TS 4.0
DRand32.DLL - The DLL with the 32-bit functions for TS2000i.
Rand_dll.ela - The four user functions and system in an Easy Language Archive for transferring directly into TradeStation 4.0.
Rand32.ela - The user functions and system in an Easy Language Archive for transferring directly into TS2000I. These functions have been set up to work with the 32-bit DLL.
Installation
Download the zip file for your version of TradeStation. Unzip the archive you downloaded into a temp directory. Copy the DLL file into an accessible directory such as "C:\Omega\Prog". Note that this is the default path used in the EL code; if you have TradeStation installed on another drive or if you just want to store the DLL in another directory you will have to change the path in the user functions.The easiest way to install the files for use in TradeStation is with the PowerEditor "Transfer..." function. Otherwise, open up the "RandFncs.asc" and "RandSys.asc" files in a text editor and copy and paste the individual functions into new editor windows in the PowerEditor. The "RandomTrader" system requires three of the four user functions, and is included as an example of how to use the functions to generate random entry orders.
Once you have the functions and system installed and verified in TradeStation you can add the system to a chart and observe the trades generated. Turn the system status off and on to generate a new series of trades, or change the Seed input value.
Download
| 16-bit for TS 4.0 or earlier | Randdll.zip - 18kb |
| 32-bit for TS2000i | Rand32dll.zip - 30 kb |
