Australian (ASX) Stock Market Forum

Reply to thread

Hi Bingk6 --


You are correct -- the objective function is created by combining all of the factors that are important, with each factor weighted according to its importance.


There are several methods for creating weighted objective functions. 


One that I like is to first list the important features -- even if they are thought to have only minor importance.


Go down the list of features and determine what metric already exists for that feature.  For example, average holding period is already in days or bars; compound annual rate of return is already in percent, and so forth.


Continuing with the list, for each feature decide what value should get full marks and what value should get no credit.  Draw a graph showing what value gets what percentage of full marks.  Full marks get a value of 1.0, no marks get a value of 0.0.  I have pasted an image I use in the book, Quantitative Trading Systems, below as an example.  The feature being scored is exposure -- full marks (1.00) for anything between 10 and 20 percent, linearly dropping to half marks (0.50) for anything over 40 percent.  To use the graph, lookup the exposure for the run you are scoring -- go across the chart until you come to that value, then go up until you hit the line -- that is the score for this feature for this run.


At this point each feature has been evaluated and a chart drawn showing how the marks will be assigned.


Still with the list, imagine that you have 100 dollars to allocate to the entire objective function.  Go down the list and decide how many dollars each of the features is worth.


The resulting objective function is determined by calculating what mark a feature earned and multiplying by its dollar allocation.  Add them all up.  The result will be a score between 0 and 100. 


Now -- you probably didn't get it just right the first time -- I never do.  Run some backtests.  For each backtest, plot the equity curve, print out the statistical report, and calculate the objective score.  Spread the sheets on the floor and put them in order according to how you would rank them as you read the statistics and look at the equity curve.  The ones you rank highest should have the highest objective function score.  In fact, the objective function scores should go from highest to lowest with none out of order.  If that is the case, your objective function is complete. If that is not the case, you will need to add other features or re-weight the ones you have.  Repeat until the order you prefer is reflected in the objective function score.


In AmiBroker, you can do exactly what I have just described.  Then, you can tell AmiBroker that it should automatically compute the score for your custom objective function every time it does a backtest or optimization run, and include that number on the report.


For those of you who already have the book, Quantitative Trading Systems, the procedure is described in Appendix A, starting on page 317.


Thanks,

Howard

www.quantitativetradingsystems.com


Top