fxDreema

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

    Close partly volume issue

    Questions & Answers
    2
    6
    1998
    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
      ezzakt last edited by

      Hi there,

      I seem to have an issue with close partly volume in a loop

      Please take a look at this screen, this is how close partly is done in this EA

      http://prntscr.com/20pdrc

      Now this seems to work in Backtest. On a Demo Account its closing wrong.
      http://prntscr.com/20pdyz

      This was 2 Lots initial size. Its closing 2x 1 Lot instead of just 1x 1 Lot (the Constant has 50 entered so it should close 50% of the volume)
      Is there anything possible why this works fine in Backtest but not on a Demo / Live Account ?

      Cheers
      Andy

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

        If you have trade with 1 lot, it should close that and reopen new one with 0.5 lot.
        On the screenshot I can see opened trades, but how are they closed... or there are trades after closing... 😕

        By the way, go to Options -> Project Blocks: Normalize IDs

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

          Thanks for the normalize IDs hint, great one ^^

          I am just testing this on Demos with a colleague. We are actually confused atm, so give me some more time to test, we are not sure whats going on so I report here later 😕

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

            In MT4 you know you can have many trades at a time, but each one of them has fixed lot size. Closing part of it's volume is done with native MQL4 function, but it happens that the trade is first closed and then a new one is created (with volume size equal to the difference). So, if you have 1 lot and you decide to close 0.3 lots, this 1 lot is closed and 0.7 lots are openend. The newly created trade has different ticket number, but the same... I think it was the open time, or open price...

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

              Ok this is really strange. I cannot find the error atm.

              But I know what is causing the error. If I do the example with with Lot Size 2 it goes wrong, closing the full 2 lots instead of 50%

              If I do the same with 1 Lot, it works perfect as we want it.

              Let me write you a pm...

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

                At least this one seems to work for me: http://fxdreema.com/shared/2FeRN6Cod

                In demo:

                2013.10.30 13:56:03	'1218115382': remainder of order #75764982 was opened : #75764983 buy 0.50 EURJPY at 135.187 sl: 134.187 tp: 136.187
                2013.10.30 13:56:03	'1218115382': order #75764982 buy 0.50 EURJPY at 135.187 sl: 134.187 tp: 136.187 closed at price 135.159
                2013.10.30 13:56:03	'1218115382': request in process
                2013.10.30 13:56:03	'1218115382': request was accepted by server
                2013.10.30 13:56:03	'1218115382': close order #75764982 buy 0.50 EURJPY at 135.187 sl: 134.187 tp: 136.187 at price 0.000
                2013.10.30 13:56:03	'1218115382': order was opened : #75764982 buy 1.00 EURJPY at 135.187 sl: 134.187 tp: 136.187
                2013.10.30 13:56:03	'1218115382': request in process
                2013.10.30 13:56:03	'1218115382': request was accepted by server
                2013.10.30 13:56:03	'1218115382': order buy market 1.00 EURJPY sl: 134.187 tp: 136.187
                2013.10.30 13:56:01	Expert MT4 EURJPY,H1: loaded successfully
                
                

                In backtest:

                2013.10.30 13:57:42	2013.09.11 00:00  MT4 EURJPY,M1: close #1 buy 0.50 EURJPY at 133.178 sl: 132.178 tp: 134.178 at price 133.158
                2013.10.30 13:57:42	2013.09.11 00:00  MT4 EURJPY,M1: open #1 buy 1.00 EURJPY at 133.178 sl: 132.178 tp: 134.178 ok
                
                

                And I always end up with 0.5 lots 🙂

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

                Online Users

                Ø­
                H
                J
                P
                B
                B
                S
                S

                11
                Online

                146.7k
                Users

                22.4k
                Topics

                122.6k
                Posts

                Powered by NodeBB Forums | Contributors