In the help for linregintercept is this code for plotting the line x = Cum(1); lastx = LastValue( x ); Daysback = 10; aa = LastValue( LinRegIntercept( Close, Daysback) ); bb = LastValue( LinRegSlope( Close, Daysback ) );
y = Aa + bb * ( x - (Lastx - DaysBack) ); Plot( Close, "Close", colorBlack, styleCandle ); Plot( IIf( x >= (lastx - Daysback), y, -1e10 ), "LinReg", colorRed ); If you just want the linear reg values plotted, like a moving average just use Plot( LinearReg( close, 10 ), "LinReg", colorRed ); -- Cheers Graham AB-Write >< Professional AFL Writing Service Yes, I write AFL code to your requirements http://www.aflwriting.com On 18/11/06, Charles J. Dudek <[EMAIL PROTECTED]> wrote:
OK, so how do I fix it? Do I have to write some code that will calculate a least squares regression from scratch? I think that will be really hairy to try to figure out. Are there any examples of formulas written to do the same thing or something similar? None of the linearreg formulas on the AB website helped. --- In [email protected], "Fred" <[EMAIL PROTECTED]> wrote: > > From the doc ... > > SYNTAX LinRegIntercept( ARRAY, periods ) > > RETURNS ARRAY > > --- In [email protected], "Charles J. Dudek" <trader@> > wrote: > > > > And how do I fix it. I'm getting a type mismatch error, but I > can't > > see where I'm trying to put an entire array into one cell. > > > > aL[i] = LinRegIntercept( C [i] , Longcount[i] ); > > > > Does LinRegIntercept create an array? If so, how do I get around > > that? I'm trying to create trendlines at various points throughout > > the history that start and end based on other calculations. This > is > > driving me CRAZY!!! > > > > Are there any examples of this kind of thing I could refer to? I > know > > I could use LineArray, but I also need to calculate standard > > deviations based on the same periods, so I don't think that will > help > > me, will it? > > > > Chuck > > > 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
