TASC 2020-05 | Correlation as a Trend Indicator (Ehlers)

Modified on 2020/03/28 09:43 by Eugene — Categorized as: TASC Traders Tips

Traders' Tip text

In May 2020 issue, Mr. Ehlers presents what looks like a simple and elegant idea for a trend detection and mode switching indicator. Following the trading idea in the article, we are including a simple long-only WealthScript system to demonstrate the CorrelationTrend:

  1. Buy at market when the 20-day CorrelationTrend crosses above zero
  2. Exit long when the indicator crosses below zero

Careful market selection may be the key to a correct application of the indicator. Even such barebone rules could shine with stocks like AAPL that tend to develop prolonged trends. But for others like CAT which can keep oscillating in range for years, results will be much less impressive. They require a different approach. For example, you would want to buy when CorrelationTrend falls significantly below zero and sell when it reaches positive values.


Figure 1. A stock like Apple is an easy target for CorrelationTrend.

Therefore it would be an interesting problem to research CorrelationTrend's ability to identify the switch to a cycle mode. That might help develop counter-trend systems and trade pullbacks. Another possible application might be to act as a system filter of change from trending mode to mean reversion mode.

To execute the included trading system, Wealth-Lab users need to install (or update) 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. Then either copy/paste the included Strategy's C# code or simply let Wealth-Lab do the job. From “Open Strategy” dialog, click “Download” to get this strategy as well as many other contributed by the Wealth-Lab community.

WealthScript Code (C#)

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() { var ct = CorrelationTrend.Series(Close, 20);

ChartPane pane1 = CreatePane( 35,true,true); PlotSeries( pane1,ct,Color.DarkRed,LineStyle.Solid,2); DrawHorzLine( pane1, 0, Color.DarkBlue, LineStyle.Solid, 1);

for(int bar = GetTradingLoopStartBar(1); bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if (CrossUnder(bar, ct, 0)) SellAtMarket( bar + 1, p); } else { if (CrossOver(bar, ct, 0)) BuyAtMarket( bar + 1); } } } } }

Gene Geren (Eugene)
Wealth-Lab team