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

RE: [amibroker] Plot Regression Line



PureBytes Links

Trading Reference Links

// Copied from the list sometime ago...I think Ed wrote the code

per = Param("LinearRegression Period", 8,2,50,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));

xx = IIf(x > selv - per AND x <= selv, x - (selv - per),Null);

yy = daa + dbb * xx;

Plot(yy, "LinReg", colorBlue );

Plot(C,"",colorWhite,64);

-----Original Message-----
From: Robert Lu [mailto:boblu007@xxxxxxxxxxxxxx]
Sent: Wednesday, January 26, 2005 12:13 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Plot Regression Line

Hi,
 
Can anyone help me code the program that plots the past 15-day regression line on the chart?  Also, I tried to let the regression line ends with the cursor line.  For example, if I place the line on Dec 6, 2004,  it can show up the 15-day regression line ends on that day.  (Please see the chart below.)
 
 
Thank you for the help in advance.
 
Best regards,
Robert


Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html




Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html




Yahoo! Groups Links