fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    EA crash zero divide by money management

    Questions & Answers
    2
    4
    1466
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      leander last edited by

      Hello, I seem to get a ea crash on zero divide. On mq4 debug it points me to this line: else if (mode=="balanceRisk") {size=((value/100)AccountBalance())/(sl((TickValue/ticksize)*point)*PipValue(symbol));}
      �
      I am using build100 of the standalone exe version.

      Thank you!

      L 1 Reply Last reply Reply Quote 0
      • L
        leander @leander last edited by

        Hmmm seems to be caused by a SL of 0, but why is it 0.

        It’s a duplicate bug of https://fxdreema.com/forum/topic/4871/zero-divide-error-and-risk-of-balance-volume-size-depending-on-stop-loss/5

        1 Reply Last reply Reply Quote 0
        • fxDreema
          fxDreema last edited by

          This MM requires SL to be different than 0, because the lot size is calculated from SL. How can I fix this problem? 🙂

          1 Reply Last reply Reply Quote 0
          • L
            leander last edited by

            Hello! Thanks for your reply. I could get rid of the problem, by switching from Price Level to Price Fraction and then adding some buffer (e.g. spread or a factor*ATR). Originally, I tried to follow a MA as base curve and then add an offset, but the problem was when the price was running away quickly from the MA, causing the SL (in price level) to be on the wrong side, creating 0, resulting in a crash. With doing price fraction and then adding it to the open-price and adding up a bunch of small factors, the whole calculation ended up being way more robust.

            The crash is actually not a too bad thing, on multiple times testing it sometimes didn’t crash and then somehow opened many tiny trades, resulting in a way too big risk.
            Also tried Miror’s fix, but this seeme to resulted in trades without a SL at all, which was way too risky.

            So all good, no real money lost.

            Fix => avoiding price-levels and using fractions or pips instead for SL/TP

            Thank you! 🙂

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post

            Online Users

            A
            F
            A
            S
            E
            A

            12
            Online

            146.9k
            Users

            22.4k
            Topics

            122.6k
            Posts

            Powered by NodeBB Forums | Contributors