TASC 2013-12 | Swing Trading With Three Indicators (Pendergast)

Modified on 2013/11/06 07:25 by Eugene — Categorized as: TASC Traders Tips

Traders' Tip text

The entry-level system featured in this month's issue appears to be a slight variation of "Kestner’s Moving Average System" which can be found in the book "Quantitative Trading Strategies" by Lars Kestner.

Mr. Pendergast puts emphasis on market selection. We also believe that together with position sizing and a sound exit strategy, this is a key to trading success. This explains why the results we got when backtesting the original rules on a portfolio without any market selection strategy (Dow 30 stocks, 5 years of Daily data, 5% equity per trade, no trading costs) were far from being optimal. The system was very trigger-happy, had a considerable drawdown and was losing on the short side.

How can the situation be improved? As suggests its author, the periods of moving averages can be optimized. It might seem like a natural move but we'll approach it from a different angle. Instead, let's leave the parameters as is and add a couple of trade filters which will be simple enough to be in line with the logical and straightforward nature of this swing-trading system:

  1. The first filter confirms the overall direction of the market’s trend by taking long entries only if a 50-day high was made more recently than a 50-day low (vice versa for short trades). We believe this might minimize the entries in choppy markets.
  2. The second filter further avoids exposure to range-bound conditions by requiring a temporary reaction – like a short downward movement after a period of rally – before entering on a breakout. For long trades, we require the number of consecutive bars when High was below the 5-day moving average of Highs for 2 bars in a row (for short trades: the number of consecutive bars when Low has been above the 5-day moving average of Lows for 2 bars in a row).


Figure 1. A Wealth-Lab 6 chart illustrating the tweaked system's rules on a Daily chart of AXP (American Express).

The resulting system fires considerably less trades and appears better from the risk/reward standpoint. To run the Strategy code with the tweaked swing trading system, Wealth-Lab users need to install the latest version of our Community Indicators library from the Extensions section of our website if they haven't already done so, and restart Wealth-Lab.

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Indicators;

namespace WealthLab.Strategies { public class PendergastStrategy : WealthScript { protected override void Execute() { double tick = Bars.SymbolInfo.Tick; DataSeries ema50 = EMAModern.Series(Close, 50); SMA maH = SMA.Series(High, 5); SMA maL = SMA.Series(Low, 5); HighestBar h = HighestBar.Series( High, 50 ); LowestBar l = LowestBar.Series( Low, 50 ); SeriesIsAbove risingLows = SeriesIsAbove.Series( Low, maL, 1); SeriesIsBelow decliningHighs = SeriesIsBelow.Series( High, maH, 1);

HideVolume(); PlotSeries(PricePane,maH,Color.Gold,LineStyle.Solid,2); PlotSeries(PricePane,maL,Color.Red,LineStyle.Solid,2); PlotSeries(PricePane,ema50,Color.Blue,LineStyle.Solid,2);

for(int bar = GetTradingLoopStartBar(51); bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if (p.PositionType == PositionType.Short) CoverAtStop( bar + 1, p, maH[bar] ); else SellAtStop( bar + 1, p, maL[bar] ); } else { if( decliningHighs[bar] >= 2 ) if( h[bar] > l[bar] ) if (Close[bar] > ema50[bar]) BuyAtStop(bar + 1, maH[bar] + 5 * tick); if( risingLows[bar] >= 2 ) if( l[bar] > h[bar] ) if (Close[bar] < ema50[bar]) ShortAtStop(bar + 1, maL[bar] - 5 * tick ); } } } } }

Wealth-Lab team