ATRBandLower

Modified on 2010/09/13 15:10 by Eugene — Categorized as: Community Indicators

Syntax

public ATRBandLower(Bars bars, DataSeries ds, int atrPeriod, double atrMult, string description)
public static ATRBandLower(Bars bars, DataSeries ds, int atrPeriod, double atrMult)

Parameter Description

bars The Bars object
ds Data series to use as the center line
atrPeriod The period to smooth Average True Range
atrMult Multiple of the average true range used to determine the modified Keltner Channel bands.

Description

This technical indicator is created by plotting two bands around a user-selected data series (usually, a short-term simple moving average), also known as the center line. The upper band is created by adding a value of the average true range (ATR) to the center line. The lower band is created by subtracting a value of the ATR from the center line. See also: ATRBandUpper.

Interpretation

This indicator is similar in calculation and interpretation to Bollinger Bands.


Calculation

Center Line = ds

Upper Band = Center Line + atrMult times ATR(atrPeriod)

Lower Band = Center Line - atrMult times ATR(atrPeriod)

Example


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

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { HideVolume(); LinearReg lr = LinearReg.Series( Close,10 ); ATRBandUpper ub = new ATRBandUpper( Bars, lr, 10, 2, "My Upper ATR Band" ); ATRBandLower lb = new ATRBandLower( Bars, lr, 10, 2, "My Lower ATR Band" ); PlotSeriesFillBand( PricePane, ub, lb, Color.Transparent, Color.FromArgb( 30, Color.Blue ), LineStyle.Solid, 1 ); for(int bar = ub.FirstValidValue; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if ( bar+1 - p.EntryBar >= 10 ) ExitAtMarket( bar+1, p, "Timed" ); } else { if( ( CumUp.Series( High,1 )[bar] >= 2 ) && ( High[bar] > ub[bar] )) ShortAtMarket( bar + 1 ); else if( ( CumDown.Series( Low,1 )[bar] >= 2 ) && ( Low[bar] < lb[bar] )) BuyAtMarket( bar + 1 );

} } } } }