fxDreema

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

    Close newest and oldest trade

    Questions & Answers
    3
    23
    6684
    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.
    • J
      Jimmy Chee last edited by

      Need same help. Suppose I had 10 opening position. I want to close the newest and the oldest position (no.1 and no.10) if profit of these two trades combine is achieved $ profit.

      This Is what I created https://fxdreema.com/shared/wHKGD3xlc. Anyone advice, please!

      A 1 Reply Last reply Reply Quote 0
      • A
        ambrogio @Jimmy Chee last edited by

        @jimmy-chee said in Close newest and oldest trade:

        Need same help. Suppose I had 10 opening position. I want to close the newest and the oldest position (no.1 and no.10) if profit of these two trades combine is achieved $ profit.

        This Is what I created https://fxdreema.com/shared/wHKGD3xlc. Anyone advice, please!

        can someone do something?

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

          It's a bit odd to pick oldest and newest, but this should do:
          https://fxdreema.com/shared/QRnvqa97

          Need small help? Tag me in your post
          Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

          A J 2 Replies Last reply Reply Quote 0
          • A
            ambrogio @roar last edited by

            @roar thank you, but it closes them all, instead it should check the first trade (the one farthest then the less profitable) and as soon as there is one or more positive trades it must close only these positives and the first negative having a small profit

            https://fxdreema.com/shared/Xdp5Mk73e

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

              https://fxdreema.com/shared/fceTizc8
              This one first calculates the amount of profitable trades. Then it checks the most losing trade against that profit sum, and if profit sum is bigger, close them all. Small losing trades will stay open.

              Need small help? Tag me in your post
              Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

              J A 2 Replies Last reply Reply Quote 0
              • J
                Jimmy Chee @roar last edited by

                @roar Thank you.

                1 Reply Last reply Reply Quote 0
                • J
                  Jimmy Chee @roar last edited by

                  @roar Instead of condition block, I replace by Formula Block. Thank a lot.

                  1 Reply Last reply Reply Quote 0
                  • A
                    ambrogio @roar last edited by

                    @roar please, where am I doing wrong?

                    https://fxdreema.com/shared/xp0yEeiJc

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

                      0_1531739563431_220104d2-5ce7-4b7d-b1e1-25365d4aafac-image.png
                      The variables need to be reset at some point, otherwise the sum just piles up. Shared link somehow dropped that. I did that on the first loop block.
                      Tbh, I didn't actually do any test run with this ea, could still be faulty πŸ˜„

                      Need small help? Tag me in your post
                      Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        ambrogio @roar last edited by

                        @roar please, excuse my ignorance, your example closes an order after the other, I can not handle it

                        0_1531745799121_Cattura.JPG
                        0_1531745807549_2.JPG

                        https://fxdreema.com/shared/mEI4sNFxe

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

                          Mine works differently.
                          0_1531746592329_70c4c77b-6b92-4250-be98-5fbd0efc6576-image.png
                          Here, take this .mq4 and import it to fxdreema so you get the exact same project. I also added a trade count condition for comfort.
                          0_1531746692796_hedge.mq4

                          Need small help? Tag me in your post
                          Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                          A 2 Replies Last reply Reply Quote 1
                          • A
                            ambrogio @roar last edited by

                            @roar now it's running, strange is the same, thanks a lot!!

                            1 Reply Last reply Reply Quote 1
                            • A
                              ambrogio @roar last edited by

                              @roar what does this mean?
                              0_1531752504702_Cattura.JPG

                              roar 1 Reply Last reply Reply Quote 0
                              • roar
                                roar @ambrogio last edited by roar

                                @ambrogio For changing a minus sign to a plus sign.
                                Lets assume the "profitSum", thats the sum of the positive profit trades, example $12
                                Then the profit of the losing trade can be -$57. Positive is always bigger than negative, so we have to -1 * -57 to make it +57 so we can better compare

                                Need small help? Tag me in your post
                                Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                                A 1 Reply Last reply Reply Quote 0
                                • A
                                  ambrogio @roar last edited by

                                  @roar oh clear thank you πŸ™‚

                                  1 Reply Last reply Reply Quote 0
                                  • J
                                    Jimmy Chee last edited by

                                    Hi Roar and Ambrogio,

                                    Attach the sample to close oldest and newest trade when reach certain profit shared/Gk6TueTcd. I use check profit (unrealized) or condition block to check profit from basket trade (all open position trade).
                                    It is any way to check only the oldest and newest trade profit?

                                    The thing that already try been try as below:
                                    a) Grouping – I only used one condition to entry the first trade and one condition to open additional trade. I think grouping is not the solution.
                                    b) Variable and Formula – I can’t fine any block to read the profit from individual trade.
                                    Any suggestion.

                                    1 Reply Last reply Reply Quote 0
                                    • J
                                      Jimmy Chee last edited by

                                      @jimmy-chee said in Close newest and oldest trade:

                                      Gk6TueTcd

                                      Sorry, this is the attachment.

                                      1 Reply Last reply Reply Quote 0
                                      • J
                                        Jimmy Chee last edited by

                                        https://fxdreema.com/shared/Gk6TueTcd

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

                                          0_1532215732223_fcf4fd21-79f0-408b-a8a4-69198d6bc816-image.png

                                          If you set n=1, you can pick individual trades

                                          Need small help? Tag me in your post
                                          Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                                          1 Reply Last reply Reply Quote 0
                                          • J
                                            Jimmy Chee last edited by

                                            This is what I created https://fxdreema.com/shared/Gk6TueTcd .
                                            Trade close random.

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

                                            Online Users

                                            X
                                            J
                                            A
                                            N
                                            S
                                            E

                                            19
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors