PureBytes Links
Trading Reference Links
|
Hello, I've seen this nice piece of code that plots linear regression
code and was wondering if anyone could help me with a hint on how to
plot the channel two days ago and extend it into today. I've already
fried my brain, can't get it... thanks in advance.
SetBarsRequired(100000,0);
bar = BarIndex();
islastbar = bar == BarCount -10;
isfirstbar = bar == BarCount - 100;
firstbar = LastValue( ValueWhen( isfirstbar, bar ) );
lastbar = LastValue( ValueWhen( islastbar, bar ) );
al = LastValue( ValueWhen( islastbar, LinRegSlope( C, Lastbar -
firstbar + 1 ) ) );
bl = LastValue( ValueWhen( islastbar, LinRegIntercept( C, Lastbar -
firstbar + 1 ) ) );
Lr = al * ( BarIndex() - firstbar ) + bl;
Lr = IIf( bar = firstbar AND bar <= lastbar , Lr, Null );
se = StdErr(C,Lastbar - firstbar);
se = LastValue( ValueWhen( islastbar, StdErr( C, Lastbar - firstbar +
1 ) ) );
upper = Lr + se;
Lower = Lr - se;
Plot(Lr, "lr", colorYellow, styleThick );
Plot(upper, "upper", colorGreen, styleThick );
Plot(Lower, "lower", colorRed, styleThick );
SetBarFillColor( IIf( C O, colorBrightGreen, colorRed ) );
Plot(C, "C", colorWhite, styleCandle );
Title = "bar= " + bar + " firstbar= " + firstbar + " lastbar= " +
lastbar+ " se= "+ se;
------------------------------------
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/
|