Log in to see Cloud of Tags

Wealth-Lab Wiki

KeltnerLower

RSS

Syntax

public KeltnerLower(Bars bars, int periodOne, int periodTwo, string description) public static KeltnerLower Series(Bars bars, int periodOne, int periodTwo)

Parameter Description

bars The Bars object
periodOne The period to smooth Highs-Lows
periodTwo The period to smooth Average Price

Description

Keltner Bands are a type of price channel first described by Chester W. Keltner in his book How to Make Money in Commodities. They are fixed bands that are plotted above and below a simple moving average (SMA) of average price (AveragePriceC). See also: KeltnerUpper.

The Keltner indicators in Wealth-Lab take two parameters. periodOne specifies the period to smooth highs - lows, and periodTwo specifies the period to use to smooth Average Price in the calculation (see below). Note that because Keltner Bands are defined to use average price, and highs minus lows, the indicator does not take a Price Series parameter like many other indicator functions.

Interpretation

  • The classic interpretation of Keltner band is to go long when the upper band is penetrated, and reverse position and enter short when the lower band is penetrated.
  • Keltner Bands can also be used to define "normal" trading ranges for markets. Price movement outside of the bands can be considered an anomaly, and therefore a trading opportunity.

Calculation

Average Price (AP) = (Close + High + Low ) / 3

Band Moving Average = Period1 bar Simple Moving Average (SMA) of (High - Low)

Center Line = Period2 bar SMA of AP

Upper Band = Center Line + Band MA

Lower Band = Center Line - Band MA

Example

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

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { DataSeries K1 = KeltnerLower.Series( Bars, 10, 10 ); DataSeries K2 = KeltnerUpper.Series( Bars, 10, 10 ); PlotSeriesFillBand( PricePane, K1, K2, Color.Blue, Color.Empty, LineStyle.Solid, 2);

for(int bar = 30; bar < Bars.Count; bar++) { if( !IsLastPositionActive ) { if( CrossOver( bar, Close, K2 ) ) BuyAtMarket( bar+1 ); else if( CrossUnder( bar, Close, K1 ) ) ShortAtMarket( bar+1 ); } else { Position p = LastPosition; if( CrossOver( bar, Close, K2 ) & p.PositionType != PositionType.Long ) { CoverAtMarket( bar+1, p ); BuyAtMarket( bar+1 ); } if( CrossUnder( bar, Close, K1 ) & p.PositionType == PositionType.Long ) { SellAtMarket( bar+1, p ); ShortAtMarket( bar+1 ); } } } } } }


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.