Hi all,
I want to plot standar error channel using AFL. After googling, I found this:
http://www.mail-archive.com/[email protected]/msg29588.html
The problem is there is no "width" parameter in that AFL as we can see in Study
Drawing Tool.
Any idea how to implement "width"?
Here is my AFL based on msg29588 discussion:
TimeFrameSet( inDaily );
SetBarsRequired(100000,0);
periode = Param("Periode",30,30,50000,1);
bar = BarIndex();
islastbar = bar == BarCount - 1;
isfirstbar = bar == BarCount - periode;
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;
TimeFrameRestore();
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 );
--
Regards,
ChuanKabeh