From: amibroker@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf
Of emp62
Sent: Saturday, March 04, 2006
4:23 PM
To: amibroker@yahoogroups.com
Subject: Re: [amibroker] Help with
Kirshenbaum indicator
I changed 1 line in the code. I think it is good now.
See chart below which resembles your original chart very good (settings I use
for that chart are: 5, 7, 4.5)
SetBarsRequired(10000,10000);
PPeriod = Param( "P Period", 12, 2, 100, 1 );
LPeriod = Param( "L Period", 12, 2, 100, 1 );
NPeriod = Param( "N Period", 2, 0, 10, 0.25 );
Bandwidth = 0;
EmaP = EMA(C,PPeriod);
aaa = LinRegIntercept(C,
LPeriod);
bbb = LinRegSlope(C,
LPeriod);
for (i =
LPeriod; i < BarCount; i++) {
AE = 0;
for (j = 0; j < LPeriod; j++) {
// calculate point on regression line
RegPoint = aaa[ i ] + bbb[ i ] * j;
// calculate the standard error using the distance from line
AE = AE + (C[ (i - LPeriod) + j + 1 ] - RegPoint) ^ 2;
}
// standard
error
avErr = (AE / LPeriod) ^ 0.5;
// save the
bandwidth
Bandwidth[ i ] = avErr * NPeriod;
}
SetChartOptions(0, chartShowDates);
GraphXSpace = 5;
Plot(C,"",colorWhite,64);
Plot(EmaP,"",colorWhite,1);
Plot(EmaP + Bandwidth,"",colorRed,1);
Plot(EmaP - Bandwidth,"",colorBrightGreen,1);