Why Do I Need to Know the Strategy Optimization Pass Number?
There are two very useful purposes served by knowing the strategy optimization iteration or pass number during optimization:
- When Outputting Optimization Results of Each Pass. Some parameters that are output need to be calculated only once for each optimization pass. Having the Optimization Pass Number available to your code allows you to perform these calculations only once per optimization (When the Optimization Pass Number = 1).
- When Calculating parameters independent of the variables being optimized. These calculations need only be done once per optimization run (When the Optimization Number = 1).
Important Points when Using the Optimization Number Function
- EL Collections for EasyLanguage must be installed for this function to work. A link is provided below for obtaining the code and documentation.
- The TempFile location defined in the variable definition as TempFile(“E:/temp/temp.txt”) may be modified by the user.Keep in mind that some versions of Windows prohibit the creation of files in protected directories, such as some areas of Drive C under Windows Vista or Windows 7. If you receive a “file can not be created” error message, it may be for this reason.
- Although FastFileAppend is generally faster than FileAppend, I have found it does not consistently create new files on my system. Therefore I have reverted to using FileAppend in this function.
The following code placed within your strategy may be used to call this function, which will return the optimization pass number:
OptPassNr = _OptimizationPassNr;
Alternatively, the following variable definition will self-initialize at the start of each optimization run placing the optimization pass number in the variable OptPassNr:
Initially posted version: 03/31/10
Latest Update: 03/31/10
*.ELD files are compiled for TS 8.7
All ELD and code text files packaged here:
Users of earlier versions fo TradeStation may compile the code
from the text files included in the above *.zip file.
The code may be visualized here:
The code and documentation for EL Collections for EasyLanguage may be visualized here: