Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2017-02 | Exponential Standard Deviation Bands (Apirine)

RSS

Traders' Tip text

The exponential standard deviation bands (ESD bands) from this month's Traders' Tip follow the same interpretation guidelines as the traditional Bollinger Bands, for example. The difference is in the usage of exponential standard deviation which is believed to make the ESD bands more sensitive to the market action. As to the optimal condition to applying them, author Vitali Apirine suggests a flat trend.

To illustrate their application we've included a simple system that is based on a %b indicator that depicts how the price relates to the bands as well as to what degree it is above or below any of the bands. If the price is equal to the upper band, %b will be 100%, if it's equal to the lower band, %b will be 0.0, and a %b value of 50% (0.5) means the price is in between i.e. equal to the EMA.

Below you can find rules of the system:

Entry:
  1. Buy at market when ESD Band Width percentage stays below 0.2 (20%) for 3 days in a row
  2. Open no more than 3 positions
  3. Exit at market when ESD Band Width percentage indicator >= 0.8 (80%)

Image

Figure 1. A Wealth-Lab 6 chart illustrating the application of the system's rules on a Daily chart of Powershares QQQ Trust ETF (QQQ).''

To execute the example trading system, Wealth-Lab users should install (or update) the latest version of 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 Community.Indicators; using TASCIndicators;

namespace WealthLab.Strategies { public class PctB : WealthScript { private StrategyParameter esdbPeriod; private StrategyParameter esdbStdDev;

public PctB() { esdbPeriod = CreateParameter("ESD Bands Period", 20, 5, 50, 5); esdbStdDev = CreateParameter("Std Dev", 2, 1, 5, 0.25); } protected override void Execute() { var period = esdbPeriod.ValueInt; var sd = esdbStdDev.Value; var esdbL = ESDBandLower.Series(Close,period,sd); var esdbU = ESDBandUpper.Series(Close,period,sd); DataSeries PctESDBW = ( Close - esdbL ) / ( esdbU - esdbL ); PctESDBW.Description = "% ESDB Width";

DataSeries pctESDBBelow = SeriesIsBelowValue.Series( PctESDBW, 0.2, 3 ); ChartPane xob_pane = CreatePane( 20, true, true ); PlotSeries( xob_pane, pctESDBBelow, Color.DarkRed, WealthLab.LineStyle.Solid, 1 );

ChartPane PctBBWPane = CreatePane( 20, true, true ); PlotSeries( PctBBWPane, PctESDBW, Color.Blue, WealthLab.LineStyle.Solid, 2 ); Color fillColor = Color.FromArgb(16, 0, 0, 255); PlotSeriesFillBand( PricePane, esdbU, esdbL, Color.Blue, fillColor, LineStyle.Solid, 1); HideVolume();

for(int bar = PctESDBW.FirstValidValue; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( PctESDBWbar >= 0.8 ) SellAtMarket( bar+1, LastPosition ); } else { if( bar >= pctESDBBelowbar+3 && pctESDBBelowbar-3 > pctESDBBelowbar-4 ) { SetBackgroundColor( bar, Color.FromArgb(231, 255, 231) ); if( BuyAtMarket( bar+1 ) != null ) LastPosition.Priority = -Closebar; } } } } } }


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.