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 sdauteuil, 09-23-2021, 10:16 AM
|
4 responses
1,208 views
0 likes
|
Last Post Yesterday, 11:41 PM | ||
Started by agclub, 04-21-2024, 08:57 PM
|
5 responses
34 views
0 likes
|
Last Post
by agclub
Yesterday, 09:47 PM
|
||
Started by ESHunter, Yesterday, 08:06 PM
|
2 responses
18 views
0 likes
|
Last Post
by ESHunter
Yesterday, 09:27 PM
|
||
Started by ETFVoyageur, 05-07-2024, 07:05 PM
|
19 responses
150 views
0 likes
|
Last Post
by ETFVoyageur
Yesterday, 09:14 PM
|
||
Started by ETFVoyageur, 05-11-2024, 10:13 PM
|
3 responses
26 views
0 likes
|
Last Post
by ETFVoyageur
Yesterday, 09:08 PM
|
Comment