fxDreema

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

    Close all trades not working

    Questions & Answers
    4
    21
    2987
    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.
    • B
      Boferer last edited by Boferer

      Hello!

      I am trying to close all the trades when they are in total profit of 2 (e.g when your unrealized profit on the account is 2 so for example, the balance is 200 and the equity is 202, then all the trades including the losing ones should get closed)

      I tried this out, but for some reason it does not work. Any help? Its in the "on tick" tab as well. I tried putting it into on trade as well, but nothing happened.

      I have already browsed the forum and found similar issues, but when I implemented those solutions, they didnt work either.

      https://imgur.com/a/oh30NKI

      B 1 Reply Last reply Reply Quote 0
      • B
        Boferer @Boferer last edited by

        @boferer Any help would be heavily appreciated! ๐Ÿ™‚ It seems like my ea cannot execute the check profit unrealized for some reason. Any idea why that is?

        1 Reply Last reply Reply Quote 0
        • B
          Boferer last edited by

          Im thinking the EA doesnt know whats profit because it works on all occasions besides the one with profit

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

            ... hard to say what is wrong ... this is working:
            https://fxdreema.com/shared/gSHV0yq5d

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

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

              @miro1360 Doesnt work ๐Ÿ˜ž I dont seem to know why...maybe its because of MT4? I dont understand.

              This is what the whole ea looks like https://imgur.com/a/zwxAzlV
              Cant wrap my head around whats wrong

              H 1 Reply Last reply Reply Quote 0
              • H
                Hadees @Boferer last edited by

                @boferer do you need a condition like once per bar or seconds as the first block for it to run ?

                B 1 Reply Last reply Reply Quote 0
                • B
                  Boferer @Hadees last edited by

                  @hadees No, the ea is supposed to run every tick so I am not sure if I need it there or if its okay to leave it out.

                  H 1 Reply Last reply Reply Quote 0
                  • H
                    Hadees @Boferer last edited by

                    @boferer i check profit and close trades like this 0_1558445364394_f8be40be-0aea-42fb-b674-4a6fb8f63d23-image.png

                    B 1 Reply Last reply Reply Quote 0
                    • B
                      Boferer @Hadees last edited by Boferer

                      @hadees Nope. Doesnt work unfortunately. We need to somehow define the profit. I think the EA does not know what the profit truly means.

                      H 1 Reply Last reply Reply Quote 0
                      • H
                        Hadees @Boferer last edited by Hadees

                        @boferer within the block you will need to make sure it is for buys and sells and then pick money as type of in profit. http://icecream.me/e1ba9a0b666f6ecefc8f2b3af714f484

                        B 1 Reply Last reply Reply Quote 0
                        • B
                          Boferer @Hadees last edited by Boferer

                          @hadees I did, didnt work ๐Ÿ˜ž

                          https://imgur.com/a/YdcbBGy

                          Another thing I noticed is that when I approach the problem from a different angle and do condition balance is bigger than equity, then it triggers the close trades block, but when its reversed (e.g. equity is bigger than balance, then close) it wouldnt work.

                          However, it should be noted that your approached DID in fact trigger the blocks, but the desired function is still not there. The trades somehow close randomly (e.g. when the equity is even +7-14 the trades do not close sometimes)

                          https://imgur.com/a/V2Hg6XW

                          Here you can see the visual and the equity line. The trades do not close when the equity is +2 above the balance, but rather close randomly it seems.

                          Would having in there something like this help? https://imgur.com/a/vBhaHGc

                          B 1 Reply Last reply Reply Quote 0
                          • B
                            Boferer @Boferer last edited by

                            @boferer Still didnt manage to find the mistake..

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

                              I think, you have no idea what are you doing. Your looking on the equity line vs balance line is not right. The X axis are trades one after another and not the time (for MT4). If you trigger the closing event, the portfolio of opened trades starts to close and the equity vs. balance starts to draw - each closed trade will be a new addition to the balance line. If a lossable trade was closed, the balance line goes down, or up if a profitable was closed. If you want more details in the X axis (the time), use MT5 for testing. Notice, that there will be the same movement with the balance line when a lossable or profitable trade is closed.
                              https://fxdreema.com/shared/2TVhajb9
                              0_1558539322744_9a9a77ec-166c-4c62-812f-dbb1b35824fa-image.png

                              The Check profit block for both (MT4 and MT5) is working right.

                              Note that the trades opened manually have the magic number 0 (set your in the EA settings the Magic to 0). Or alternatively set the right Group mode in all the blocks.

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

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

                                @miro1360 Thank you for your reply Miro!

                                So what is it you are suggesting I should do to resolve the issue? Sorry if I misunderstood it, but its a lot to take in.

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

                                  run this in the MT5 tester and check how is it working (equity, balance, etc.)
                                  https://fxdreema.com/shared/HBENFiAT

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

                                  B 2 Replies Last reply Reply Quote 0
                                  • B
                                    Boferer @miro1360 last edited by

                                    @miro1360 Will do!

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

                                      @miro1360 Tried it and it didnt work.. ๐Ÿ˜ž Isnt there a way how to do this which is.....more simple?

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

                                        how are your trades opened? (by another EA? inside the same EA? manually?)

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

                                        A B 2 Replies Last reply Reply Quote 0
                                        • A
                                          ambrogio @miro1360 last edited by

                                          @miro1360 Hi miro, I see that @Boferer opens a buy order and a sell order, it is logical to think that the profit is never reached, or am I wrong?

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

                                            @miro1360 As Iยดve sent in the screenshot above, they are all opened in the same EA. The same thing happened in MT5, trades are opened and then they do not get closed until the backtest is over. Also, there were more long trades open than short ones and the trend was bullish so it had to be in profit at some point. @ambrogio there are no buy/sell orders, only market orders which go through immediately. I have stopped the EA randomly during the tests to see if the thesis that they are not in a profit holds and the EA stopped in profit a couple of times when I stopped it so the argument that the trades are simply not in profit does not hold true in this case.

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

                                            Online Users

                                            V

                                            13
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors