TASC 2015-03 | Trading System Design: A Statistical Approach (Ehlers, Way)

Modified on 2015/01/31 10:48 by Eugene — Categorized as: TASC Traders Tips

Traders' Tip text

In March 2015 issue, authors John Ehlers and Ric Way outlined a statistically valid procedure for the successful development of trading systems, providing a testbed for assessing whether the price will increase or decrease over N bars after an event.

From our point of view, it might be optimal to prove the conclusion regarding robustness of the example system by using a different subset of data. It's not a secret that throughout the in-sample period of 10 years used to optimize the system on, almost 6 have been attributed to blowing the third biggest bubble in the U.S. stock market history. Consequently, it's hard to not come up with a trading system having a positive expectation when the market is again comparable to the Dot-com frenzy.

Image

Figure 1. A Wealth-Lab 6 chart showing the U.S. market bubble of the 2010's through the monthly chart of S&P 500 index (^GSPC).

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

namespace WealthLab.Strategies { public class EhlersMar2015 : WealthScript { private StrategyParameter paramStoc; private StrategyParameter paramThresh; private StrategyParameter paramLength; private StrategyParameter paramLoss;

public EhlersMar2015() { paramStoc = CreateParameter("StocLength", 8, 1, 100, 1); paramThresh = CreateParameter("Threshold", 0.3, 0.1, 0.9, 0.1); paramLength = CreateParameter("TradeLength", 14, 1, 50, 1); paramLoss = CreateParameter("PctLoss", 3.8, 0.5, 15.0, 0.5); } protected override void Execute() { int StocLength = paramStoc.ValueInt, TradeLength = paramStoc.ValueInt; double Threshold = paramThresh.Value, PctLoss = paramLoss.Value;

Highest HiC = Highest.Series(Close, StocLength); Lowest LoC = Lowest.Series(Close, StocLength); DataSeries Stoc = (Close - LoC) / (HiC - LoC); for(int bar = GetTradingLoopStartBar(1); bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if ( bar+1 - p.EntryBar >= TradeLength ) SellAtMarket( bar+1, p, "Timed" ); else if( Low[bar] < p.EntryPrice*(1.0 - PctLoss /100d) ) SellAtMarket(bar+1, p, "Stop");

} else { if( CrossOver( bar, Stoc, Threshold ) ) BuyAtMarket( bar+1 ); } } } } }

Eugene
Wealth-Lab team
www.wealth-lab.com