Running Optimizations
Previous  Top  Next

When you are ready to run the optimization, follow these steps:

·Insert your strategy into a chart.  
·Add another datastream, and make it identical to Data1. (This additional stream is used by Optimax as the price modulation reference stream.) In your strategy, change the OMX_StreamNum input to be the number of the datastream you just inserted. For example, if you just inserted data4, set OMX_StreamNum to 4.  
·In Optimax, click the Optimize button.  
Clicking the Optimize button in Optimax.  
Wait until you see the message "Waiting for TradeStation to send data...". This may take a minute if you have a slow machine; this is especially true if you are short on RAM.  
·In TradeStation, optimize your strategy, varying OMX_IterationNum from 1 to a Stop number, with an increment of 1.  
Varying the IterationNum parameter in TradeStation.  
Do not optimize any other inputs. They will all be controlled from Optimax.  
To determine the Stop number, multiply the number of individuals per generation by the number of generations you want to process. For example if you have set the Initial Population Size parameter to 100 and you want to process 50 generations, the Stop should be at least 500. You can set it higher, because you can stop processing at any time you wish. (See below.)  
You must click the Optimize button in Optimax before clicking the Optimize button in TradeStation. Starting the optimization in TradeStation first will give unpredictable results.  
·What happens then is this: at the first bar of each iteration within TradeStation, the EL code asks Optimax for a set of input values and evaluates the strategy using them. At the last bar, the EL calls Optimax functions to write the strategy results to a file and then starts a new iteration, obtaining the next set of inputs from Optimax. This is repeated until you stop the process, until convergence is reached, until the Max Generations parameter is reached, is or until the last iteration number. Usually, it is easiest to just use a very high iteration number and wait for convergence or stop it manually.  
Note: When either convergence or Max Generations is reached, TradeStation will "spin" through the remaining Iteration numbers until it reaches the Stop value. These iterations do not do anything useful; you can click Abort during this time and not affect the results.  
·Periodically, the Optimax user interface checks for new strategy result files and from them creates graphs and updates indicators. You can vary the refresh rate - that is the number of seconds before Optimax looks for new files and generates new graphs.  
Adjusting the refresh rate in Optimax.  
Each refresh requires computer resources to perform. Ideally, you want to set this high enough so you can watch your optimization in progress, but low enough so that it doesn't noticeably slow down TradeStation. If you have two CPUs, then TradeStation will use one CPU and Optimax will use the other, and Optimax will not impact TradeStation's speed at all. In this case you can choose a high refresh rate - but not higher than the time taken to perform a single refresh.  
At the other end of the scale, if you have a single CPU on a slow machine and want to give as many cycles as possible to TradeStation, choose Manual. Optimax will then wait for you to click the refresh button before generating graphs.  
Clicking the Refresh button in Optimax.  
You can even turn off the Animation icon in the top right-hand corner of the window by clicking Stop Animation. When you do this, Optimax is in maximum conservation mode and only consumes the cycles necessary to generate inputs required for optimization. It does not give any outward indication that it is doing anything.  
The default refresh rate is 15 seconds, visible in the status bar at the bottom of the window.  
·You can stop the optimization at any time. In TradeStation click Abort, Restore Original Inputs. Then in Optimax, click Stop Optimization.  
Stopping the Optimization in Optimax.  
When you stop the optimization in TradeStation, do not click Accept Best Solution So Far. It will not give you the best solution so far; it causes the last iteration number to be sent to Optimax out of sequence and the results are unpredictable.  
Once you have pressed the Stop button in Optimax, the optimization cannot be restarted. Pressing Start will start a new optimization.