Skip to content

Model SMA2Demo010

github-actions[bot] edited this page Oct 18, 2026 · 8 revisions

SMA2Demo010 — execution tutorial

All model results · Pinned source · Javadoc

What this example teaches

Runs a fixed two-simple-moving-average crossover strategy using the simulator builder. The fast and slow lags count price observations (daily bars in this example). Prices are synthetic by default; pass --live for Yahoo history and --charts for a desktop chart. The report is written to the console.

Using this example. Read this first for explicit simulator assembly: define the product and lags, load its order-book cache, construct SMA2, register measures and call simulator.run. The built-in strategy targets fixed long or short unit positions; withInitialCash does not turn it into full-equity sizing.

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.

Verified execution record

Item Value
Status blocked-license
Run 39114006111
UTC publication 2026-10-18 09:11 UTC
Source commit 0097e73c040bdaaddac570e2fe694d9836b676ee
Data mode synthetic --quick
Exit code 1
Elapsed seconds 0.48
Time limit seconds 180
Maximum Java heap 1200m

The external license was not accepted for this calculation.

Reproduce the calculation

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.SMA2Demo010 -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.

Observed output

This is an incomplete or blocked run. Output below is diagnostic or partial, not a verified strategy result.

09:08:01,438 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
09:08:01,439 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
09:08:01,439 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/home/runner/work/algoquant-examples/algoquant-examples/target/lib/algoquant-dist-3.3.0-SNAPSHOT.jar!/logback.xml]
09:08:01,457 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@63d4e2ba - URL [jar:file:/home/runner/work/algoquant-examples/algoquant-examples/target/lib/algoquant-dist-3.3.0-SNAPSHOT.jar!/logback.xml] is not of type file
09:08:01,496 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
09:08:01,497 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
09:08:01,506 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
09:08:01,512 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:08:01,552 |-INFO in ch.qos.logback.core.joran.action.TimestampAction - Using current interpretation time, i.e. now, as time reference.
09:08:01,553 |-INFO in ch.qos.logback.core.joran.action.TimestampAction - Adding property to the context with key="bySecond" and value="2026.10.18,09.08.01" to the LOCAL scope
09:08:01,553 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
09:08:01,556 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE1]
09:08:01,562 |-INFO in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@7bb11784 - Will use zip compression
09:08:01,562 |-WARN in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@7bb11784 - Large window sizes are not allowed.
09:08:01,562 |-WARN in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@7bb11784 - MaxIndex reduced to 21
09:08:01,565 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:08:01,566 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE1] - Active log file name: log/algoquant.2026.10.18,09.08.01.log
09:08:01,566 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE1] - File property is set to [log/algoquant.2026.10.18,09.08.01.log]
09:08:01,567 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
09:08:01,567 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
09:08:01,568 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE1] to Logger[ROOT]
09:08:01,568 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
09:08:01,568 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@33a10788 - Registering current configuration as safe fallback point

dev.nm.misc.license.LicenseError: license has been loaded already (loaded license from: license file: /home/runner/work/algoquant-examples/algoquant-examples/license/nm.lic)

Downloadable evidence

Download SMA2Demo010.zip contains stdout, stderr, the execution record, checksums and any exported CSV/chart files.

Interpreting the result

Use the first relevant exception and the source configuration to resolve the prerequisite or code issue, then rerun. A missing dataset requires the correct original schema and period; substituting synthetic values would be a different experiment. A timeout establishes only that this bounded attempt did not finish.

For model assumptions, original publications and adaptation limits, use the literature guide.

Clone this wiki locally