PureBytes Links
Trading Reference Links
|
The best-fit IIR2 for H and L produce a narrow channel probably
useful for the next bar range.
//The best-fit IIR2 for the last n bars
function IIR2( input, f0, f1, f2 )
{
result[ 0 ] = input[ 0 ];result[ 1 ] = input[ 1 ];
for( i = 2; i < BarCount; i++ )
{
result[ i ] = f0 * input[ i ] + f1 * result[ i - 1 ] + f2 * result
[ i - 2 ];
}
return result;
}
Plot(C,"C",1,64);
PER=20;//the last n bars
X=Cum(1);LX=LastValue(X);
C1=L;DIF1=10000;
K0=-0.5;K00=0.5;STEP=0.01;
for(K=K0;K<K00;K=K+STEP)
{
RED=IIR2( C1, 0.3, 1.2+K, -0.5-K);
dif=LastValue(Sum(abs(RED-C1),PER));
if(DIF<DIF1)
{
K1=K;
DIF1=DIF;
}
}
BESTFIT_IIR2=IIR2(C1,0.3,1.2+K1,-0.5-K1);
Plot(IIf(X>=LX-PER,BESTFIT_IIR2,Null),"[Klow="+WriteVal(K1)
+"]",colorYellow,8);
C1=H;DIF1=10000;
for(K=K0;K<K00;K=K+STEP)
{
RED=IIR2( C1, 0.3, 1.2+K, -0.5-K);
dif=LastValue(Sum(abs(RED-C1),PER));
if(DIF<DIF1)
{
K2=K;
DIF1=DIF;
}
}
BESTFIT_IIR2=IIR2(C1,0.3,1.2+K2,-0.5-K2);
Plot(IIf(X>=LX-PER,BESTFIT_IIR2,Null),"[Khigh="+WriteVal(K2)
+"]",colorYellow,8);
Dimitris Tsokakis
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|