Algostream_optimization.ObjectiveWhat the optimizer maximizes.
Always maximized: a minimizing objective is expressed by negating f. That keeps every comparison in the library a single > with no direction flag to get backwards.
module Metrics = Algostream_performance.Metricsval sharpe : tval sortino : tval calmar : tval ann_return : tval total_return : tval min_drawdown : t-max_drawdown โ for a mandate where capital preservation dominates.
val return_over_max_dd : tAnnual return divided by maximum drawdown. Closely related to Calmar but uses arithmetic rather than geometric return, so it is less sensitive to a short sample.
base โ lambda ยท max_drawdown. The workhorse: a raw Sharpe objective happily selects a configuration that made its money in one lucky stretch and spent the rest underwater.
Wrap any objective so it scores zero unless the result has at least min_trades trades and min_periods observations. Without this, a configuration that traded twice and got lucky outranks one that traded five hundred times and worked.