Using Ulcer Index as Optimization Target

Under Analysis Settings > Walk-Forward > Optimization target, it appears that the optimizer will seek the highest value of whatever is selected as the optimization target. I would like to optimize for the smallest number instead, as for the Ulcer Index. Is there a way to get the optimizer to seek the minima in the results?
I can do a column sort on the Ulcer Index column after the optimizer completes, but I wonder if the algorithm is missing viable minima if it is seeking maxima for the result.

1 Like

@CascadeEffect depending on what your Max value is, you could simple do a 100 - yourval and then optimize on the results.

2 Likes

You can add custom metric that will be negative of Ulcer index
http://www.amibroker.com/guide/a_custommetrics.html

SetCustomBacktestProc("");

/* Now custom-backtest procedure follows */

if( Status("action") == actionPortfolio )
{
    bo = GetBacktesterObject();

    bo.Backtest(); // run default backtest procedure

    st = bo.GetPerformanceStats(0); // get stats for all trades

    // Here we add custom metric to backtest report
    bo.AddCustomMetric( "MinusUlcerIndex", - st.GetValue("UlcerIndex") );
} 
3 Likes

Thanks, Tomasz and Snoopy.
That will work perfectly.
~CS

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.