PureBytes Links
Trading Reference Links
|
You can play with the code below, but please verify its accuracy.
herman
function DrawLinRegLine( LastPoint, LookBack, Array, Extend )
{
BI = BarIndex();
LastPoint = Max(1,Max(LastPoint,LookBack));
LastPoint = Min(BarCount-1,LastPoint);
FirstPoint = Max(0,LastPoint - LookBack);
LRI = LinRegIntercept( Array, LookBack);
LRS = LinRegSlope( Array, LookBack);
LRLine = LRI[LastPoint] + LRS[LastPoint] * ( BI - LastPoint + LookBack);
RLLine = LineArray( FirstPoint, LRLine[FirstPoint], LastPoint,
LRLine[LastPoint], 1, 0 );
RLLine = IIf( BI >= FirstPoint AND BI <= LastPoint + Extend, RLLine,
Null);
return RLLine;
}
SetBarsRequired(sbrAll,sbrAll);
LBI = LastValue(BarIndex());
Lastpoint = LBI - Param("End: Bars before last",0,0,1000,1);
Length = Param("Length: Bars before End",100,0,5000,1);
Extend = Param("Right Extension (bars)",0,0,100,1);
Array = C;
LRL = DrawLinRegLine( LastPoint, Length, Array, Extend );
Plot(LRL,"",4,1);
Plot(C,"",1,1);
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On
Behalf Of gyowell2000
Sent: July 25, 2008 9:08 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] AFL for Linear Regression Study
Hello,
Is the AFL code for the Linear Regession Study available? I would
like to be able to place the study on a chart starting and ending on
selscted dates under program control rather than doing it manually.
I have checked the Amibroker user's guide, the AFL library and Googled
but have found nothing useful.
Grover
------------------------------------
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
------------------------------------
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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/
<*> 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:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto: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/
|