ADX causes 'divide by zero' error?

Forums ProRealTime English forum ProOrder support ADX causes 'divide by zero' error?

Viewing 5 posts - 1 through 5 (of 5 total)
  • #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] > 15

    These variables are combined with many others into conditions for trade entries.

    #136268

    Try using an integer numeber of periods for the short ADX.

    #136276

    Check all divisions in your code, are they made with a variable not initialized (with no value)?

    #136299

    robertogozzi – that fixed it. Thank you.

    #136569

    For 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.
Viewing 5 posts - 1 through 5 (of 5 total)
Similar topics:

Create your free account now and post your request to benefit from the help of the community
Register or Login