fxDreema

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

    Total Orders Count both Pending order and running trades

    Questions & Answers
    6
    37
    3060
    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.
    • C
      COFX last edited by

      I want my ea to be able to count all the existing orders, both trades and pending order. Then close all trades and delete all pending orders if their total number is less than an input value

      Say for instance input value for total orders = 30, if trades is 6 and pending order is 24 nothing happens

      But if trade is 1 and pending order 19 for instance, they all close since it doesn't sum up to 30

      Please I've been trying to do this for days 🙏🙏🙏🙏😭😭😭 I need help

      l'andorrĂ  1 Reply Last reply Reply Quote 0
      • Morpheus_0
        Morpheus_0 last edited by Morpheus_0

        Frustrating isn't it...?

        Perhaps try something like this..>> https://fxdreema.com/shared/mpkxcGU0e

        Note we are using both the On Tick and On Trade tabs....*

        C 2 Replies Last reply Reply Quote 0
        • l'andorrĂ 
          l'andorrĂ  @COFX last edited by

          @COFX This is the second thread you created for the exact same question. Please don't duplicate threads.

          (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

          (CatalĂ ) MirarĂ© d’ajudar tothom en aquests fĂČrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb mĂ©s profunditat o mĂ©s de pressa, t’hi puc ajudar amb el meu curs d’introducciĂł a fxDeema en catalĂ  a https://www.theandorraninvestor.eu/ca.

          (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o mås deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

          1 Reply Last reply Reply Quote 0
          • C
            COFX @Morpheus_0 last edited by

            @Morpheus_0 very frustrating indeed. Let me take a look at what you shared. I'll reply

            1 Reply Last reply Reply Quote 0
            • C
              COFX @Morpheus_0 last edited by

              @Morpheus_0 I don't understand many things there... First the formula, then the on trade events but let me start with the formula

              How does the ea tell that the variable, Trade means total number of trades and that the variable Orders means total number of pending orders? This is where the basis of my confusion is

              Morpheus_0 1 Reply Last reply Reply Quote 0
              • L
                Lacone last edited by

                Hello.
                Here is a working and validated example EA.
                Since I don't know the condition less than 30, I simply used greater than 30 in the system.
                Please run it once in the visual strategy tester.
                There you can see that all 30 trades (pending and open) are closed.
                Greetings
                Lacone
                Test2.mq5

                C 2 Replies Last reply Reply Quote 0
                • C
                  COFX @Lacone last edited by

                  @Lacone please how can I define a variable? Like is I want to define a variable to count all running trades and another to count all running orders. And my ea is MT4

                  Morpheus_0 1 Reply Last reply Reply Quote 0
                  • Morpheus_0
                    Morpheus_0 @COFX last edited by Morpheus_0

                    @COFX said:

                    How does the ea tell that the variable, Trade means total number of trades and that the variable Orders means total number of pending orders?

                    On Trade tab>
                    Trade Created updates the number of trades variable
                    Order Created updates the number of orders variable.
                    Sum is the sum of the two.

                    The other two blocks should reset the variables to 0 when all the trades and orders are closed/deleted....*

                    1 Reply Last reply Reply Quote 0
                    • C
                      COFX @Lacone last edited by

                      @Lacone please share a project link

                      1 Reply Last reply Reply Quote 0
                      • Morpheus_0
                        Morpheus_0 @COFX last edited by

                        @COFX said:

                        please how can I define a variable?

                        Top left, click on Variables and create them there....*

                        C 1 Reply Last reply Reply Quote 0
                        • C
                          COFX @Morpheus_0 last edited by

                          @Morpheus_0 I've seen the variable but I still don't get it though.. when creating them is there a way I'll tell the ea that this variable means total open trades?

                          1 Reply Last reply Reply Quote 0
                          • L
                            Lacone last edited by

                            Hello.
                            Here is the EA for MT4.
                            There you can see that a variable has been created (under Variables) and how it is used for counting.
                            Test2.ex4
                            Test2.mq4

                            C 2 Replies Last reply Reply Quote 0
                            • Morpheus_0
                              Morpheus_0 last edited by Morpheus_0

                              In the link I posted above^^...on the On Tick tab, the Formula adds them all up and puts them into the Sum Variable.
                              The condition block then says that the Sum has to be equal to or more than 30....*

                              Actually, in the Condition block, you need to change the 'Equals or Above' to 'Equals or Below'...sry bout that...*

                              Not sure how you open more than 30 trades and orders at once though....*

                              C 1 Reply Last reply Reply Quote 0
                              • C
                                COFX @Morpheus_0 last edited by

                                @Morpheus_0 It's alright, I get the inequalities (less than or equal to). Still don't understand how you defined those variables (trades, orders) what is trades? Does the ea recognize trades to mean total open orders?

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

                                  Every time a trade is created it updates the Trades Variable....*

                                  C 1 Reply Last reply Reply Quote 0
                                  • C
                                    COFX last edited by

                                    o I'm beginning to see, but please can you say more? 🙏

                                    1 Reply Last reply Reply Quote 0
                                    • C
                                      COFX @Morpheus_0 last edited by

                                      @Morpheus_0 Thank you so much, it is becoming clearer and clearer now, however in the ontrade tab, if one trade just close, it modifies the variable to zero? should it not be only when all the trades close?

                                      Morpheus_0 1 Reply Last reply Reply Quote 0
                                      • C
                                        COFX @Lacone last edited by

                                        @Lacone Thank you, i'm taking a look at it now

                                        1 Reply Last reply Reply Quote 0
                                        • Morpheus_0
                                          Morpheus_0 @COFX last edited by Morpheus_0

                                          @COFX said in Total Orders Count both Pending order and running trades:

                                          @Morpheus_0 Thank you so much, it is becoming clearer and clearer now, however in the ontrade tab, if one trade just close, it modifies the variable to zero? should it not be only when all the trades close?

                                          Yes you are correct, but the Close Trades block should close all running trades. Is that not what you want....?

                                          1 Reply Last reply Reply Quote 0
                                          • C
                                            COFX last edited by

                                            A trade can close by stop loss (trailing stop) so only then, only when the trades are less than 30 should all trades close

                                            But the variable should only be zero when there are no existing trades.. because the ea has two strategies. If the last closed trades had no stop loss modified (close by TP), then the ea would not do anything to existing orders... But if stop loss of last closed trade was modified and trades total is less than 30, then everything but running trades and pending order gets closed... Only then should the variable reset to 0.

                                            There's a block, trades count and another pending order count, is there a way to use the results from these blocks in a formula?

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

                                            Online Users

                                            A
                                            E
                                            B
                                            M
                                            J
                                            B
                                            A
                                            E
                                            R

                                            49
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors