Division by zero error

Forums ProRealTime English forum ProOrder support Division by zero error

Viewing 4 posts - 16 through 19 (of 19 total)
  • #74947

    I will check out your code later today when I continue to program.

    To answer your first question why I multiplied by ten it was because of Nicolas answer earlier in this thread, I dont know if he’s wrong, here’s his answer:

    “Only do division if the divisor variable is superior to 0, it usually avoid this kind of error”.

    So he’s not talking about the result, but the divisor.

    And about my last piece of code I described why I did it. Just to prove that the divisions works fine even if the results are zero something if you use them the next candle instead of the current one, so the problem is that PRT doesn’t do anything until the very end of each candle. Is there a way to contact the developers directly regarding this?

    #74949

    Only do division if the divisor variable is superior to 0, it usually avoid this kind of error

    I believe that what Nicolas means by this is check the values first.

    Your last bit of code changed nothing – it just looked at a different candle so the values were different so the results were different. There will still have been the possibility of division by zero.

    1 user thanked author for this post.
    #74950

    so the problem is that PRT doesn’t do anything until the very end of each candle. Is there a way to contact the developers directly regarding this?

    This is not the problem and anyway MTF will be introduced to PRT later this year meaning that you will be able to make decisions mid candle based on different time frames – so asking PRT to change this and make everyone’s already coded strategies obsolete is likely to be a wasted effort. If you do still want to ask them then I would suggest posting something in the Support forum that is monitored by PRT.

    https://www.prorealcode.com/forum/prorealtime-english-forum/prorealtime-support/

    1 user thanked author for this post.
    #74962

    Hi again Vonasi.

    Thanks for the solution

    it seems to work (I don’t lose trades anymore), now I have to figure out/understand what the calculations are doing because I don’t only want solutions, I want to understand what’s happening too. But I figure it out, just don’t have time right now.

    About Nicolas I guess I understood it wrong then, because in division you have: dividend/divisor = result, so when he wrote divisor I thought the problem lied in that part of the division only, thanks for the check of that part. Even though that wouldn’t work with all trades that would include zero values, but your solution using the max-function above solves it in my code.

    Ok good about the multitimeframe part, I guess it might be best to wait for it first and check the difference then.

    /Daniel

Viewing 4 posts - 16 through 19 (of 19 total)

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