Wrap a signal-style strategy as numeric targets
Source:R/signal-strategy.R
ledgr_signal_strategy.Rdledgr_signal_strategy() is a small convenience wrapper for tutorial-style
strategies that emit explicit signals. It does not change the runner
contract: the returned strategy maps signals to a full named numeric target
vector before the shared StrategyResult validator runs.
Arguments
- fn
Signal function called as
fn(ctx). It receives the ledgr pulse context, notparams, and must return either a scalar signal for a single-instrument universe or a named character vector with one signal per instrument inctx$universe.- long_qty
Target quantity for
"LONG".- flat_qty
Target quantity for
"FLAT".- short_qty
Target quantity for
"SHORT".
Value
A function(ctx, params) strategy suitable for ledgr execution. The
returned strategy follows the normal ledgr strategy convention and maps the
inner signal function's "LONG", "FLAT", and "SHORT" values to a full
named numeric target vector.
Articles
Strategy helper pipelines:
vignette("strategy-development", package = "ledgr")
system.file("doc", "strategy-development.html", package = "ledgr")