Alpha (TASCIndicators): Indicator Documentation
Syntax
public Alpha(DataSeries ds, int sdper, int lrper, string description)
public static Alpha Series(DataSeries ds, int sdper, int lrper)
public static double Value(int bar, DataSeries ds, int sdper, int lrper)
Parameter Description
ds |
Source Series |
sdper |
Number of bars used when calculating the standard deviation of the price changes
|
lrper |
Number of bars used for the prediction (linear regression) of tomorrow's price
|
Description
Based on an article by Rick Martinelli, published in June 2006-issue of
Stocks and Commodities Magazine.
The Alpha indicator is a measure of how likely tomorrow's price will be away from normal distributed prices. It is calculated as follows:
A forecast for the next day's price is made based on the last n bars based on linear prediction model (mx+b)
The price-difference between the forecasted price and the last Closing price is divided by the standard deviation of the last x bars.
The higher the alpha-value the farer away is the prediction from the expected one according to the standard deviation. The value can be used to generate buy and sell signals if the value crosses over a certain threshold. Please read the article for more details.
Example
This example uses 7 bars to calculate the stddev and 3 bars to predict tomorrow's price:
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using TASCIndicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
DataSeries alpha = Alpha.Series(Close, 7, 3);
ChartPane ap = CreatePane(40, true, true);
PlotSeries(ap, alpha, Color.DarkGreen, LineStyle.Solid, 2);
}
}
}
Alpha (Community.Indicators): Indicator Documentation
Syntax
public Alpha (Bars bars, Bars index, int period)
Parameter Description
bars | Primary Bars object |
index | The Bars object for your index symbol |
period | Lookback period |
Description
According to definition at
Investopedia, alpha is a measure of performance on a risk-adjusted basis.
Here we are using ^GSPC symbol of the S&P500 Index, suitable for Yahoo! data.
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()
{
Alpha alpha = Alpha.Series( Bars, GetExternalSymbol("^GSPC",true),200); // Yahoo symbol
Beta beta = Beta.Series( Bars, GetExternalSymbol("^GSPC",true),200); // Yahoo symbol
ChartPane betatest = CreatePane( 30, true, true );
ChartPane alphaversion = CreatePane( 30, true, true );
PlotSeries( betatest, beta, Color.DarkMagenta, LineStyle.Solid, 2 );
PlotSeries( alphaversion, alpha, Color.DarkBlue, LineStyle.Solid, 2 );
}
}
}