Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2014-01 | Predictive Indicators For Effective Trading Strategies (Ehlers)

RSS

Traders' Tip text

This month, Mr. Ehlers presents new indicators: the SuperSmoother filter that is superior to moving averages for having aliasing noise removed, and MESAStochastic oscillator – a Stochastic successor with the effect of spectral dilation removed by the use of a roofing filter.

To demonstrate the effect of applying the new indicators, author introduces a simple counter-trend system that goes long when MESAStochastic crosses below the oversold value and reverses the trade by taking a short position when the oscillator exceeds the overbought threshold.

Image

Figure 1. A Wealth-Lab 6 chart illustrating the application of the system's rules on a Daily chart of USD/CHF (U.S Dollar to Swiss Franc exchange rate).

To execute the included trading system, Wealth-Lab users need to install (or update) the latest version of our TASCIndicators 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 TASCIndicators;

namespace WealthLab.Strategies { public class Ehlers201401 : WealthScript { private StrategyParameter paramPeriod; public Ehlers201401() { paramPeriod = CreateParameter("MESAStoch.Period",20,5,100,5); } protected override void Execute() { int period = paramPeriod.ValueInt; RoofingFilter rf = RoofingFilter.Series(Close); MESAStochastic ms = MESAStochastic.Series(Close,period); for(int bar = period; bar < Bars.Count; bar++) { // Detect crossover/crossunder and store state in a variable bool maXo = CrossOver(bar, ms, 0.8); bool maXu = CrossUnder(bar, ms, 0.2); // The first trade if (Positions.Count == 0){ if ( maXu ) BuyAtMarket( bar + 1 ); else if( maXo ) ShortAtMarket( bar + 1 ); } // Subsequent trades else { Position p = LastPosition; if ( p.PositionType == PositionType.Long ) { if ( maXo ) { SellAtMarket( bar + 1, p ); ShortAtMarket( bar + 1 ); } } else if ( maXu ) { CoverAtMarket( bar + 1, p ); BuyAtMarket( bar + 1 ); } } }

HideVolume(); ChartPane pMS = CreatePane(40,false,true); ChartPane pRF = CreatePane(20,true,true); PlotSeries(PricePane,SuperSmoother.Series(Close),Color.Red,LineStyle.Solid,1); PlotSeries(pRF,rf,Color.FromArgb(255,0,0,139),LineStyle.Solid,1); PlotSeries(pMS,ms,Color.FromArgb(255,255,0,128),LineStyle.Solid,2); DrawHorzLine(pMS,0.8,Color.Red,LineStyle.Dashed,1); DrawHorzLine(pMS,0.2,Color.DarkGreen,LineStyle.Dashed,1); } } }

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

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.