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: [email protected] [mailto:[EMAIL PROTECTED]
Behalf Of gyowell2000
Sent: July 25, 2008 9:08 PM
To: [email protected]
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




Reply via email to