Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2019-10 | Combining Bollinger Bands With Candlesticks (Kosinski)

RSS

Traders' Tip text

The trading system from this month's article by Pawel Kosinski features an approach that combines multiple unrelated techniques to make an entry - trading the bands based on a sound statistical theory with the candlestick pattern recognition. It's believed that when several signals are in line, confirming each other, the strategy has a better chance.


Image

Figure 1. Sample trade on the chart of VZ (Verizon). Data provided by Yahoo Finance.


The trading system could be assembled in Wealth-Lab in a drag and drop fashion from the building blocks known as Rules. On Figure 2 we show a way to achieve better flexibility through “Multi Condition Group” feature. In essence it triggers the entry signal when the Engulfing and one of Bollinger Band conditions occurred not on the same day exactly but close enough to each other i.e. within a few days.


Image

Figure 2. All conditions required to assemble the trading system are in place.


For those of you who like to have a more finer control we publish the translated code below. It’s downloadable in Wealth-Lab (hit Ctrl-O and choose "Download..."):

WealthScript Code (C#)

Since it has some prerequisites, it’s preferred that you simply download this code in Wealth-Lab (hit Ctrl-O and choose "Download...") rather than copy/paste it:

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

namespace WealthLab.Strategies { public class TradersTipsOct2019 : WealthScript { private StrategyParameter paramPeriod; private StrategyParameter paramDev; public TradersTipsOct2019() { paramPeriod = CreateParameter("Bands Period", 20, 5, 50, 5); paramDev = CreateParameter("Bands Dev.", 2.0, 0.5, 5.0, 0.5); } protected override void Execute() { int period = paramPeriod.ValueInt; var bbU = BBandUpper.Series(High,period, paramDev.Value); var bbL = BBandLower.Series(Low, period, paramDev.Value); PlotSeriesFillBand(PricePane, bbU, bbL, Color.Silver, Color.FromArgb(10,Color.Green), LineStyle.Solid, 1);

for(int bar = GetTradingLoopStartBar(period); bar < Bars.Count; bar++) { if (IsLastPositionActive) { if(High[bar] > bbU[bar]) ExitAtMarket(bar+1,LastPosition); } else { //touches the lower band if( (Close[bar-1] > bbL[bar-1]) && ((Low[bar-1] < bbL[bar-1]) || (Low[bar-2] < bbL[bar-2])) //engulfing: && (Close[bar-2] < Open[bar-2]) && (Close[bar-1] > Open[bar-1]) && (Open[bar-1] < Close[bar-2]) && (Close[bar-1] > Open[bar-2]) && ((Close[bar-1] - Open[bar-1]) > 20*Bars.SymbolInfo.Tick) && (Close[bar] > High[bar-1] ) ) BuyAtMarket(bar+1); } } } } }

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.