TASC 2015-09 | Decyclers (Ehlers)

Modified on 2015/08/01 08:58 by Eugene — Categorized as: TASC Traders Tips

Traders' Tip text

In this issue, Dr. John Ehlers shares two new "decycler" indicators whose main feature is ability to identify trends with virtually zero lag.

To demonstrate the timely response of Decycler oscillator to market action, the enclosed long-only trading system applies the idea of using a Decycler oscillator pair with different parameters as per the article:

On the price pane, the decycler is plotted along with the hysteresis lines (+/- 0.5 percent). The green background indicates an uptrend in the market (the prices are above the upper hysteresis line) and the red background indicates a downtrend (the prices are below the lower hysteresis line). The bottom pane illustrates trend detection according to the pair of Decycler oscillators. The yellow line has a period of 100 a K value of 1.2 and the red line has a period of 125 and a K value of 1.


Figure 1. The price pane shows the decycler indicator with the hysteresis lines. The bottom pane plots a pair of decycler oscillators.

As can be seen on Figure 1, robust application of the indicators in a trading system require putting in some logic against whipsaw conditions such as from March’2015 to June'2015.

To execute the included trading system, Wealth-Lab users need to install (or update to) the latest version of the 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 MyStrategy : WealthScript { protected override void Execute() { // Decycler and oscillator SimpleDecycler sd = SimpleDecycler.Series(Close,125); DecyclerOscillator do1 = DecyclerOscillator.Series(Close,125,1.0); // Hysteresis band 0.5% DecyclerOscillator do2 = DecyclerOscillator.Series(Close,(int)(125 * 0.8),1.0 * 1.2);

HideVolume(); ChartPane paneDecyclerOsc = CreatePane(30,false,true); PlotSeries(paneDecyclerOsc,do1,Color.Red,LineStyle.Solid,2); PlotSeries(paneDecyclerOsc,do2,Color.Goldenrod,LineStyle.Solid,2); PlotSeries(PricePane,sd,Color.Red,LineStyle.Solid,2); PlotSeriesFillBand(PricePane, sd * 1.005, sd * 0.995, Color.Goldenrod, Color.Transparent, LineStyle.Solid, 2);

for(int bar = GetTradingLoopStartBar(125); bar < Bars.Count; bar++) { if ( Close[bar] > (sd[bar] * 1.005) ) SetPaneBackgroundColor( PricePane, bar, Color.FromArgb(30,Color.Green) );

else if ( Close[bar] < (sd[bar] * 0.995) ) SetPaneBackgroundColor( PricePane, bar, Color.FromArgb(30,Color.Red) );

bool reverse2Uptrend = CrossOver( bar, do2, do1 ); bool reverse2Downtrend = CrossUnder( bar, do2, do1 ); if (IsLastPositionActive) { if ( !reverse2Downtrend || reverse2Uptrend ) SetPaneBackgroundColor( paneDecyclerOsc, bar, Color.FromArgb(30,Color.Green) ); if( reverse2Downtrend ) SellAtMarket(bar+1, LastPosition); } else { if ( reverse2Downtrend || !reverse2Uptrend ) SetPaneBackgroundColor( paneDecyclerOsc, bar, Color.FromArgb(30,Color.Red) );

if( reverse2Uptrend ) BuyAtMarket(bar+1); } } } } }

Wealth-Lab team