Introduction
This article features an adaptive autoregressive momentum ‘trading system’. The system trades the short-term daily trends of the SP 500 stock market index. The two terms (weights) of the model and the delta periods are adjusted walking-forward bar by bar by the swarm adaptation engine. The first delta period ranges from 1 to 3 trading days and the second ranges from 4 to 12 trading days. Both of the terms range from -0.5 to +0.5. The system is highly dependent on the swarm adaptation engine.
The model is very basic. The indicator value is calculated as follows:
Delta01 = (PriceSeries(t) – PriceSeries(t – Term01Period)) / (Term01Period)^0.5
Delta02 = (PriceSeries(t) – PriceSeries(t – Term02Period)) / (Term02Period)^0.5
Indicator = Term01 * Delta01 + Term02 * Delta02
Term01 and Term02 are the weights of the model and TermPeriod01 and TermPeriod02 are the corresponding delta periods.
If the Indicator value is positive then the system goes long and vice versa. The simplicity of the model and the uniform ranges across the terms leaves little opportunity for curve fitting prior to the system being run. The minimum and maximum values for the delta periods were an educated guess and are the default values for the scriptbot.
The performance lookback period was set to 1,000 trading days or approximately 4 years. Once upon a time I had a strong tendency to use performance lookback periods in the range of 20 t0 100 trading days. The basic autoregressive models have been in the scriptbot library for quite a while. They would not perform well when using such short performance lookback periods.
System Settings
The trading system simulation was run using SP 500 stock index data from 1980 to present. This period featured a number of very different market regimes. The screen images that follow describe the Dakota system settings.
Dakota Bots and Swarm Settings
- The system will start to produce a trading signal around Jan 1980 (Jan 1976 + 1,000 trading days).
There is approximately equal opportunity for any of the whole number values that fall within the Term Period parameter ranges to be output. e.g. The Term 1 Period ranges from 0.51 to 3.49. There are three possible Term 1 Period values used by the model – 1, 2 or 3. Any values for the Term 1 Period that are greater than or equal to 0.51 and less than 1.5 will be rounded to 1. Any values for the Term 1 Period that are greater than or equal to 1.5 and less than or equal to 2.5 (‘banker’s rounding’) will be rounded to 2.
Dakota Equity Management Settings
The ATS PPIP equity engine calculates the proportion of perfect while in position. The equity engine provides the swarm adaptation engine with performance data over the performance lookback period for each trade bot in the swarm. The performance lookback period has been set to 1,000 trading days or approximately 4 years. The trading delay has been set to zero meaning that the system trades on the close of the current day session.
Image of a Swarm in Action
A 3 dimensional plot of each trade bots position within the adapted parameter space appears below. Bots that are green are producing positive performance over the performance lookback period and bots that are red are producing negative performance. Half of the trade bots are ghost bots and are fixed in position. Signals generated by the ghost bots are not used by Dakota when generating the trading signal. The bunch of green bots toward the bottom of the image belong to the flocking swarm that produce the trading signals that are average to produce the final trading signal on a bar by bar basis.
Results
The Dakota Price, Signal and Equity chart appears below.
The equity curve was reasonably consistent across the 30 year period from 1980 to date. Note that periods of higher volatility will result in the equity curve appearing less consistent. If a position sizing strategy was applied that reduced exposure during periods of higher volatility then the equity curve would appear much smoother than it does in this image.
Dakota Trades Report
The percent of perfect is 9%. This is reasonable for a system that spans thirty years and a number of very different market regimes. The edge is a slight one, but it just might be good enough for incorporation into a system of systems built for trading a mutual fund that closely tracks the S&P 500. A more complete trading simulation will be the topic of a future post.
A report that lists what the trading signal will be over a span of potential closing values for the S& 500 can be created by running a series of simulations. This would make trading make trading on the current close possible. I know that at least one mutual fund will take orders right up until 5 minutes before the bell rings for stocks in the S&P index. There may be times when the S&P 500 index moves dramatically within the last 5 minutes and the ‘wrong’ position is taken, however, I don’t think this would be a show stopper.
Regards,
James Slack-Smith
Founder at AdaptiveTradingSystems.com