Divide by Zero issues
Forums › ProRealTime English forum › ProOrder support › Divide by Zero issues
- This topic has 6 replies, 3 voices, and was last updated 5 years ago by
Monobrow.
-
-
12/14/2020 at 10:50 AM #153652
Hi
My system is stopping every Sunday night at 2305 without fail. It works the rest of the week. The reason if gives me is more or less a divide by zero error. I believe the reason is because there is not sufficent data (previous bars) in order for me to make the required calculation.
The code I am using is along the lines of
Gap = Close-CustomClose[1]
IF <indicator> and GAP <= 21 THEN
Etc etc
I believe at certain times Gap is not able to return a value so the system fails. Is there a way to code around this? something along the lines of:
If Gap = Null/Error then do nothing Else carry on etc?
Hope this makes sense as I kind of new to ccoding.
thanks!
12/14/2020 at 11:09 AM #15365712/14/2020 at 11:11 AM #153658You can try this to make sure it’s never 0:
1Gap = Close-CustomClose[1]) + 0.000001this small amount shouldn’t affect your performance (but you can increase or decrease it).
You can also write it as:
1234Gap = Close-CustomClose[1]IF Gap = 0 THENGap = 0.000001ENDIF1 user thanked author for this post.
12/14/2020 at 11:13 AM #15365912/14/2020 at 11:19 AM #15366312/14/2020 at 11:21 AM #153664now I see it!).
Must have been that monobrow obstructing your vision! 🙂 (sorry couldn’t resist! 🙂 )
1 user thanked author for this post.
12/14/2020 at 12:58 PM #153677now I see it!).
Must have been that monobrow obstructing your vision! 🙂 (sorry couldn’t resist! 🙂 )
Haha, I guess i deserved that! 😬
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on