Internal 4-type dispatcher used by fit_ratio(), fit_loss(),
fit_premium(), and backtest() to normalize the regime
input (or split-axis variants such as loss_regime) into a
single representation: either NULL (no filter) or a "Regime"
object.
The four accepted input types are:
NULLReturns
NULL– no filter is applied."Regime"objectReturned as-is.
"auto"Runs
detect_regime()onmasked_triif supplied, otherwise ontri, withloss = "ratio". Themasked_trifallback is the leakage-safe path used bybacktest()– fit functions pass onlytri, whilebacktest()passes both so detection sees only the masked (training) data.function(tri) -> RegimeClosure invoked with
masked_tri(if non-NULL) ortri. Its return value must inherit"Regime"; an error is raised otherwise.
Arguments
- arg
The regime-change input (NULL / Regime /
"auto"/ function).- tri
A
"Triangle"object – used as the detection input whenmasked_triisNULL.- masked_tri
Optional masked
"Triangle"(e.g. backtest's training-only triangle). When supplied,"auto"and function inputs operate on this triangle instead oftri.
