SP Trend Pullback Dakota 3 System

Trend pullback trading strategies are relatively simple and tend to work across different time frames and on a wide range of securities. We are going to build a Dakota 3 system for the SP futures contract that goes long when a short-term decline occurs in an uptrend and goes short when a short-term rally occurs in a downtrend. This system will be different to the majority of implementations you have seen because it makes use of swarm adaptation.

The model will trade MOC on the trading day following the day the system was updated. A signal to go long occurs when the closing price is below the preceding n closes and the close is above the upper trend channel (will be explained). Long positions are closed when the closing price advances above a shorter-term moving average or when the close declines below the upper trend channel. Vice versa for short positions.

We’ll jump into a description of how to build the system and explain what’s what as we go. First step is to load the non-adjusted daily SP futures data from 1/2/1990 up to date. I use data supplied by Pinnacle Data Corp.

Figure 1. SP Daily Data

Figure 1. SP Daily Data

The next step is to configure the Equity settings. We are using the default equity engine, have set the trading delay to 1 and slippage and commission to zero.

Figure 2. Equity Settings

Figure 2. Equity Settings

After deleting the Volume variable on the Indicators tab we want to add 2 extra variables. The first is the ReturnsIndex applied to the SP close and the second is just the SP close. Later we will set the signal generator Intermarket parameter to True so the signal generator makes use of these 2 variables.

Figure 3. Indicator Settings

Figure 3. Indicator Settings

The ReturnsIndex is computed like this:

RI(t) = RI(t-1) + 100 * (P(t) / P(t-1) – 1)

RI is the ReturnsIndex and P is the price of the security. The longer-term moving average trendline and trend channels will be computed using the ReturnsIndex rather than the raw price data. Something like the natural log of the price multiplied by 100 could have been used instead of the ReturnsIndex of the price. By setting the Intermarket parameter of the signal generator to True, we have the flexibility to use whatever series we like.

In the image below we can see that we have configured 1 swarm that consists of 25 trade bots.

Figure 4. Swarm Settings

Figure 4. Swarm Settings

The Halton Initializer will distribute the bots approximately evenly within the adapted parameter space. The Flocking Dove swarm adapter has been selected. The Limit Velocity swarm adapter parameter has been set to True and the maximum bot parameter velocity has been set to 0.04 (4%).

Figure 5. Flocking Dove Swarm Adapter Settings

Figure 5. Flocking Dove Swarm Adapter Settings

The selected Bot Performance add-in is the AvgReturnDivStdDev which computes the average trade return divided by the standard deviation of trade returns over the performance lookback period. The performance Lookback Period has been left at the default value of 200 trading days (not shown here).

The selected signal generator is the PricePeSwingBarsMaTrendPxSma. Parameters Min Swing Bars, MA Exit Period and MA Trend Period are all being adapted by the swarm within the bounds that have been specified.

Figure 6. Signal Generator Settings

Figure 6. Signal Generator Settings

An explanation of the signal generator parameters follows:

Min Swing Bars: The Swing Bars indicator is computed by counting the number of preceding Close/Open/Indicator values that are either above the most recent value or below it. To enter a long position there must be a minimum number of previous consecutive value above the most recent closing price. Vice versa for short positions.

MA Exit Period: The MA Exit Period is the period of the shorter-term moving average that is used to determine when positions should be closed. If the system is long and the closing price advances above the shorter-term moving average then the position will be closed.

MA Trend Period: The MA Trend Period is the period of the longer-term moving average that functions as a trendline. The Intermarket parameter has been set to True so the longer-term moving average will be computed on the ReturnsIndex.

Channel Width: The width of the MA Trendline channel. Set the Channel Width to zero if you do not want a trend channel. If the Channel Width is set to zero then the upper and lower trend channel values will equal the MA Trendline value. The Intermarket parameter has been set to True so the Channel Width will be in units of the ReturnsIndex.

Trend Break Exit: Trend Break Exit indicates if open positions should be closed when the trend is ‘broken’. If Interchannel Trading is set to False then long positions will be closed when the price crosses below the upper trend channel and short positions will be closed when the price crosses above the lower trend channel. If Interchannel Trading is set to True then long positions will be closed when the price crosses below the lower trend channel and short positions will be closed when the price crosses above the upper trend channel.

Interchannel Trading: If Interchannel Trading is set to True then both long and short positions can be initiated when the price is less than or equal to the upper trend channel and greater than or equal to the lower trend channel. If Interchannel Trading is set to False then long positions can only be initiated if the price is above the upper trend channel and short positions can only be initiated if the price is below the lower trend channel.

The MA Exit Type and MA Trend Type parameters are for selecting the type of moving average to use as the shorter and longer-term moving averages.

The image below is of the equity curve generated by running this system. We can see that the system has performed very well from Jan 1990 to date.

Figure 7. System Equity Curve

Figure 7. System Equity Curve

The Dakota 3 Trade Report follows.

Figure 8. Dakota 3 Trade Report

Figure 8. Dakota 3 Trade Report

This particular system is included in my portfolio of market timing models for the SP futures contract. You are more than welcome to post any questions you may have in the comments section below.

Kind Regards,

James

2 thoughts on “SP Trend Pullback Dakota 3 System

  • This system does look promising as you mentioned above. You also mentioned a portfolio of SP market timing models – where can we see this portfolio and the systems that currently make it up. Thanks. Rich

Leave a Reply

Your email address will not be published. Required fields are marked *