Re: XARD - Simple Trend Following Trading System

11271
traderokey wrote: Sun Sep 11, 2022 3:57 am Hi XARD,

I've been using XU v6 version because most of the later versions give me a "Zero divide" error. Could you please help look at the code? I understand that only a few people are getting this error but it will be nice if you can add a zero divide constraint to the codes. It seems "XU v39-XARD UNIVERSE" and perhaps the Clock might be the culprits. I recall Mladen suggesting the code snippet below as a possible fix;

"Mladen Rakic 2009.09.18 17:09 #7
...
Zero divide error is exclusively a coding error. Metatrader does not provide a trap (or rather, that message is the trap, and since by definition divide by zero yields to undefined, they chose the terminate the code execution in such cases) for such errors, so if not dealt with within the code it will happen, sooner or later

Find in the code every occurrence of division and add before every division a zero condition checking
Something like this :"

Code: Select all

 if (divisor!=0)

result = dividend/divisor;

else result = 0; // or whatever result you prefer here since the result

// of division by 0 by definition is undefined

XARD: Thanks I will give it a try when I am sober
I got also the same error. Until now its worked well but once its not drawing the candles in realtime, I need to change timeframe back and forth to see the candle move. This came today, with 2 different brokers.

XARD: I know exactly what the error problem is. It's my shit coding.
At the weekend if I am sober I will take a look at XU v6 and update it to my current setup (without the OpenPipS section and post it for ALL.
These users thanked the author normannasty for the post (total 3):
Jedidiah, Mickey Abi, traderokey






Who is online

Users browsing this forum: areteus1, Lenovo, Liltune95, Samoth, ssscary and 74 guests