Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Enhanced On Balance Volume Indicator
Collapse
X
-
Originally posted by roonius View Postvariable * 0 = What? --- 0
0 / Variable = What? --- 0 as long as Variable != 0
You can do 0/Variable but can not Variable/0
Your Right, I apologise. Don't ever get old.
I should have checked before saying anything.
I guess I'm the "zero".
RJayLast edited by RJay; 12-16-2008, 03:55 PM.
Comment
-
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]);
Is the "if((High[0]-Low[0])!=0)" suppose to take
care of any divide by zero problems ? Maybe it's not doing what it's suppose to . What
if You just went
((High[0]-Open[0])/(High[0]-Low[0] +.00001)));
??
Comment
-
Guys you may be running into double.Epsilon issues. Please review this article: http://www.ninjatrader-support2.com/...ead.php?t=3929
To check for zero do this:
Code:if (High[0] - Low[0] < double.Epsilon) // It is zero;
Josh P.NinjaTrader Customer Service
Comment
-
Originally posted by T2020 View PostThanks again roonius . I notice that there is an extreme spike in the indicator
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 .Attached FilesLast edited by roonius; 01-08-2009, 08:38 PM.
Comment
-
Following up
This hasn't seemed to cure the problem here . I did notice the spike is less
extreme on a 30 second chart as opposed to a 1 minute chart . Changing
the 1 min to 60 second actually reduced the severity of the spike . I wonder
if it has something to do with me being on a wireless ISP . Not quite the quality of a land line . Packets get dropped . Using TT not Zen fire ??? It works well enough for me to stick with it . I do think it's better than the regular OBV .
Comment
-
Originally posted by NinjaTrader_Josh View PostGuys you may be running into double.Epsilon issues. Please review this article: http://www.ninjatrader-support2.com/...ead.php?t=3929
To check for zero do this:
Code:if (High[0] - Low[0] < double.Epsilon) // It is zero;
of it . Makes the indicator flat line .
Comment
-
Originally posted by NinjaTrader_Josh View PostThe code snippet I provided is just for your comparisons. When subtracting doubles, a value greater than epsilon would mean it is not zero. Do a <= check for an equality check of 0.
if((High[0]-Low[0])!=0)
{
volUp.Set(volUp[1] + Volume[0]*((High[0]-Open[0])/(High[0]-Low[0]+.00001)));
volDn.Set(volDn[1] + Volume[0]*((Open[0]-Low[0])/(High[0]-Low[0]+.00001)));
}
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ETFVoyageur, 04-30-2024, 02:04 PM
|
10 responses
74 views
0 likes
|
Last Post
by ETFVoyageur
Today, 11:20 AM
|
||
Started by Drone360x, Today, 10:27 AM
|
1 response
7 views
0 likes
|
Last Post Today, 11:08 AM | ||
Started by Salahinho99, Yesterday, 04:13 AM
|
2 responses
24 views
0 likes
|
Last Post
by Salahinho99
Today, 11:07 AM
|
||
Started by truepenny, Today, 03:45 AM
|
4 responses
21 views
0 likes
|
Last Post
by truepenny
Today, 10:42 AM
|
||
Started by nightstalker, 05-04-2024, 02:05 PM
|
4 responses
45 views
1 like
|
Last Post Today, 10:33 AM |
Comment