Wealth-Lab Wiki

API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers Pending Deletion PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation


Quick Search
»
Advanced Search »


DrawLinRegChannel

RSS

Syntax


public static void DrawLinRegChannel(this WealthScript obj, int bar, DataSeries ds, int period, double width, Color color, LineStyle style, int line)
public static void DrawLinRegChannel(this WealthScript obj, int bar, DataSeries series, int period, Color color, LineStyle style, int line)
public static void DrawLinRegChannel(this WealthScript obj, int bar, DataSeries series, int period, double width, Color color, LineStyle style, int line, StdDevCalculation sdCalc)

public void DrawLinRegChannel( WealthScript obj, int bar, DataSeries ds, int period, double width, Color color, LineStyle style, int line) public void DrawLinRegChannel(int bar, DataSeries series, int period, Color color, LineStyle style, int line) public void DrawLinRegChannel(int bar, DataSeries series, int period, double width, Color color, LineStyle style, int line, StdDevCalculation sdCalc)

Parameter Description

barEnding bar
dsSource data series
periodLookback period
widthChannel line width
colorChannel line color (System.Color)
styleChannel line style (WealthLab.LineStyle)
sdCalcSelect between the standard deviation of a sample and that of an entire population

Description

Allows to code a linear regression slope channel. Credit for this method goes to Giorgio Beltrame.

Two overloads added by Robert Sucher: the first replicates the Manual Drawing tool for Regression Channel if Close is used as series, the second defines Channel width by Standard Deviations instead of Standard Error.

Look at an example below:

Example

Example using C# extension methods:


using System;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;

public class LinRegChannelsDemo: WealthScript { protected override void Execute() { Color col = new Color(); for(int bar = Bars.Count-100; bar < Bars.Count; bar++) { if( Close[bar] > Close[bar-50] ) col = Color.Green; else col = Color.Red; this.DrawLinRegChannel( bar, AveragePrice.Series(Bars), 45, 2, Color.FromArgb(30, col), LineStyle.Solid, 1 ); } } }

Legacy syntax example:


using System;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Components; // DrawLinRegChannel here

public class LinRegChannelsDemo: WealthScript { protected override void Execute() { Calculate calc = new Calculate(this); // pass WealthScript as "this" Color col = new Color(); for(int bar = Bars.Count-100; bar < Bars.Count; bar++) { if( Close[bar] > Close[bar-50] ) col = Color.Green; else col = Color.Red; calc.DrawLinRegChannel( bar, AveragePrice.Series(Bars), 45, 2, Color.FromArgb(30, col), LineStyle.Solid, 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.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki. Some of the icons created by FamFamFam.