Repository navigation
Model Elliott2005StrategyDemo1
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
Robert J. Elliott, John van der Hoek and William P. Malcolm, Pairs trading (2005) treats the spread between related securities as an unobserved mean-reverting Gaussian Markov process measured with additional Gaussian noise. This separates a latent relative-value signal from noisy observations.
The paper's stated contribution is a model for estimating and tracking that spread and using it to motivate pairs-trading decisions. The intuition is to trade a deviation relative to an estimated equilibrium, rather than predict each stock's outright direction. The relationship can nevertheless break down, and spread convergence does not remove execution or financing risk.
This introduction is based on the original publisher abstract and author-institution record; full-text derivations were not available for review. The repository offers several signal customizations. Posterior-state, constant-coefficient and empirical-quantile rules must not be described as identical implementations of the paper.
The active customization uses fixed coefficients (1,-1), a long-term-mean reference and entry/exit settings 0.4/0.25 on XOM/CVX with 50 calibration observations. The posterior-state and cointegration variants are commented alternatives. Selecting different customization changes what “fair spread” means; the class name does not guarantee that the active rule reproduces the paper’s estimator.
Demonstrates how to use Elliott2005Strategy and customize the
strategy.
Using this example. Shows the explicit builder route: load two stock caches, choose a mean-reversion customization, construct Elliott2005Strategy and register report measures. The coefficient vector defines the spread and the calibration window counts observations. Yahoo data and a desktop plotter are required.
Model and publication. The publication describes a latent mean-reverting Gaussian Markov spread observed with noise, allowing state estimation and comparison with the observed spread. Full-text access was unavailable in this audit; this explanation uses the publication abstract and the implementation, not a line-by-line paper verification.
Implementation in this tutorial. The active customization uses fixed coefficients (1,-1), a long-term-mean reference and entry/exit settings 0.4/0.25 on XOM/CVX with 50 calibration observations. The posterior-state and cointegration variants are commented alternatives. Selecting different customization changes what “fair spread” means; the class name does not guarantee that the active rule reproduces the paper’s estimator.
| Item | Value |
|---|---|
| Status | completed |
| Run | 39114360151 |
| UTC publication | 2026-10-18 11:43 UTC |
| Source commit | 355aa9242fc2a247b256aecc8406cbb409aa5ff3 |
| Data mode | original main defaults |
| Exit code | 0 |
| Elapsed seconds | 7.43 |
| 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.elliott2005.Elliott2005StrategyDemo1The 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.
09:12:29.507 [main] INFO t.n.algoquant.util.config.AQConfig,194 - looking up configuration file: config.default.xml
09:12:29.510 [main] INFO t.n.algoquant.util.config.AQConfig,194 - looking up configuration file: config/config.default.xml
09:12:29.510 [main] INFO t.n.algoquant.util.config.AQConfig,209 - loading config file: file:/home/runner/work/algoquant-examples/algoquant-examples/target/model-results/Elliott2005StrategyDemo1/work/config/config.default.xml
09:12:29.713 [main] INFO t.n.algoquant.util.config.AQConfig,95 - current directory: /home/runner/work/algoquant-examples/algoquant-examples/target/model-results/Elliott2005StrategyDemo1/work
09:12:29.713 [main] INFO t.n.algoquant.util.config.AQConfig,169 - current config:
09:12:29.720 [main] INFO t.n.algoquant.util.config.AQConfig,11 - nm.license: /home/runner/work/algoquant-examples/algoquant-examples/license/nm.lic
09:12:29.722 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_FOLDER: ./test-data
09:12:29.723 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_GAINCAPITAL: ${DATA_FOLDER}/processed/gaincapital/extracted-from-raw-arrange-by-dates
09:12:29.723 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_BLOOMBERG: ${DATA_FOLDER}/processed/bloomberg
09:12:29.723 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_YAHOO: ${DATA_FOLDER}/yahoo
09:12:29.723 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_SGX: ${DATA_FOLDER}/raw/sgx
09:12:29.723 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_HOLIDAYS: ./log/holidays
09:12:29.724 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_COMPUSTAT_HK: ${DATA_FOLDER}/[database configuration redacted]/hk
09:12:29.724 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_OUTPUT_FOLDER: ./log/
09:12:29.724 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_PLOT_WIDTH: 800
09:12:29.725 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_PLOT_HEIGHT: 600
09:12:31.835 [main] INFO t.n.a.d.h.yahoo.YahooEODCacheFactory,237 - failed to load from file, reason: no data read from file; load from web
09:12:31.836 [main] INFO t.n.a.d.h.yahoo.YahooEODCacheFactory,196 - reading Yahoo! data for XOM from the Internet from 2005-01-01T00:00 to 2011-09-01T16:00
09:12:31.993 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,30 - writing csv.zip file ./log/Yahoo/XOM.csv.zip
09:12:32.021 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,81 - finished writing ./log/Yahoo/XOM.csv.zip
09:12:32.024 [main] INFO t.n.a.d.h.yahoo.YahooEODCacheFactory,237 - failed to load from file, reason: no data read from file; load from web
09:12:32.024 [main] INFO t.n.a.d.h.yahoo.YahooEODCacheFactory,196 - reading Yahoo! data for CVX from the Internet from 2005-01-01T00:00 to 2011-09-01T16:00
09:12:32.189 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,30 - writing csv.zip file ./log/Yahoo/CVX.csv.zip
09:12:32.210 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,81 - finished writing ./log/Yahoo/CVX.csv.zip
09:12:32.218 [main] INFO t.n.a.d.m.e.Elliott2005StrategyDemo1,137 - Elliott2005Strategy: trading XOM @ NEW_YORK vs. CVX @ NEW_YORK; calibration window = 50
09:12:32.998 [main] INFO t.n.a.m.m.e.s.Elliott2005Strategy,26 - recalibration of strategy @ 2005-03-15T16:00: beta = [1.000000, -1.000000] , mu = 6.9861135397028296, xt = 3.9009366862193877, zt = 3.8992671966552734
09:12:33.012 [main] INFO t.n.a.m.m.e.s.Elliott2005Strategy,26 - recalibration of strategy @ 2005-03-16T16:00: beta = [1.000000, -1.000000] , mu = 4.1847284694088644, xt = 3.678453823590226, zt = 3.6760711669921875
... excerpt shortened; complete stdout is in the release archive ...
98 2009-05-29T16:00 BUY XOM 1.0 36.80390167236328
99 2009-08-31T16:00 BUY CVX 1.0 35.548095703125
100 2009-08-31T16:00 SELL XOM 1.0 36.92190933227539
101 2009-09-01T16:00 SELL CVX 1.0 34.806026458740234
102 2009-09-01T16:00 BUY XOM 1.0 36.526798248291016
103 2009-09-15T16:00 BUY CVX 1.0 36.407066345214844
104 2009-09-15T16:00 SELL XOM 1.0 37.103450775146484
105 2009-09-24T16:00 SELL CVX 1.0 35.93946075439453
106 2009-09-24T16:00 BUY XOM 1.0 36.804439544677734
107 2009-10-08T16:00 SELL CVX 1.0 36.31557083129883
108 2009-10-08T16:00 BUY XOM 1.0 36.868507385253906
109 2009-10-22T16:00 BUY CVX 1.0 39.28384780883789
110 2009-10-22T16:00 SELL XOM 1.0 39.74645233154297
111 2009-10-30T16:00 SELL CVX 1.0 38.902645111083984
112 2009-10-30T16:00 BUY XOM 1.0 38.26744079589844
113 2009-11-19T16:00 BUY CVX 2.0 39.655216217041016
114 2009-11-19T16:00 SELL XOM 2.0 40.0905647277832
115 2009-11-27T16:00 SELL CVX 1.0 40.08079528808594
116 2009-11-27T16:00 BUY XOM 1.0 40.20872497558594
117 2009-11-30T16:00 BUY CVX 1.0 40.01416015625
118 2009-11-30T16:00 SELL XOM 1.0 40.316123962402344
119 2009-12-04T16:00 SELL CVX 2.0 40.02952194213867
120 2009-12-04T16:00 BUY XOM 2.0 39.87574768066406
121 2009-12-15T16:00 BUY CVX 1.0 39.670616149902344
122 2009-12-15T16:00 SELL XOM 1.0 37.147552490234375
123 2009-12-16T16:00 SELL CVX 1.0 39.93723678588867
124 2009-12-16T16:00 BUY XOM 1.0 36.75014114379883
125 2009-12-17T16:00 BUY CVX 2.0 39.36810302734375
126 2009-12-17T16:00 SELL XOM 2.0 36.63735580444336
127 2009-12-29T16:00 SELL CVX 1.0 39.588565826416016
128 2009-12-29T16:00 BUY XOM 1.0 36.97034454345703
129 2009-12-30T16:00 BUY CVX 1.0 39.814186096191406
130 2009-12-30T16:00 SELL XOM 1.0 36.932735443115234
131 2010-01-07T16:00 SELL CVX 1.0 40.67558670043945
132 2010-01-07T16:00 BUY XOM 1.0 37.48588943481445
133 2010-01-14T16:00 BUY CVX 1.0 40.78839111328125
134 2010-01-14T16:00 SELL XOM 1.0 37.42146682739258
135 2010-01-26T16:00 SELL CVX 1.0 38.019596099853516
136 2010-01-26T16:00 BUY XOM 1.0 35.402137756347656
137 2010-02-05T16:00 BUY CVX 1.0 36.49675750732422
138 2010-02-05T16:00 SELL XOM 1.0 34.800662994384766
139 2010-02-17T16:00 SELL CVX 1.0 37.70534896850586
140 2010-02-17T16:00 BUY XOM 1.0 35.5466194152832
141 2010-04-09T16:00 SELL CVX 1.0 41.15286636352539
142 2010-04-09T16:00 BUY XOM 1.0 37.168270111083984
143 2010-04-22T16:00 BUY CVX 2.0 42.03287887573242
144 2010-04-22T16:00 SELL XOM 2.0 37.06016540527344
145 2010-04-28T16:00 SELL CVX 1.0 41.73264694213867
146 2010-04-28T16:00 BUY XOM 1.0 37.40070724487305
147 2010-05-03T16:00 SELL CVX 1.0 42.876644134521484
148 2010-05-03T16:00 BUY XOM 1.0 36.67096710205078
149 2010-05-13T16:00 BUY CVX 1.0 40.852630615234375
150 2010-05-13T16:00 SELL XOM 1.0 35.232913970947266
151 2010-11-09T16:00 BUY CVX 1.0 44.066688537597656
152 2010-11-09T16:00 SELL XOM 1.0 38.95720291137695
153 2010-11-10T16:00 SELL CVX 1.0 44.9157600402832
154 2010-11-10T16:00 BUY XOM 1.0 39.232967376708984
155 2010-11-19T16:00 SELL CVX 1.0 44.64590072631836
156 2010-11-19T16:00 BUY XOM 1.0 38.90754699707031
157 2010-12-02T16:00 BUY CVX 1.0 44.9437255859375
158 2010-12-02T16:00 SELL XOM 1.0 39.426025390625
159 2011-03-17T16:00 SELL CVX 1.0 54.78826904296875
160 2011-03-17T16:00 BUY XOM 1.0 45.00110626220703
161 2011-04-12T16:00 BUY CVX 1.0 55.82788848876953
162 2011-04-12T16:00 SELL XOM 1.0 46.12114715576172
163 2011-07-07T16:00 SELL CVX 1.0 57.56104278564453
164 2011-07-07T16:00 BUY XOM 1.0 45.92548370361328
165 2011-07-08T16:00 BUY CVX 1.0 57.183021545410156
166 2011-07-08T16:00 SELL XOM 1.0 45.958946228027344
167 2011-08-01T16:00 SELL CVX 1.0 56.9075927734375
168 2011-08-01T16:00 BUY XOM 1.0 44.38644790649414
169 2011-08-02T16:00 BUY CVX 2.0 55.8653564453125
170 2011-08-02T16:00 SELL XOM 2.0 43.40503692626953
171 2011-08-03T16:00 SELL CVX 1.0 55.49276351928711
172 2011-08-03T16:00 BUY XOM 1.0 43.33812713623047
09:12:35.054 [main] INFO t.n.a.d.m.e.Elliott2005StrategyDemo1,178 - performance report:%nPerformance Report:
Product Profit Loss Information Ratio For Zero Investment Omega For Periods
CVX -11.293968200683594 -0.3654078140242413 -0.7865519401543325
XOM 4.641933441162109 0.26632718614593787 1.0349791491066394
Total -6.652034759521484 -0.37774729764228077 -0.801537352715947

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.

Parameter axes are separate. Record order is preserved; estimated parameters are not investment performance.
Derived from stdout.log using the precision available in that file. Download plotted data. Undefined or malformed cells are omitted, never replaced by zero.

Download Elliott2005StrategyDemo1.zip contains stdout, stderr, the execution record, checksums and any exported CSV/chart files.
| Export | Bytes |
|---|---|
files/charts/chart-01.png |
178175 |
files/derived-charts/charts.json |
1026 |
files/derived-charts/derived-01.csv |
457 |
files/derived-charts/derived-01.png |
84933 |
files/derived-charts/derived-02.csv |
47514 |
files/derived-charts/derived-02.png |
61514 |
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.