[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Metastockusers] Programming Help



PureBytes Links

Trading Reference Links

Hello All --
 
I would like to have a Metastock Indicator called Kirshenbaum Bands, which are similar to Bollingert Bands. However, I can't program them. but have the algorithm.
Perhaps someone, in the group can do this and contribute the effort.
 
The algorithm is:
Kirshenbaum Bands are constructed as follows:
Calculate a P-Period Exponential Moving Average of the data based on the close.
Then, for each bar, calculate the L-Period linear regression line, using
today’s close as the endpoint of the line.
(Note: The term "linear regression" is the same as a "least squares" or
"best fit" line in some textbooks.)
Calculate d1, d2, d3, .. dL as the distance from the line to the close on
each bar which was used to derive the line.
That is, di = Distance from Regression Line to each bar’s close.
Calculate the average of the squared errors:
 AE = (d12 + d22 + d32 + .. + dN2) / L
Standard Error (Se) is the square root of this value:
 Se = square root of AE
Then, if N = Number of Standard Errors, band width is:
 BW = N * SE
Add and subtract the band width from the Exponential Moving Average to arrive
at today’s value for the upper and lower bands.
Parameters:
Periods (P):
 The period used in the Exponential Moving Average calculation.
Linear Regression Periods (L):
 The period used in constructing the lines for Linear Regression.
Deviations (N):
 Number of deviations used. That is, the Standard Error value can be
 multiplied by a factor to expand the bands.
 
Thanks in advance,
Brett
 


Do you Yahoo!?
Check out the new Yahoo! Front Page. www.yahoo.com
Yahoo! Groups Sponsor

Get unlimited calls to

U.S./Canada



Yahoo! Groups Links