Repository navigation
Model SMA2DynamicDemo
All model results · Pinned source · Javadoc
Runs a dynamically calibrated SMA crossover over rebalance/data-window combinations.
Each combination has an independent simulator and performance measures.
The strategy periodically recalibrates using a trailing data window.
--quick reduces both the date range and parameter grid for a smoke run.
Defaults to synthetic data; --live enables Yahoo downloads.
Performance, execution and trade CSV files are written by SimulationResultsExporter.
Using this example. Separates trailing-window calibration from subsequent strategy execution and exports results for multiple parameter combinations. Use --quick for the smaller example configuration. Repeated calibration requires fresh strategy state; report rows belong to their own parameter set and should not be concatenated into one account.
Model and publication. No single original research publication is claimed for this library/example policy.
Implementation in this tutorial. The signal compares a fast and a slow arithmetic mean of prices. A fast mean above or below the slow mean produces a directional target after the required history is available. Lag parameters count observations. SMA2DynamicDemo additionally recalibrates parameters on trailing windows; that procedure is separate from the crossover formula.
| Item | Value |
|---|---|
| Status | completed |
| Run | 39114360151 |
| UTC publication | 2026-10-18 09:17 UTC |
| Source commit | 355aa9242fc2a247b256aecc8406cbb409aa5ff3 |
| Data mode | synthetic --quick |
| Exit code | 0 |
| Elapsed seconds | 4.65 |
| Time limit seconds | 180 |
| Maximum Java heap | 1200m |
The original main returned successfully. Read the output and model assumptions before interpreting it.
Follow the repository setup for JDK 8, Maven credentials and an external NM license. From the repository root:
mvn -U -Dmaven.test.skip=true clean package
mvn exec:java -Dexec.mainClass=tech.nmfin.algoquant.demo.model.technical.SMA2DynamicDemo -Dexec.args="--quick"The automated run uses scripts/ModelDemoRunner.java to initialize the external license before the unchanged main, save JFreeChart windows as PNGs, and exit after main returns. It uses an isolated working directory with the repository datasets/configuration linked in. Running directly may leave desktop windows open.
Data: deterministic SYNTHETIC prices; charts: false; quick: true
09:15:32.120 [main] INFO t.n.a.d.m.technical.SMA2DynamicDemo,174 - running strategy SMA2Dynamic: rebalance period = P1M; data window = P3M; trading 000001.SS @ SS...
09:15:32.724 [main] INFO t.n.a.m.s.t.c.sma2.SMA2Dynamic,125 - will run a newly calibrated strategy @ 2016-01-04T15:00: SMA2product=000001.SS @ SS, fastlag=7, slowlag=20
09:15:32.936 [main] INFO t.n.a.m.s.t.c.sma2.SMA2Dynamic,125 - will run a newly calibrated strategy @ 2016-02-04T15:00: SMA2product=000001.SS @ SS, fastlag=9, slowlag=17
09:15:33.092 [main] INFO t.n.a.m.s.t.c.sma2.SMA2Dynamic,125 - will run a newly calibrated strategy @ 2016-03-04T15:00: SMA2product=000001.SS @ SS, fastlag=3, slowlag=13
Simulation checked: 65 NAV observations; 1 executions.
09:15:33.127 [main] INFO t.n.a.e.r.SimulationResultsExporter,766 - Saving to /home/runner/work/algoquant-examples/algoquant-examples/target/model-results/SMA2DynamicDemo/work/log/SMA2DynamicDemo.2026.10.18,09.15.33.measures.csv...
09:15:33.153 [main] INFO t.n.a.e.r.SimulationResultsExporter,766 - Saving to /home/runner/work/algoquant-examples/algoquant-examples/target/model-results/SMA2DynamicDemo/work/log/SMA2DynamicDemo.2026.10.18,09.15.33.executions.csv...
09:15:33.158 [main] INFO t.n.a.e.r.SimulationResultsExporter,766 - Saving to /home/runner/work/algoquant-examples/algoquant-examples/target/model-results/SMA2DynamicDemo/work/log/SMA2DynamicDemo.2026.10.18,09.15.33.trades.csv...
09:15:33.159 [main] INFO t.n.a.d.m.technical.SMA2DynamicDemo,150 - time elapsed: 3623 milliseconds
Download SMA2DynamicDemo.zip contains stdout, stderr, the execution record, checksums and any exported CSV/chart files.
| Export | Bytes |
|---|---|
files/log/SMA2DynamicDemo.2026.10.18,09.15.33.executions.csv |
126 |
files/log/SMA2DynamicDemo.2026.10.18,09.15.33.measures.csv |
428 |
files/log/SMA2DynamicDemo.2026.10.18,09.15.33.trades.csv |
102 |
Read the reported units: optimizer weights, model-fit coefficients, forecast correlations and simulated P/L are different outputs. Synthetic runs demonstrate the API rather than historical market returns. Inspect undefined values and open positions instead of replacing them with zero. Chart exports visualize exactly this run.
For model assumptions, original publications and adaptation limits, use the literature guide.