[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] How to access AFL functions without array filling



PureBytes Links

Trading Reference Links

Are you trying to plot a regression line over the last say 25 bars (daysback)? 

What I use is the slope and the intercept of the regression line, as follows and the clip of code is attributed to Dimitris Tsokakis from many moons ago.  A similar use is also given as an example in the statistical function section of the Amibroker user's guide.

Hope this helps

Joe

 

Plot(C,"Cloae",colorBlack,8);

GraphXSpace=2;

x = Cum(1);

lastx = LastValue( x );

Daysback = 25; //LastValue(Cum(IsTrue(C1)));

aa = LastValue( LinRegIntercept( C, Daysback) );

bb = LastValue( LinRegSlope( C, Daysback ) );

yy = Aa + bb * ( x - (Lastx - DaysBack) );

yy=IIf( x >= (lastx - Daysback), yy, -1e10 );

Plot( yy, "yy", colorRed );

----- Original Message -----
Sent: Sunday, January 06, 2008 10:56 PM
Subject: [amibroker] How to access AFL functions without array filling

Hi guys,

How can I access the unerlying function(s) that produces array data?

For example:

X = LinearReg(Close, 30);

X is a continously calculated array. BUT I want the *straight line*
that LinearReg produces for each set of 30 data points.

Something like this (pseudo-code):

// this fetches a straight line from LinearReg
// using the final 30 Close prices
// nb, the straight line in Y is only 30 bars long
Y = Segment(LinearReg(Close, 30), 30, BarCount-1);

Is it possible to access the underlying LinearReg() function (and
others) from AFL without the continous array filling stuff?

Purpose - from AFL I want to plot one short, straight line through a
small set of price points, using linear regression.

How do I do this?

thanks a lot!

Andy
(fog)

__._,_.___

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___