JohnZ - This may be more than you want to
know about Linear Regression
but here's another very straight forward
routine, from the forum, author unknown.
Note that it will draw the line where you place
your cursor...with the use of SelectedValue.
If you use the line regression tool on the right
tool bar you can overlay this
plotline as best I tell by eye.
Hope this helps
JOE
_SECTION_BEGIN ("LinRegLine");
per = Param("LinearRegression Period", 8,2,260,1);
mm= (H + L) / 2;
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));
show = x > selv - per AND x <= selv;
xx = IIf(show, x -
(selv - per),Null);
yy = IIf( show, daa +
dbb * xx, Null );
Plot (yy, "LinReg", colorBlue );
Plot (mm,"Price",colorBlack,styleCandle);
_SECTION_END ();
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
YAHOO! GROUPS LINKS
|