Introduction This post 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. 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. 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 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 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

On the equity curve, the gradient has turned flat for the last 2 or 3 time periods (not sure what the shown time periods are ... "M/F/N/A"?). Why do you think this is?

What makes you think this is any better than a continuously re-optimized MA crossover? Actually, this has 4 parameters, two of which are guessed. This is just curve-fitting, on the fly.

Hi James. Good to see you back posting on swarm-based systems. I enjoyed your last signal journal and followed it with interest. Are you going to be posting real-time signals for this model also?

This is curve-fitting disguised. It works for some problems but not for the stock-market due to the non-stationarity and non-normality of the price distribution. You might stumble against a stable distribution but the chance is extremely small. And if you do, will you be able to identify it? Good luck Ninna

The labels at the bottom of the chart are for month names. Daily mean reversion was strong leading up to the last major bottom. Since then it weakened off a bit. Historically, if neither daily mean reversion or daily follow through was very dominant then the equity curve wasn't so good. Best Regards, James

Nothing makes me think it is better than a continuously re-optimized MA crossover because I haven't tried that one yet. Do you have any results that you are willing to share? I am genuinely interested. I can always give it a go. Non of the model parameters are fixed. I think you are referring to the ranges that I set for the term periods. The ranges were guessed as you say. Wider ranges might be better. It takes quite a while to run these systems and I'm doing a lot more work than what you see here, so I haven't experimented much. It is curve-fitting on the fly as you say. The function fitting is done via the swarm. Does the swarm produce superior results to a simple curve fitting approach i.e. exhaustive search and use the best parameters? I don't know because I haven't tried that for this system. Experience tells me that simple curve fitting is inferior. I'm always prepared to be proved wrong. A note for other readers: The 'curve fitting' is always done using past data. No future data is used to generate the trading signal on any given trading day. That is, there is no cheating! Best Regards, James

Hi Kevin, Thanks for the encouragement. That is certainly a possibility and a challenge that I am up for! I'd like to combine just 3 similar systems to that described. It would work a bit differently because I would have to run a series of simulations at different potential closing values for the S&P 500 and then produce a report that describes what the signal will be for tomorrow at the different price levels. I do already have one other similar model built. I'll post the description on this thread. What I like about these models is that they assume very little. Running them from 1980 shows they can handle different market regimes. Naturally, I would like to come up with a model that gains a better edge. Best Regards, James

Hi Ninna, The model has no non-linear components. On face value it is linear. However, because the weights are being adjusted bar by bar, over time the model is non-linear. From memory, this could be described as a locally linear nonlinear system. If there are any math / physics gurus out there then I would welcome any comments. There hasn't been any attempt to disguise curve-fitting. All curve-fitting has been done using past data on a walk-forward basis. There hasn't been any cheating here. That is the job of the trade bots in the swarm. They are searching for non-random characteristics in the price movement on a bar by bar basis. Trade bots do not have access to future data, it's all walk-forward. Best Regards, James

In equation: Delta01 = (PriceSeries(t) â PriceSeries(t â Term01Period)) / (Term01Period)^0.5 There is a sqare-root of one of the parameters in the denominator. AFAIK, this is non-linear curve-fitting. It is like generating constantly sort of spline functions that temporarily match past data. However, nothing is said about the future where performance can be negative, but the swarm again fits that part to the old series. I have tested re-optimized MAs on-the-fly long ago and at this point I am not interested in anything but direct interpretation of price action without any equations and parameters. Sorry to say but what you are doing is how people tried to develop trading systems 10 to 20 years ago. This will not work due to the stochastic, non-stationary, non-normal, nature of trading returns.