Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2020-07 | Truncated Indicators (Ehlers)


Traders' Tip text

In his article in July 2020 issue, Dr. Ehlers shows how to improve a bandpass filter's ability to reflect price by limiting the data range. Filtering out the temporary spikes and price extremes should positively affect the indicator stability. Enter new indicator - the TruncatedBandPass filter.

Despite the math behind it may not appear as easy to some, Wealth-Lab proves that prototyping a trading system should not be a complex task. In fact, "Strategy from Rules" makes it possible for everyone to achieve without having to invest much effort.

For example, crossovers of the Truncated BandPass with zero could indicate a trend. Let's see if if the idea has merit:

Step 1. Install (or update) the TASCIndicators library to its most-recent version from our website or using the built-in Extension Manager.

Step 2. Add an Entry and Exit blocks, then drag and drop "Indicator crosses above (below) Value" from "General Indicators" under the Conditions tab on top of each one (respectively).

Step 3. For each entry and exit, choose the TruncatedBandPass as "Indicator" and zero as the value to cross where prompted.


Figure 1. Creating a Rule-based Strategy with the Truncated BandPass in Wealth-Lab.

A quick test shows we're onto something and with more tweaking we may be able to make a trading system out of it:


Figure 2. The example trading system applied to a Daily chart of TQQQ (data provided by AlphaVantage).

WealthScript Code (C#)

Whether you’ve prototyped the trading system code like shown above or downloaded it from Wealth-Lab (hit Ctrl-O and choose "Download..."), to peek into the code behind it simply click "Open code in new Strategy window". Here’s it for your convenience:

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

namespace WealthLab.Strategies { public class TASC2020_07 : WealthScript { protected override void Execute() { var tbp = TruncatedBandPass.Series(Close, 20, 0.10, 10);

HideVolume(); ChartPane pane1 = CreatePane(25,true,true); PlotSeries(pane1,tbp,Color.MidnightBlue,LineStyle.Solid,1);

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

Robert Sucher and Gene Geren (Eugene)
Wealth-Lab team

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.