PureBytes Links
Trading Reference Links
|
should attenuate as the trend goes on.
In some [interesting] cases the f plot is not the expected quasi-
exponential, when the trend becomes stronger.
See the f graph as a daily function, plotted over the main chart with
//The parabolic coefficient Fvar as a daily function
//by D. Tsokakis, Sept2004
Plot(C,"C",1,64);
perc=3;//sensitivity calibration
x=BarIndex();xx=LastValue(x);
t1=LastValue(ValueWhen(PeakBars(H,perc)==0,x));
H1=LastValue(ValueWhen(PeakBars(H,perc)==0,H));
t11=LastValue(ValueWhen(TroughBars(L,perc)==0,x));
H11=LastValue(ValueWhen(TroughBars(L,perc)==0,L));
g=t1>t11;
shape=IIf(g,shapeDownArrow*(x==t1),shapeUpArrow*(x==t11));
Color=IIf(g,colorRed,colorBrightGreen);
PlotShapes(shape,color);
//THE LAST BEST-FIT PARABOLIC
t=IIf(g,x-t1,x-t11);tmax=IIf(g,xx-t1,xx-t11);
diff1=100000;
Lma=LastValue(MA(C,50));
f1=0;f2=IIf(Lma<100,1,0)+3*int(log10(Lma));
fa=0;fb=0;fc=0;step=f2/10;Fvar=0;
for(k=0;k<tmax-3;k++)
{
for(f=f1;f<f2;f=f+step)
{
parabolic=IIf(g,H1-f*t^2,H11+f*t^2);
S1=LastValue(Ref(Sum(abs(parabolic-H),xx-t1-k),-k));
S11=LastValue(Ref(Sum(abs(parabolic-L),xx-t11-k),-k));
diff=IIf(g,S1,S11);
if(diff<diff1)
{
diff1=diff;fa=f;
}
}
diff1=100000;
for(f=Max(fa-step,0);f<fa+step;f=f+0.1*step)
{
parabolic=IIf(g,H1-f*t^2,H11+f*t^2);
S1=LastValue(Ref(Sum(abs(parabolic-H),xx-t1-k),-k));
S11=LastValue(Ref(Sum(abs(parabolic-L),xx-t11-k),-k));
diff=IIf(g,S1,S11);
if(diff<diff1)
{
diff1=diff;fb=f;
}
}
diff1=100000;
for(f=Max(fb-0.1*step,0);f<fb+0.1*step;f=f+0.001*step)
{
parabolic=IIf(g,H1-f*t^2,H11+f*t^2);
S1=LastValue(Ref(Sum(abs(parabolic-H),xx-t1-k),-k));
S11=LastValue(Ref(Sum(abs(parabolic-L),xx-t11-k),-k));
diff=IIf(g,S1,S11);
if(diff<diff1)
{
diff1=diff;fc=f;
}
}
Fvar[xx-k]=fc;diff1=100000;
}
Plot(Fvar,"Fvar",colorYellow,styleLeftAxisScale);
Plot(Highest
(Fvar),"Fvarmax",colorYellow,styleLeftAxisScale+styleDashed);
Lf=LastValue(Fvar);
p=IIf(g,H1-Lf*t^2,H11+Lf*t^2);
s=Status("barvisible");st=Cum(s);
sh=HHV(H,st);
sl=LLV(L,st);
Plot(IIf(x>=Max(t1,t11) AND p>sl AND p<sh,p,-1e10),"",color,1);
Title=Name()+", Fvar="+WriteVal(Fvar,1.4);
GraphXSpace=3;
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/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/
|