Skip to contents

ledgr_demo_sma_crossover_strategy() returns a small deterministic strategy function for examples, vignettes, and smoke tests. It is a teaching fixture, not an investment recommendation and not a strategy library surface.

Usage

ledgr_demo_sma_crossover_strategy()

Value

A Tier-1-compatible strategy function with signature function(ctx, params).

Details

The returned strategy expects an active alias map with numeric aliases named fast and slow, typically from a feature map such as:

ledgr_feature_map(
  fast = ledgr_ind_sma(ledgr_param("fast_n")),
  slow = ledgr_ind_sma(ledgr_param("slow_n"))
)

The strategy reads only params$qty and params$threshold. It remains flat until both aliases pass warmup, then targets qty when (fast / slow) - 1 is greater than threshold.

Articles

Strategy development: vignette("strategy-development", package = "ledgr") system.file("doc", "strategy-development.html", package = "ledgr")

Sweeps: vignette("sweeps", package = "ledgr") system.file("doc", "sweeps.html", package = "ledgr")

Examples

strategy <- ledgr_demo_sma_crossover_strategy()
ledgr_strategy_preflight(strategy)
#> Warning: no DISPLAY variable so Tk is not available
#> ledgr Strategy Preflight
#> =========================
#> 
#> Tier:    tier_1
#> Allowed: TRUE
#> Reason:  Strategy is self-contained under ledgr's static preflight rules.