Enhancing the Epilog
Previous  Top  Next

Calculating Fitness
The fitness calculation is the heart of your optimization and the primary input into the mating process. The default fitness calculation Optimax uses is shown below in blue.

 
if OMX_Init = 1 and OMX_IterationNum > 0 then begin  
   OMX_temp = OMX_BarInfo( OMX_EquityResolution, OMX_IterationNum ) ;  
   If OMX_LastBarInWalk then begin  
      Fitness = Div( NetProfit, absvalue(MaxIDDrawDown) ) ;  
      OMX_temp = OMX_EndPass( OMX_Fitness, OMX_IterationNum, OMX_FirstCalcDate, OMX_FirstCalcTime ) ;  
      end ;  
   end ;  
 

This is the default fitness calculation provided with Optimax.

Optimax also provides other fitness calculations for you to try. Here is a list of all fitness calculations provided:

1.Div( NetProfit, absvalue(MaxIDDrawDown) )  
2.OMX_F_MSRatio  
3.OMX_F_VanTharp  

Insert one of these functions into your strategy, replacing the Fitness computation line shown above in blue.

The first computation - NetProfit / absvalue(MaxIDDrawDown) - is a profit-to-drawdown ratio. It maximizes profit while minimizing drawdown. For example if you had two equity curves both with $10,000 of net profit, the first having $1,000 of drawdown and the second $2,000, the resulting fitnesses would be 10 and 5, identifying the first result as being twice as desirable as the second. This is a good fitness function to use when your strategy has a possibility of large drawdowns - for example a swing trading strategy with loose stops. It would not be as useful in a strategy with tight stops, since the drawdown is limited within the strategy itself and the function would not provide a wide range of values to choose from.

The second computation is a modified Sharpe Ratio function. The Sharpe Ratio is a time-based measure of the consistency of returns. It will assess the consistency of your gains over a period of days, weeks or months.

The third computation is a modified Van Tharp function. The Van Tharp is profit-to-risk ratio standardized to the number of days per year. The more often your strategy trades and the more it makes on average per trade (measured as dollars made per each dollar risked,) the higher the score.

Click here for a more detailed description of these fitness functions.

In addition to the above, you can create your own fitness functions to use. We encourage you to experiment according to your needs.

Sending Additional Results
Using the OMX_SendVar function, you can send additional equity results to Optimax for display.

 
if OMX_Init = 1 and OMX_IterationNum > 0 then begin  
   OMX_temp = OMX_BarInfo( OMX_EquityResolution, OMX_IterationNum ) ;  
   If OMX_LastBarInWalk then begin  
      Fitness = Div( NetProfit, absvalue(MaxIDDrawDown) ) ;  
      OMX_temp = OMX_SendVar( "MyVar1", value1 ) ;  
      OMX_temp = OMX_SendVar( "MyVar2", value2 ) ;  
      OMX_temp = OMX_EndPass( OMX_Fitness, OMX_IterationNum, OMX_FirstCalcDate, OMX_FirstCalcTime ) ;  
      end ;  
   end ;  
 


You make up the name for the first parameter, and pass any value you wish for the second. You can call this function as many times as you wish, passing a different variable each time. These values will be stored and later displayed as part of the equity detail report for an individual within Optimax. Shown below are the two variables sent from the code above, with sample values.

equitydetailmyvars