fxDreema

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

    Set slippage as a double rather than an int

    Questions & Answers
    2
    6
    2176
    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.
    • E
      enochj last edited by

      Is this possible without doing it manually?

      It isn't that hard to replace, but well, it could be better to have it done automatically.

      Or perhaps, MT4 can't read it as a double variable?

      Thx.

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

        What means to do it manually?

        It's double now 🙂

        1 Reply Last reply Reply Quote 0
        • E
          enochj last edited by

          Thanks mate! Excellent.

          By manually, I meant to do it by myself into the MetaEditor. 🙂

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

            Maybe you are talking about Input (extern) parameters. It is possible to define a list with what I call Constants. Open "Options->Set Constants" to see what's in there.

            Unfortunately, I can't set Slippage or other currency pair dependent parameter as a global parameter, because any block can be used for any pair.

            1 Reply Last reply Reply Quote 0
            • E
              enochj last edited by

              Apparently, there's something wrong with slippage control. I'm using an EA on a Pepperstone account which is a slippage maniac broker, and dispite of having set a max tolerated slippage at 0.7 (I've tried with higher values as well), orders are validated even with a slippage of 4 pips.

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

                In .mq4 code, there is a function named BuyNow (or SellNow for sells):
                http://fxdreema.com/documentation/colle ... ql4/buynow
                http://fxdreema.com/documentation/colle ... l4/sellnow
                Somewhere at the middle of the code there is a "OrderSend" MQL4 function.

                if (IsBrokerECN()!=false || ticket==-1)  {
                      ticket=OrderSend(symbol,OP_SELL,lots,bid,slippage, 0, 0,comment,magic,0,arrowcolor);
                

                see where "slippage" parameter is? Between "bid" and "0". This is int parameter, following this:

                int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE) 
                

                They say that this parameter is in point format, for example 3 (when broker is 0.0001 type). I presume that it is internally converted into 0.0003 when 3 is used.

                I have to be honest, I never take care of slippage and I don't know for sure how it should be used. And I think my broker is not a slippage maniac. So you can play in MetaEditor by replacing "slippage" with values in different format to see what works. And if you find the correct format and it is not as in their example (see "3" between "Ask" and "Ask-25"):

                ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);
                

                please, tell me 🙂

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

                Online Users

                S
                O
                S
                A
                N
                J
                S
                K
                A

                20
                Online

                146.7k
                Users

                22.4k
                Topics

                122.6k
                Posts

                Powered by NodeBB Forums | Contributors