Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
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?
|
|
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!
|
|
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
|
|
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!
|
|
Registered User Joined: 3/25/2005 Posts: 22
|
Thank you for this good logic!
|
|
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!
|
|
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!
|
|
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!
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
Great!
- Craig Here to Help!
|
|
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
|
|
Guest-1 |