PureBytes Links
Trading Reference Links
|
Dear Hal,
Thank you very much for your kind words.
The main purpose is to have some unbiased criteria to select a
moving average.
I think that the "step function" (from 10 to 20 in one day), the linear
function and the sinusoidal one are three examples that help us
understand the response of a moving average. As Dr Juric writes,in
http://www.jurikres.com/faq/faq_ama.htm
the perfect noise reduction filter for financial data has the following requirements:
1. Minimum lag between signal and price, otherwise trade triggers come late.
2. Minimum overshoot, otherwise signal produces false price levels.
3. Minimum undershoot, otherwise time is lost waiting for convergence afterprice gaps.
4. Maximum smoothness, except at the moment when price gaps to a new level.
And, let us make here something clear. A sophisticated formula or procedureis not
neccessarily a reliable formula.
The three models are in AFL
/*MODEL CURVES*/
maxgraph=8;
cc1=iif(cum(1)<lastvalue(cum(1))-49,10,20);
cc10=ma(cc1,10);
d10=ref(-cc10+30,-10);
C1=iif(cum(1)<lastvalue(cum(1))-39,cc10,d10);/*LINEAR MODEL*/
C2=iif(cum(1)>lastvalue(cum(1)-50) and cum(1)<lastvalue(cum(1)-30),20,10);/*STEP MODEL*/
PI=4*ATAN(1);
s=15+5*sin( 2*PI*0.05*(CUM(1)-74));
C3=iif(cum(1)>lastvalue(cum(1))-50 AND cum(1)<lastvalue(cum(1)-30),s,10);/*SINUSOIDAL MODEL*/
graph0=c1;GRAPH0BARCOLOR=1;
graph1=c2;graph1barcolor=4;
graph2=c3;GRAPH2BARCOLOR=2;graph2style=1;
The red curve is the step function. The stock moved from 10 to 20 in one day, remained there and
the last trial day gapped down to 10 again.
The black curve is linear from 10 to 20 and linear from 20 to 10.
The white curve is sinusoidal and consequently smoother and closer to reality.
How will you make your first tests?
Suppose you want to see the response in ma and ema for the linear model C1.
Separate the other graphs with /* and */ to avoid confusion and take the ma(C1,10) and ema(C1,10).
Your formula will be then like that:
/*MODEL CURVES*/
maxgraph=8;
cc1=iif(cum(1)<lastvalue(cum(1))-49,10,20);
cc10=ma(cc1,10);
d10=ref(-cc10+30,-10);
C1=iif(cum(1)<lastvalue(cum(1))-39,cc10,d10);/*LINEAR MODEL*/
C2=iif(cum(1)>lastvalue(cum(1)-50) and cum(1)<lastvalue(cum(1)-30),20,10);/*STEP MODEL*/
PI=4*ATAN(1);
s=15+5*sin( 2*PI*0.05*(CUM(1)-74));
C3=iif(cum(1)>lastvalue(cum(1))-50 AND cum(1)<lastvalue(cum(1)-30),s,10);/*SINUSOIDAL MODEL*/
graph0=c1;GRAPH0BARCOLOR=1;
/*graph1=c2;graph1barcolor=4;*/
/*graph2=c3;GRAPH2BARCOLOR=2;graph2style=1;*/
/*APPLICATION*/
graph3=ma(c1,10);
graph4=ema(c1,10);
graph3style=graph4style=1;
graph3barcolor=7;/*YELLOW FOR ma*/
graph4barcolor=8;/*GREEN FOR ema*/
In APPLICATION area, play a little with days, ie place 5 or 20 instead of 10 in ma(c,10) and ema(c,10)
and see the difference in response and which average is better.
You may do the same with C2 or C3 and various days combinations.
In att. gif you see the response of ma and ema in linear curve.
I notice that
a) Noone reached 20
b) ema is faster but delays the last days
c) ema highest has a 3 days delay, ma highest has 5
etc etc
I hope this may help to understand better the investigation of moving averages.
Dimitris Tsokakis
------=_NextPart_001_0010_01C1332A.140B1C40
Content-Type: text/html;
charset="iso-8859-7"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-7" http-equiv=Content-Type>
<META content="MSHTML 5.00.3013.2600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>--- In <A
href="mailto:amibroker@xxxx">amibroker@xxxx</A>, Hal Brehe <<A
href="mailto:infoads@xxxx">infoads@xxxx</A>> wrote:<BR>> Dear
Dimitris,<BR>> <BR>> I want to thank your for your efforts in
demonstrating a means of improving </FONT></DIV>
<DIV><FONT face=Arial size=2>indicator response through the reduction of
lag time. <BR></DIV></FONT>
<DIV><FONT face=Arial size=2>Dear Hal,<BR>Thank you very much for your kind
words.<BR>The main purpose is to have some unbiased criteria to select a
<BR>moving average.<BR>I think that the "step function" (from 10 to 20 in one
day), the linear<BR>function and the sinusoidal one are three examples thathelp
us <BR>understand the response of a moving average. As Dr Juric writes,in<BR><A
href="http://www.jurikres.com/faq/faq_ama.htm">http://www.jurikres.com/faq/faq_ama.htm</A><BR>the
perfect noise reduction filter for financial data has the following
requirements:<BR>1. Minimum lag between signal and price, otherwise trade
triggers come late. <BR>2. Minimum overshoot, otherwise signal produces false
price levels. <BR>3. Minimum undershoot, otherwise time is lost waiting for
convergence after price gaps. <BR>4. Maximum smoothness, except at the moment
when price gaps to a new level. <BR>And, let us make here something clear. A
sophisticated formula or procedure is not <BR>neccessarily a reliable formula.
<BR></DIV></FONT>
<DIV><FONT face=Arial size=2>The three models are in AFL<BR>/*MODEL
CURVES*/<BR>maxgraph=8;<BR>cc1=iif(cum(1)<lastvalue(cum(1))-49,10,20);<BR>cc10=ma(cc1,10);<BR>d10=ref(-cc10+30,-10);<BR>C1=iif(cum(1)<lastvalue(cum(1))-39,cc10,d10);/*LINEAR
MODEL*/<BR>C2=iif(cum(1)>lastvalue(cum(1)-50) and
cum(1)<lastvalue(cum(1)-30),20,10);/*STEP
MODEL*/<BR>PI=4*ATAN(1);<BR>s=15+5*sin(
2*PI*0.05*(CUM(1)-74));<BR>C3=iif(cum(1)>lastvalue(cum(1))-50 AND
cum(1)<lastvalue(cum(1)-30),s,10);/*SINUSOIDAL
MODEL*/<BR>graph0=c1;GRAPH0BARCOLOR=1;<BR>graph1=c2;graph1barcolor=4;<BR>graph2=c3;GRAPH2BARCOLOR=2;graph2style=1;
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>The red curve is the step function. The stock moved
from 10 to 20 in one day, remained there and<BR>the last trial day gapped down
to 10 again.<BR>The black curve is linear from 10 to 20 and linear from 20 to
10.<BR>The white curve is sinusoidal and consequently smoother and closer to
reality.<BR>How will you make your first tests?<BR>Suppose you want to see the
response in ma and ema for the linear model C1.<BR>Separate the other graphs
with /* and */ to avoid confusion and take the ma(C1,10) and ema(C1,10).<BR>Your
formula will be then like that:<BR>/*MODEL
CURVES*/<BR>maxgraph=8;<BR>cc1=iif(cum(1)<lastvalue(cum(1))-49,10,20);<BR>cc10=ma(cc1,10);<BR>d10=ref(-cc10+30,-10);<BR>C1=iif(cum(1)<lastvalue(cum(1))-39,cc10,d10);/*LINEAR
MODEL*/<BR>C2=iif(cum(1)>lastvalue(cum(1)-50) and
cum(1)<lastvalue(cum(1)-30),20,10);/*STEP
MODEL*/<BR>PI=4*ATAN(1);<BR>s=15+5*sin(
2*PI*0.05*(CUM(1)-74));<BR>C3=iif(cum(1)>lastvalue(cum(1))-50 AND
cum(1)<lastvalue(cum(1)-30),s,10);/*SINUSOIDAL
MODEL*/<BR>graph0=c1;GRAPH0BARCOLOR=1;<BR>/*graph1=c2;graph1barcolor=4;*/<BR>/*graph2=c3;GRAPH2BARCOLOR=2;graph2style=1;*/<BR>/*APPLICATION*/<BR>graph3=ma(c1,10);<BR>graph4=ema(c1,10);<BR>graph3style=graph4style=1;<BR>graph3barcolor=7;/*YELLOW
FOR ma*/<BR>graph4barcolor=8;/*GREEN FOR ema*/ </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>In APPLICATION area, play a little with days, ie
place 5 or 20 instead of 10 in ma(c,10) and ema(c,10)<BR>and see the difference
in response and which average is better.<BR>You may do the same with C2 or C3
and various days combinations.<BR>In att. gif you see the response of ma and ema
in linear curve.<BR>I notice that<BR>a) Noone reached 20<BR>b) ema is faster but
delays the last days<BR>c) ema highest has a 3 days delay, ma highest has
5<BR>etc etc<BR>I hope this may help to understand better the investigationof
moving averages.<BR>Dimitris Tsokakis</FONT></DIV></BODY></HTML>
------=_NextPart_001_0010_01C1332A.140B1C40--
Attachment:
gif00155.gif
Attachment:
Description: "Description: GIF image"
|