From the description
I came up with the code below. However if I compare it with the chart you added
it is not the same ....
rgds, Ed
SetBarsRequired(10000,10000);
PPeriod = Param( "P Period", 12, 2, 100 );
LPeriod = Param( "L Period", 12, 2, 100 );
NPeriod = 1.75;
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 ] - 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);
PPeriod = Param( "P Period", 12, 2, 100 );
LPeriod = Param( "L Period", 12, 2, 100 );
NPeriod = 1.75;
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 ] - 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);
----- Original Message -----
From: "Arie Ellerbrak" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, March 04, 2006 1:21 PM
Subject: [amibroker] Help with Kirshenbaum
indicator
> Hello,
>
> Has anyone tried to code the Kirshenbaum bands? It has been asked before,
> years ago, but I haven't found any answers. I can provide the description.
> Coding it myself has led me to a cul-de-sac. Can anyone be of any help?
>
>
> Kind regards,
>
> Arie Ellerbrak
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------~-->
> Try Online Currency Trading with GFT. Free 50K Demo. Trade
> 24 Hours. Commission-Free.
> http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
> --------------------------------------------------------------------~->
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
> <*> To visit your group on the web, go to:
> http://groups.yahoo.com/group/amibroker/
>
> <*> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>
> <*> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
| Investment management software | Real estate investment software | Investment property software |
| Software support | Real estate investment analysis software | Investment software |
YAHOO! GROUPS LINKS
- Visit your group "amibroker" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
