Skip to content

Model MRModelRanged2Demo

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

MRModelRanged2Demo — quantitative model reference

Wiki home · Quantitative model references · Execution records

This quantitative model reference is provided for study, further research and application within the AlgoQuant framework. Read the research idea and implementation choices separately from the execution record.

Tutorials and quantitative model references · Pinned source · Javadoc

Strategy introduction

This example illustrates a mean-reversion or grid-style trading policy assembled in code. No single original publication has been established for the exact rule, so this page explains the strategy without inventing a paper citation.

The broad idea is to change inventory as price moves through configured levels, or as a spread deviates from a reference. Reversals can allow purchases and sales at different levels, while a persistent trend can accumulate exposure or losses. A rule that repeatedly realizes small gains can still carry substantial open-position risk.

The result depends on grid spacing, reference updates, position limits, data frequency, fills and costs. Mean reversion is an assumption to examine, not a property created by the grid itself. Read the implementation below for the exact configuration, and inspect both account value and outstanding inventory when interpreting a simulation.

How this demo connects to the idea

Here the pair coefficient is -1.5 and MRModelRanged receives 0.0025; these values specify a spread and a range, not an allocation percentage. These are library-specific spread/grid trading policies. A basket converts product prices into a spread; the configured mean-reversion model maps its level or deviation into a desired state, and MeanReversionStrategy translates that state into product orders. Grid distance, periodic/ranged update behavior and scale are distinct controls. The folder name does not mean that option implied volatility is being traded. Mean reversion is an assumption to check, not a property guaranteed by this policy.

What this example teaches

Using this example. Builds an AUD/USD and NZD/USD pair basket with coefficient -1.5 and MRModelRanged threshold 0.0025. It uses local GainCapital tick files, a desktop plotter and trade-based measures. The scale and lot inputs are quantities, not percentages of initial capital.

Model and publication. No single original research publication is claimed for this library/example policy.

Implementation in this tutorial. Here the pair coefficient is -1.5 and MRModelRanged receives 0.0025; these values specify a spread and a range, not an allocation percentage. These are library-specific spread/grid trading policies. A basket converts product prices into a spread; the configured mean-reversion model maps its level or deviation into a desired state, and MeanReversionStrategy translates that state into product orders. Grid distance, periodic/ranged update behavior and scale are distinct controls. The folder name does not mean that option implied volatility is being traded. Mean reversion is an assumption to check, not a property guaranteed by this policy.

Verified execution record

Item Value
Status completed
Run 39122217560
UTC publication 2026-10-18 11:43 UTC
Source commit f497645628296f441e1e254127a7547d15106bbc
Data mode original main defaults
Exit code 0
Elapsed seconds 9.64
Time limit seconds 1800
Maximum Java heap 6g
AlgoQuant source commit aba178deb0e78dc72184546a1e0934c3abce74a1
NM Dev source commit 04c12d1640fb700f52a2f7dc5cadf560040490e6
Combined runtime SHA-256 c1199a1c204cc4ffdf937b756bceacaf30bb64f35a844770490fea268742379b

The original main returned successfully without a detected calculation error. Read its assumptions before interpreting it.

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.volarb.MRModelRanged2Demo

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

11:14:29.325 [main] INFO  t.n.a.demo.model.volarb.MRModelRanged2Demo - Performance Report:
Product	Execution Count	Profit Loss	Information Ratio For Trades	Omega For Trades
AUD/USD	5.0	-0.001999999978579581	-0.10280627680451036	-0.24881979948688263
NZD/USD	5.0	0.0037999999476596713	0.44082010280025963	2.7513922320368223
Total	10.0	0.0017999999690800905	0.12604770394980278	0.39852004843181377

Charts from this run

Chart 1

Reported performance statistics

Products and aggregate shown exactly as reported; P/L is monetary, not percent. Currency conventions belong to the demo.

Derived from stdout.log using the precision available in that file. Download plotted data. Undefined or malformed cells are omitted, never replaced by zero.

Chart 2

Downloadable evidence

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

Export Bytes
files/charts/chart-01.png 180252
files/derived-charts/charts.json 521
files/derived-charts/derived-01.csv 548
files/derived-charts/derived-01.png 100184

Interpreting the result

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.

Clone this wiki locally