ADX causes 'divide by zero' error?
Forums › ProRealTime English forum › ProOrder support › ADX causes 'divide by zero' error?
- This topic has 4 replies, 3 voices, and was last updated 5 years ago by
teapot2002.
-
-
06/17/2020 at 3:18 PM #136265
My code has been repeatedly stopping with ‘divide by zero’ errors. I have been reluctant to post it and ask for help as it contains someone else’s intellectual property, but after a lot of time I think that I’ve managed to isolate the lines causing the problem. I would very much appreciate help with why these cause a problem, and how to work round it. If I comment out the following lines then the code runs:
ADXLongOK = ADX[6] > 5
ADXShortOK = ADX[1.3] > 15These variables are combined with many others into conditions for trade entries.
06/17/2020 at 3:36 PM #136268Try using an integer numeber of periods for the short ADX.
06/17/2020 at 4:38 PM #13627606/17/2020 at 7:28 PM #136299robertogozzi – that fixed it. Thank you.
06/19/2020 at 3:55 PM #136569For anyone who does what I did….I came up with these ADX values through optimisation. Although I wasn’t familiar with ADX, I now realise that these are strange values. With ADX[1.4], the code running on the 5m minute chart was stopped every 5 minutes. To correct it, I made an integer, but rounded down, so ended up with ADX[1]. This time, the code lasted longer than 5 minutes, but eventually was stopped. When I changed it to ADX[2], it ran consistently without failing.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on