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 burtoninlondon, Today, 12:38 AM
|
0 responses
10 views
0 likes
|
Last Post Today, 12:38 AM | ||
Started by AaronKoRn, Yesterday, 09:49 PM
|
0 responses
14 views
0 likes
|
Last Post
by AaronKoRn
Yesterday, 09:49 PM
|
||
Started by carnitron, Yesterday, 08:42 PM
|
0 responses
11 views
0 likes
|
Last Post
by carnitron
Yesterday, 08:42 PM
|
||
Started by strategist007, Yesterday, 07:51 PM
|
0 responses
14 views
0 likes
|
Last Post Yesterday, 07:51 PM | ||
Started by StockTrader88, 03-06-2021, 08:58 AM
|
44 responses
3,983 views
3 likes
|
Last Post
by jhudas88
Yesterday, 06:59 PM
|
Comment