PureBytes Links
Trading Reference Links
|
Try this:
/*The code Herman posted few days back, see subject: "AFL for Linear Regression Study" does that, see parameter
window "Extend". I also wrote some code few years back (see below). "Future" points are displayed using styleDots,*/
per = 20;
fut = 5;
//mm = (H + L + C) / 3;
mm = C;
x = Cum(1);
lastx = LastValue(x);
selv = SelectedValue(x);
aaa = LinRegIntercept(mm, per);
bbb = LinRegSlope(mm, per);
daa = SelectedValue(ValueWhen(x, aaa, 1));
dbb = SelectedValue(ValueWhen(x, bbb, 1));
xx = IIf(x > selv - per AND x <= selv, x - (selv - per),Null);
yy = daa + dbb * xx;
fxx = IIf(x > selv AND x <= selv + fut, x - (selv - per),Null);
fyy = daa + dbb * fxx;
wd = SelectedValue(StDev(mm,per));
SetChartOptions(0, chartShowDates);
Plot(yy, "LinReg", colorBlue, 1);
Plot(yy + wd, "Upper Boundary", colorRed, 1);
Plot(yy - wd, "Lower Boundary", colorBrightGreen, 1);
// plot into future
Plot(fyy, "LinReg", colorBlue ,styleDots | styleNoLine);
Plot(fyy + wd, "Upper Boundary", colorRed ,styleDots | styleNoLine);
Plot(fyy - wd, "Lower Boundary", colorBrightGreen ,styleDots | styleNoLine);
Plot(C,"",colorBlack,64);
Dick H
--- In amibroker@xxxxxxxxxxxxxxx, "austin.lawrence24" <austin.lawrence24@xxx> wrote:
>
> Would anyone know the formula used to calculate the LinearReg function as used in AmiBroker.
>
> Thanks to anyone who can help.
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
amibroker-digest@xxxxxxxxxxxxxxx
amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|