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

[amibroker] Re: New file uploaded to amibroker



PureBytes Links

Trading Reference Links


--- In amibroker@xxxxxxxxxxxxxxx, Scott Cong <scong@xxxx> wrote:
> DIMITRIS TSOKAKIS wrote:
> 
> >Here is the 2nd, 3rd and 4th degree Q_averages.
> >The 4th degree is more complicated but gives some interesting 
> >alternatives.
> >a. The Ti4 is still smooth and much faster than the 2nd and 3rd 
> >degree lines.
> >b. The Ti4f may act as a magnifier, peaks are higher and troughs 
are 
> >lower than the actual price.
> >After this level, a significant distorsion becomes more and more 
> >apparent .
> >
> >Plot(C,Date()+", C",colorBlack,128); 
> >p=20;s=0.7;
> >e1=EMA(C,p);
> >e2=EMA(e1,p);
> >e3=EMA(e2,p);
> >e4=EMA(e3,p);
> >e5=EMA(e4,p);
> >e6=EMA(e5,p);
> >//2nd degree coefficients
> >d1=s^2;
> >d2=-2*s*(s+1);
> >d3=(1+s)^2;
> >Ti2=d1*e6+d2*e5+d3*e4;Plot(Ti2,"\nTi2",colorRed,1);
> >Ti2f=d1*e5+d2*e4+d3*e3;
> >Plot(Ti2f,"\nTi2f",colorPink,1);
> >Ti2ff=d1*e4+d2*e3+d3*e2;
> >Plot(Ti2ff,"\nTi2ff",colorOrange,1);
> >//3rd degree coefficients
> >C1=-s^3;
> >C2=3*s^2*(1+s);
> >C3=-3*s*(s+1)^2;
> >C4=(1+s)^3;
> >Ti3=c1*e6+c2*e5+c3*e4+c4*e3;
> >Plot(Ti3,"\nTi3",colorDarkGreen,8);
> >Ti3f=c1*e5+c2*e4+c3*e3+c4*e2;
> >Plot(Ti3f,"\nTi3f",colorBrightGreen,1);
> >//4th degree coefficients
> >g1=s^4;
> >g2=-4*(s+1)*s^3;
> >g3=6*(s+1)^2*s^2;
> >g4=-4*(s+1)^3*s;
> >g5=(s+1)^4;
> >Ti4=g1*e6+g2*e5+g3*e4+g4*e3+g5*e2;
> >Plot(Ti4,"\nTi4",colorDarkGrey,8);
> >Ti4f=g1*e5+g2*e4+g3*e3+g4*e2+g5*e1;
> >Plot(Ti4f,"\nTi4f",colorLightGrey,8);
> >
> >  
> >
> >
> Just a thought.
> 
> In automatic control field, one constructs PID (proportiaonal, 
integral 
> and derivative) controllers to regulate the target based on the 
> derivation between the desired output and the real output. The 
integral 
> component is responsible for the history, thus a lagging factor 
(moving 
> average is just the one), the derivative part (Rate of Change) is a 
> prediction for the future, thus a leading factor causing more 
wipsaws; 
> whileas the proportional component focuses on the current status.
> 
> Combining them together offers a compromise of responsiveness and 
> smoothness. The ideal one is to have minimum lag, minimum overshoot 
and 
> undershoot. This is just the requirement for ideal moving averages.

Scott,
This "Combining" is the magic word of course...
In daily data the shortest dt is equal to 1 bar. This limitation 
keeps the actual derivative dQ/dt far from the theoretical one.
The closest approximation is perhaps the Relative Slope
http://www.amibroker.com/library/detail.php?id=43
As for the integral, there was an interesting discussion two years 
ago, as you may see in
http://finance.groups.yahoo.com/group/amibroker/message/28159
http://finance.groups.yahoo.com/group/amibroker/message/28182
http://finance.groups.yahoo.com/group/amibroker/message/28220
http://finance.groups.yahoo.com/group/amibroker/message/28224
The 1 bar limitation will also introduce an error in integration 
procedures.
See, for example, the

x=Cum(1)-1;
y=x^2;Plot(Cum(y),"calculated Integ",1,1);
integ=x^3/3;Plot(integ,"Integ",4,1);
Plot(100*(Cum(y)-integ)/integ,"error",2,styleHistogram+styleOwnScale);

We need 150 bars for error<1% but, even after 1000 bars the error is 
still 0.15% [for the example function]
Dimitris





------------------------ 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/