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

Re: Calculation error in MS - correction



PureBytes Links

Trading Reference Links

Orea,

Sorry, a 9 was missing in my previous post... The text would be instead
: 

I tried it in MS 7.2 EOD and I get the same results.

So like you, for ...
perc:= ( C - Ref(C, -1) ) * 100 / Ref(C, -1);
If(perc > -2, 1,
If(perc < -2, -1, 0))

.... I have 1 for result.

If I change your second formula for :
perc:= ( C - Ref(C, -1) ) * 100 / Ref(C, -1);
If(perc > -1.99999, 1,
  If(perc < -2, -1, 0))
... I now get the hoped answer : 0. If I add one more 9 :
If(perc > -1.999999, 1,
  If(perc < -2, -1, 0))
....the result is 1 again.

A rounding error on the sixth digit is the problem, but strangely, not
on your first indicator.

Pierre Tremblay


SR a écrit :

> Hello dear friends
>
> Today I noticed the following very strange error, while back-testing with
> Metastock 6.52 for windows:
>
> Previous bar's close = 1.5
> This bar's close = 1.47
>
> All the calculations made (manually  or electronically ) will agree that the
> percentage of this  change is  -2
> I made an indicator for calculating the change in MS itself, which also
> agrees with this percentage:
>
>  ( C - Ref(C, -1) ) * 100 / Ref(C, -1)
>
> The above returns -2  allright.
>
> So far so good.
> But the strange thing is, that when I tried to verify this percentage with
> binary or ternary indicators, they did NOT recognize the change -2% as true!
> In fact, they consider the result as >2% !
> Here is a ternary indicator that I used for verification :
>
> perc:= ( C - Ref(C, -1) ) * 100 / Ref(C, -1);
> If(perc > -2, 1,
> If(perc < -2, -1, 0))
>
> The result returned in the above case was NOT zero (0) as it should be, but
> one (1) which means that the change is represented by a number larger
> than -2
>
> Has anybody else experienced such a thing? Do I have a virus in my computer?
> A math terrorist maybe? Has my MS crashed quietly?
> Can someone repeat the above experiment and tell me the results please?
>
> Thanks
> Orea