From the search or system tracking results select the strategies for code generation and click EasyLanguage Code.
Select the code version (TS2000i or TS) and click OK. An example of Easylanguage TS code generation for selected strategies is shown below.
The generated code may be saved by clicking on File and then Save.
You may copy and paste the code into Tradestation. You may have to remove some blank or other characters causing errors when verifying the signal.
In the case of strategies with a delay in trade input all bars in the code are shifted according to the delay value. Therefore, the delay is already accounted for when a signal is generated for the appropriate entry point (open or close).
Note: the input variable values are initially set to zero in the generated code and they must be specified in Tradestation.
Raw Code
Click on “Raw Code” from search results to generate raw code for selected strategies:
You may copy and paste the raw code in a line editor for further manipulation. Raw code is also generated automatically and saved in two text files. Each line in the files contains the following:
Strategy Code;File;Type;TradeOn,Target;Stop;C
where File is the filename, Type is LONG OR SHORT, TradeOn is Open or Close, Target is the profit target, stop is the stop-loss and C is % or pts. Strategy Code is the formula code used by the native language of the various supported platforms.
The raw code generation applies only to Search and Database results. Two files with identical content are saved automatically in sub-directory Results:
(1) A file called GeneratedCode.txt which is overwritten every time new code is generated.
(2) A file with the name: RawCode_mm_dd_yyyy_hh_mm.txt
This file is overwritten only if new code generation takes place during the same minute mm that the file was initially generated.
The text files containing raw code can be deleted using a new tool added to File Maintenance under Results and called “Code .TXT FILES”.
System Code
Click on “System Code” to generate system code for selected strategies:
Note: System code can be generated only when there is one symbol (data file) in results and with strategies that have the same exit parameters. If there several symbols, results for each can be saved in a different results file to be used for code generation.
FAQ: What values should be used for the input variables in the generated Easylanguage code for selected strategies?
In the generated Easylanguage code for selected strategies, the input variables are set equal to 0 and must be set to the correct value manually by the user.
(1) In the case of percent ( “%” ) targets and stops:
You need to set the proper values of the following input variables according to the values used in the T/S file shown in the generated code header:
input: ptarget(0), stopl(0);
For example, if the target is 3% and the stop 2% then:
input: ptarget(3), stopl(2);
The correct values are always shown in the headers of the generated code for each strategy. For example:
LONG , % , TARGET : 8 , STOP : 6 , ENTRY PRICE : CLOSE , DELAY : 0
In this particular header, the target is 8% and the stop is 6% and the line should change to:
input: ptarget(8), stopl(6);
(2) In the case of point ( “pts” ) targets and stops:
You need to set the proper values of all input variables according to the values used in the T/S file shown in the generated code header and the appropriate price scale of the instrument traded.
If the target is 75 pips and the stop is 50 pips then:
input: targetpoints(0.0075), stoppoints(0.0050), multiplier(10000);
The correct values are always shown in the headers of the generated code for each strategy. For example:
LONG , pts , TARGET : 0.01 , STOP : 0.01 , ENTRY PRICE : OPEN , DELAY : 0
In this particular header, the target is 0.01 and the stop is 0.01:
input: targetpoints(0.01), stoppoints(0.01), multiplier(10000);
In the above example the multiplier value was set to 10000 to reflect that the values are related to eurusd forex trading where the price scale is often equal to 10000. In general, the multiplier is related to the price scale. For example, for equities the price scale is 100, for bond futures 32 and for eurusd forex 10000 in most cases. Please consult your Easylanguage manual to find out how the variables should be adjusted in the case of point targets and stops.
Note that in the case of system code, the input values are inserted by the program.