Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Enhanced On Balance Volume Indicator
Collapse
X
-
Thanks a lot. I knew it was probably something small I was overlooking. I've never considered the divide by zero error, but I'll have to make sure I do from now on.Originally posted by roonius View Post
-
What are you trying to do?Originally posted by T2020 View PostThe indicator updates on bar completion . I changed one statement like this :
CalculateOnBarClose = false; : ,but there must be something else the needs to changed ,maybe this : if (CalculateOnBarClose) : ??? Nope , lost
again .
Just set calculate on bar close to false in the indicators windows if you want it to update every tick.
Comment
-
I did ,but it didn't change anything . That's why I thought maybe somethingOriginally posted by Elliott Wave View PostWhat are you trying to do?
Just set calculate on bar close to false in the indicators windows if you want it to update every tick.
needed to be changed in the code .... ?Does it update every tick for you when you set it that way ?
Comment
-
-
Thanks again roonius . I notice that there is an extreme spike in the indicatorOriginally posted by roonius View PostHere you go
right at the beginning of a new bar occasionally ,but resumes normal working
almost immediately . Just something I'm leaving feed back on .
I wish i knew how to do this . I'd be adding moving averages to it , trying
certain period summations of the same formula . I could do all that on my
previous software , unfortunately it didn't have anything remotely as good as
the Ninja chart trader ,which I've come to rely on . Oh well . Thanks again .
Comment
-
Roonius,
I clipped this code from your indicator.
if (CurrentBar == 0)
{
if((High[0]-Low[0])!=0)
{
volUp.Set(Volume[0]*((High[0]-Open[0])/(High[0]-Low[0])));
volDn.Set(Volume[0]*((Open[0]-Low[0])/(High[0]-Low[0])));
} else
{
volUp.Set(0);
volDn.Set(0);
}
} else
if((High[0]-Low[0])!=0)
{
volUp.Set(volUp[1] + Volume[0]*((High[0]-Open[0])/(High[0]-Low[0])));
volDn.Set(volDn[1] + Volume[0]*((Open[0]-Low[0]) /(High[0]-Low[0])));
}
OBVplot.Set(volUp[0] - volDn[0]);
You have this exception in there twice:
if((High[0]-Low[0])!=0)
i don't see any exceptions if ((Open[0]-Low[0])were to equal zero.
It looks like it could pop with an infinite number.
What are your thoughts,
RJayLast edited by RJay; 12-16-2008, 02:41 PM.
Comment
-
(Open[0]-Low[0]) is not a divisorOriginally posted by rt6176 View PostRoonius,
I clipped this code from your indicator.
if (CurrentBar == 0)
{
if((High[0]-Low[0])!=0)
{
volUp.Set(Volume[0]*((High[0]-Open[0])/(High[0]-Low[0])));
volDn.Set(Volume[0]*((Open[0]-Low[0])/(High[0]-Low[0])));
} else
{
volUp.Set(0);
volDn.Set(0);
}
} else
if((High[0]-Low[0])!=0)
{
volUp.Set(volUp[1] + Volume[0]*((High[0]-Open[0])/(High[0]-Low[0])));
volDn.Set(volDn[1] + Volume[0]*((Open[0]-Low[0]) /(High[0]-Low[0])));
}
OBVplot.Set(volUp[0] - volDn[0]);
You mave this in there twice:
if((High[0]-Low[0])!=0)
i don't see any exceptions if ((Open[0]-Low[0])==0)
It looks like it could pop with an infinite number.
What are your thoughts,
RJay
The only divisor we have is High[0] - Low[0]Last edited by roonius; 01-08-2009, 08:39 PM.
Comment
-
Variable * 0 / Variable.
Punch it in a calculator and see what happens.
Comment
-
You covered (High - Low) but not (Open - Low)
Comment
-
Maybe your right and I just don't get it.
variable * 0 = What?
0 / Variable = What?
I thought this would make any equation explode.

Comment
-
variable * 0 = What? --- 0Originally posted by rt6176 View PostMaybe your right and I just don't get it.
variable * 0 = What?
0 / Variable = What?
I thought this would make any equation explode.


0 / Variable = What? --- 0 as long as Variable != 0
You can do 0/Variable but can not Variable/0Last edited by roonius; 01-08-2009, 08:38 PM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
669 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
378 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
111 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
575 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
581 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment