fxDreema

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

    How to Fix Critical Runtime Error 503 in Ontick Function

    Questions & Answers
    5
    15
    7765
    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.
    • tcanuto
      tcanuto last edited by

      Hello fxDreema! All right? Hope so.

      I'm having this problem again:
      2017.05.18 10: 48: 30,097 MQL5 Cloud USA Genetic pass (0, 287) tested with error "Runtime Critical Error 503 in OnTick Function (Zero Division, Module Experts \ Advisors \ X Standard v8.1 P.ex5, File X Standard V8.1 P.mq5, line 14358, col 69) "at 0: 16: 00.329 (PR 139)

      I checked in other post that the problem is in the indicator. I created the ATR for the fxDreema together with you, but it's not perfect.

      See the project here: shared/8KUuCxldc

      I would like to fix it so that it can work perfectly in the tests, and if possible I need a fix to be identical to the ATR of the MT5 platform.

      1 Reply Last reply Reply Quote 0
      • M
        miro1360 last edited by

        is not that caused when ATR_Multiplo is 0? because here is zero divide
        ... when you need divide with 0 or something very close to 0, place somewhere before this divide code this:
        if(ATR_Multiplo==0) { ATR_Multiplo=0.000001; }
        and it prevent your code from null divide error and you will be able to divide with number very close to null ...

        Between trading and gambling is a very small gap, be careful.

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

          Hello Miro1360

          I do not use in the ATR_Multiple parameter 0, but optimize from 1, of type int.
           
          The problem is specifically mentioned in this line of code:

             else if (mode=="balanceRisk"){size=((value/100)*AccountBalance())/(sl*TickValue*PipValue(symbol));}
          
          
          1 Reply Last reply Reply Quote 0
          • M
            miro1360 last edited by

            you can be sure, that it is caused by divide, so do something easy to avoid it:

            your code:

            else if (mode=="balanceRisk"){size=((value/100)*AccountBalance())/(sl*TickValue*PipValue(symbol));}
            

            change to this:

            else if (mode=="balanceRisk"){
              if(sl==0){size=0;}
              else if(TickValue==0){size=0;}
              else if(PipValue(symbol)==0){size=0;}
              else {size=((value/100)*AccountBalance())/(sl*TickValue*PipValue(symbol));}
            }
            

            Between trading and gambling is a very small gap, be careful.

            E 1 Reply Last reply Reply Quote 1
            • tcanuto
              tcanuto last edited by

              Thanks for the info. I'll be trying to do that.

              So ... would not it also be interesting to have this fixed also in the mql5 codes generated by fxDreema?

              1 Reply Last reply Reply Quote 0
              • M
                miro1360 last edited by

                I am not sure if this solved your problem ... and about fix in fxdreema, maybe it can help in some situations where TickValue or PipValue() returns 0 ...

                Between trading and gambling is a very small gap, be careful.

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

                  Well, it's strange if PipValue() returns 0. What symbol are you using now, tcanuto? 🙂

                  tcanuto 1 Reply Last reply Reply Quote 0
                  • M
                    miro1360 last edited by

                    I had situation when USDCHF returned me 0 in that case 😞 so only solution was hardly code data, not from symbolinfo ...

                    Between trading and gambling is a very small gap, be careful.

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

                      @fxDreema Hello!

                      I'm having this problem with the 'WDO @ N' symbol (which is the Dollar / Real), but I've had this same problem with other symbols.

                      1 Reply Last reply Reply Quote 0
                      • tcanuto
                        tcanuto @miro1360 last edited by

                        @miro1360 It worked! Thanks for the info.

                        Maybe you could help me in this post: https://fxdreema.com/forum/topic/3036/How-to-use-2-volume-modes/3?page=1#none

                        1 Reply Last reply Reply Quote 0
                        • E
                          eduardo55 @miro1360 last edited by

                          @miro1360 I'm having a similar problem: My "zero divide" error appears because the MarketInfo (symbol, MODE_POINT) is returning 0. Here's the piece of code that is presenting error:

                          double PipValue(string symbol="")
                          {
                          if (symbol=="") {symbol=GetSymbol();}
                          return(CustomPoint(symbol)/MarketInfo(symbol,MODE_POINT)); <---- This is the division where the error occurs.
                          /*
                          if (symbol=="") {symbol=GetSymbol();}
                          int digits=MarketInfo(symbol,MODE_DIGITS);
                          if ((digits==2 || digits==4)) {return(POINT_FORMAT/0.0001);}
                          if ((digits==3 || digits==5)) {return(POINT_FORMAT/0.00001);}
                          if ((digits==6)) {return(POINT_FORMAT/0.000001);}
                          return(1);
                          */
                          }

                          I'm using it for trade the DAX index. Any tip about how to make the EA work with DAX and another CFD's?

                          M 1 Reply Last reply Reply Quote 0
                          • M
                            MetaTrader @eduardo55 last edited by

                            @eduardo55

                            I have same issue in double PipValue function when I use the block
                            No pending order exists

                            1 Reply Last reply Reply Quote 0
                            • M
                              MetaTrader last edited by

                              I found the bug for me:

                              I was looping through the allowed Symbols in my EA and when i have a non existing Symbol I get this strange error at a place where I wouldn't expect it.

                              Some Alerts in the MT4 source Code are always helpful for debugging. 😉

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

                                This function PipValue() is so old and I'm so afraid to change anything in it, so that some old commented text can be seen in it 🙂

                                But the function itself works and this "zero divide" thing is correct. I mean, it is a fatal error, but this error basically says that there is some problem with the symbol that should be somehow fixed. Why do you use non existing symbol?

                                M 1 Reply Last reply Reply Quote 0
                                • M
                                  MetaTrader @fxDreema last edited by MetaTrader

                                  But the function itself works and this "zero divide" thing is correct. I mean, it is a fatal error, but this error basically says that there is some problem with the symbol that s

                                  I had an understanding problem in custom blocks.
                                  Setting variables in the Variables List on white button (on Block entry) and then using this variable as input tricked me, because the input is taken before the variable is set by white button. Hopefully this is understandable. Now I set CurrentSymbol in the pass block and it works

                                  0_1512685687345_bcc77850-c861-4621-bbb2-b49b67954632-grafik.png

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

                                  Online Users

                                  M
                                  S
                                  T
                                  O
                                  G
                                  B
                                  A
                                  P
                                  I
                                  M
                                  M
                                  J
                                  T
                                  S
                                  T
                                  M

                                  33
                                  Online

                                  146.7k
                                  Users

                                  22.4k
                                  Topics

                                  122.6k
                                  Posts

                                  Powered by NodeBB Forums | Contributors