Log in to see Cloud of Tags

Wealth-Lab Wiki

Syntax

public ATRP(WealthLab.Bars bars, int period, string description)
public static ATRP Series(WealthLab.Bars bars, int period)

Parameter Description

bars The Bars object
period Indicator calculation period

Description

ATRP expresses the Average True Range, or ATR, as a percentage of the closing price of the specified Bar. ATRP provides a good picture of current volatility.

Calculation

ATRP( bar, period ) = 100 * ATR( bar period ) / PriceClose( bar )

where,
ATR = Average True Range (see indicator)

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 { /* Short when price hits the High of the previous bar * (1 + ATRP/100 ) Cover on trailing stop of the same series */ protected override void Execute() { // Convert to fractional percentage, e.g., 3.5% -> 0.035 DataSeries hATRP = ATRP.Series( Bars, 5 ) / 100 + 1; DataSeries hATRP_H = Bars.High * hATRP;

// Delay indicator plot by 1 bar to observe crossovers PlotSeries( PricePane, hATRP_H>>1, Color.Blue, LineStyle.Dotted, 2 ); DrawLabel( PricePane, "ATRP_H + 2%" ); PlotStops(); for(int bar = 15; bar < Bars.Count; bar++) { if (IsLastPositionActive) CoverAtTrailingStop( bar+1, LastPosition, hATRP_H[bar] ); else ShortAtLimit( bar+1, hATRP_H[bar] ); } } } }

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.