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

[EquisMetaStock Group] Re: Geometric averages and funny MSFL bug



PureBytes Links

Trading Reference Links


MG,

MS is notorius for rounding. Jose's code will show the differences.

{accumulate any x/y event differences}
Cum(x<>y)

I used Cum (x1<>x2)

Since we are looking at differences in the ten thousandths range I'm 
not sure it matters a great deal. Usually the differences on the data 
that I looked at were only off by .00001

BTW: the Jo kicked in! I'll be up all night.

Preston


--- In equismetastock@xxxxxxxxxxxxxxx, "MG Ferreira" <quant@xxxx> 
wrote:
> 
> Is it only my MS that rounds in the yellow pop-up box/tooltip
> lookalike giving indicators' values?  I also tested it and it
> calculates stuff correctly but, when you keep the mouse hovering 
over
> an indicator with more than one value, such as
> 
> 1.01;1.02;1.03;1.04;Cum(1)
> 
> then a yellow box shows these values, but often rounding them.
> 
> Regards
> MG Ferreira
> TsaTsa EOD Programmer and trading model builder
> http://www.ferra4models.com
> http://fun.ferra4models.com
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@xxxx> 
wrote:
> > 
> > Jose,
> > 
> > On
> > x1:=Exp(Sum(Log(y),n)/n);
> > x2:=Exp(Mov(Log(y),n,S));
> > The errors don't occur on every bar but and example is 14.82658 
> > versus 14.82657 . So rounded to the thousandths there ain't no 
error.
> > 
> > On
> > x:=Sum(Cum(1),10)/10;
> > y:=Mov(Cum(1),10,S);
> > There are no errors.
> > 
> > 
> > Preston 
> > 
> > 
> > --- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva" 
> > <josesilva22@xxxx> wrote:
> > > 
> > > Professor MG, my guess is that either you're using one of those 
> > funny 
> > > copies of MetaStock, or your PC is choking on all those models 
you 
> > are 
> > > running, because I just can't replicate those errors in my 
pristine 
> > > laboratory environment using the latest geometric protractor 
> > > equipment.
> > > 
> > > This MS exploration yields zero errors on 1600 stocks with avg 
10 
> > > years' data:
> > > 
> > > ---8<---------------
> > > x:=Sum(Cum(1),10)/10;
> > > y:=Mov(Cum(1),10,S);
> > > { accumulate any x/y event differences }
> > > Cum(x<>y)
> > > ---8<---------------
> > > 
> > > 
> > > jose '-)
> > > http://www.metastocktools.com
> > > 
> > > 
> > > 
> > > --- In equismetastock@xxxxxxxxxxxxxxx, "MG Ferreira" 
<quant@xxxx> 
> > > wrote:
> > > > 
> > > > Hi Preston & Jose,
> > > > 
> > > > Those two formulae for the geometric average should really 
give
> > > > exactly the same answer.  Unless you work with big numbers and
> > > > loooong averages, the rounding should not affect either 
formula
> > > > substantially.
> > > > So I did a quick test.  Here is what I entered as a test into 
MS
> > > > 
> > > > Sum(Cum(1),10)/10;Mov(Cum(1),10,S)
> > > > 
> > > > which both calculate a 10 period moving average of Cum(1) = 
1, 2, 
> > 3, 
> > > ...
> > > > 
> > > > It calculates this in two ways, one using the sum and one 
using 
> > the
> > > > Mov function.  The first value, for both, should be 5.5 
exactly,
> > > > then 6.5, then 7.5 and so on.  However, if I do this, I get 
two
> > > > lines that appear to be slightly different!  If I keep the 
pointer
> > > > on this line, to get the two values, I get something like 5.5
> > > > correctly for the first and 5.0, wrong, for the second!  
Also, the
> > > > first seems to start at 5.5 and the second, one period later, 
at
> > > > 7.0!  It yields the same
> > > > incorrect results if you swap it around, say
> > > > 
> > > > Mov(Cum(1),10,S);Sum(Cum(1),10)/10
> > > > 
> > > > From what I can gather, doing something like
> > > > 
> > > > Mov(Cum(1),10,S);Sum(Cum(1),10)/10;1
> > > > 
> > > > or funny things like
> > > > 
> > > > 1.01;Mov(Cum(1),10,S);Sum(Cum(1),10)/10;1
> > > > 
> > > > MS shows the value of the last in the yellow pop-up first, 
and it
> > > > seems to round all subsequent (previous!?) values
> > > > 
> > > > This bug could be annoying - it seems MS rounds everything 
but the
> > > > final value in such an expression containing multiple values.
> > > > 
> > > > Regards
> > > > MG Ferreira
> > > > TsaTsa EOD Programmer and trading model builder
> > > > http://www.ferra4models.com
> > > > http://fun.ferra4models.com





------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/