Division by zero error

Forums ProRealTime English forum ProOrder support Division by zero error

Viewing 3 posts - 1 through 3 (of 3 total)
  • #140810

    hello!

    i have found a condition i want to use in a strategy on the 1 min TF that is causing the error “division by zero”

    and here it is

    anyone know a way how to solve this?

    #140811

    “range” is equal to zero because a candle is missing. You could probably get rid of this error by using this sort of code:

     

    1 user thanked author for this post.
    #140921

    I had a similar problem where I was trying to calculate a dynamic position size and was getting a divide by zero error when the current price was equal to a variable I called “Entry”.

    I fixed it like this:

    It’s not pretty but it works.

    By always adding that tiny .00001 to the current close it ensures the two things are never equal and therefore no chance of division by 0.

    Hope that helps.

    3 users thanked author for this post.
Viewing 3 posts - 1 through 3 (of 3 total)

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