Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Test Formula OK but error on chart Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
stanaction
Posted : Thursday, March 2, 2006 9:03:21 AM
Registered User
Joined: 3/25/2005
Posts: 22
When I test this formula in the custom indicator settings window, it always gives a correct result.

(((v-avg(v,50))/avg(v,50)))/((c-c1)/c1)

(% Volume change vs 50-day avg volume/%price change today - I only apply it when both numerator and denominator are positive)

But plotted on chart, it always gives a FORMULA ERROR!! Divide by Zero...

Please, where is my error?
Craig_S
Posted : Thursday, March 2, 2006 9:07:52 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
It will return this when c=c1 anytime on the visible chart.

What do you want the denominator to be when C=C1?

BTW, you can simplfy AVG(V,50) by replacing it with AVGV50.

- Craig
Here to Help!
stanaction
Posted : Thursday, March 2, 2006 9:17:07 AM
Registered User
Joined: 3/25/2005
Posts: 22
First I use an easyscan with
(C - C1) > 0 AND V > AVG(V,50)

I try to use the "error" formula for sorting the results, so normally there would be no (c=c1) case
Doug_H
Posted : Thursday, March 2, 2006 9:20:29 AM


Worden Trainer

Joined: 10/1/2004
Posts: 4,308
The EasyScan finds stocks where (C-C1)>0 today (scans are based on the latest data you've downloaded). Your custom indicator does the calculation for many days in the past in order to plot the line. If any day in the past has a C=C1 situation, you'll get the divide by zero.

- Doug
Teaching Online!
stanaction
Posted : Thursday, March 2, 2006 9:26:01 AM
Registered User
Joined: 3/25/2005
Posts: 22
Thank you for this good logic!
Craig_S
Posted : Thursday, March 2, 2006 9:30:10 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
We can still plot your indicator... what value do you want plotted if C=C1? Give me that and I will create a formula you can plot.

- Craig
Here to Help!
Doug_H
Posted : Thursday, March 2, 2006 9:34:24 AM


Worden Trainer

Joined: 10/1/2004
Posts: 4,308
How about just adding .0001 to the denominator so it will always be greater than zero?

- Doug
Teaching Online!
stanaction
Posted : Thursday, March 2, 2006 9:39:50 AM
Registered User
Joined: 3/25/2005
Posts: 22
Doug, that's exactly what I just did and it works fine!
Thanks to both of you!
Craig_S
Posted : Thursday, March 2, 2006 9:46:39 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
Great!

- Craig
Here to Help!
bustermu
Posted : Thursday, March 2, 2006 1:26:24 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
QUOTE (Doug_H)
How about just adding .0001 to the denominator so it will always be greater than zero?


If the denominator you are referring to is ((c-c1)/c1), then ((c-c1)/c1+0.0001) is not necessarily positive nor nonzero.

One should not divide by near zero numbers much less ones that also oscillate across zero. The best thing that can happen is to get a divide by zero error. It warns you that you are doing something you should not be doing.

Thanks,
Jim Murphy
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.