Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I dont have access to easylanguage, however I put your formulas into Excel. The only scenario I came up where div by zero error came up is when Close1 is zero. Perhaps try putting a check around the Open1 and Close1 to make sure they are both > than zero or absvalue(open[1] - close[1]) > 0 does not equal open[1] .
example:
if (absvalue(open[1] - close[1]) > 0 and absvalue(open[1] - close[1]) <> open[1])
Ok, I solved the issue. Hopefully this might help someone else.
Basically, I wrote the IF statements to test for zero in a different way using <> 0 instead of > 0, and also I put the test around each direction, instead of the whole thing.
Not sure why all that matters, but it worked.
if ((curDirection = -1) and ((open[1] - close[1]) <> 0)) Then
olp = ((high - close[1]) / (open[1] - close[1]));
if ((curDirection = 1) and ((close[1] - open[1]) <> 0)) Then
if (low > close[1]) Then
olp = (((low - close[1])*-1) / (close[1] - open[1])) Else
olp = (absvalue(low - close[1]) / (close[1] - open[1])) Else
olp = 0;