fxDreema

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

    No trade if there was already closed trade

    Questions & Answers
    2
    10
    334
    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.
    • G
      greg.pe last edited by

      Hello everyone.

      Stuck with my EA
      The idea is 1 trade per day.
      Prepared two blocks(area #1 and area#2) to open a trade at specific time under specified conditions.
      The idea is to open trade in second block ONLY if FIRST block didn't open any.
      First thought was the "No trade" / "if trade" didn't work, but after small investigation looks like issue is:
      second block is processed in case where trade from first block is closed before.

      The question is how to check if there was already some trades closed and to don't allow open second trade for the day.

      "no trade/if trade" check running orders, I want to check also closed ones.

      Please advice me,thanks dreema.png

      R 1 Reply Last reply Reply Quote 0
      • R
        RGoo @greg.pe last edited by

        @greg-pe
        91f160e4-5520-4ddb-b080-f7ad0233812f-image.png

        8482ebc2-304b-4f95-8fd0-d8b255de80c5-image.png

        RGoo

        1 Reply Last reply Reply Quote 0
        • G
          greg.pe last edited by

          Hmm not sure how to apply this to my block. If I copy th whole block (area#2) to "On trade" tab then it will only be processed when some trade is already placed.

          1 Reply Last reply Reply Quote 0
          • G
            greg.pe last edited by greg.pe

            so, to sum it all. Block in area#2 can be processed only if there is no any running trade by block#1 and if there is no any closed trade by block#1 for the day.

            1 Reply Last reply Reply Quote 0
            • R
              RGoo last edited by

              OK, I see, just a moment, let's see if I can solve this quickly.

              RGoo

              R 1 Reply Last reply Reply Quote 0
              • R
                RGoo @RGoo last edited by RGoo

                @RGoo

                So, according to your specifications, the first logic should already work. But I think you actually want something different. Now the bot only checks the conditions ONCE AT THE BEGINNING OF THE DAY and if they are not met, it only checks again the next day. I think you only want to make a purchase once a day if the conditions are met, that's different, see Area 4 on this.

                9d576997-434a-4c67-a939-108fe5fb417c-image.png

                474fcd11-8f97-4185-b9e9-af8287099c13-image.png

                https://fxdreema.com/shared/8BmbkJsGb

                RGoo

                1 Reply Last reply Reply Quote 0
                • G
                  greg.pe last edited by

                  Have tried like this and looks like doesn't work properly dreema3.png dreema2.png

                  1 Reply Last reply Reply Quote 0
                  • G
                    greg.pe last edited by

                    This checked as well.dreema4.png

                    1 Reply Last reply Reply Quote 0
                    • R
                      RGoo last edited by

                      OK, but have you considered that your EA only checks the condition once at the beginning of the day and then not again for the rest of the day? This is a common mistake that is often made in logic. You think that "once a day" means that the condition has to happen once during the whole day, but that's not the case. If the block is above the condition, it will only be checked once at the beginning of the day.

                      RGoo

                      1 Reply Last reply Reply Quote 0
                      • G
                        greg.pe last edited by

                        @RGoo thank You for your efford and help. I solved the problem, will explain how for future similar strugles, but firstly will reply regarding Your last comment. "If the block is above the condition, it will only be checked once at the beginning of the day." - and this is exactly what I wanted to achieve. One trade per day and if criteria in the first block are met then open a trade , if not ,then checking criteria in second block (what needs to be mentioned "once per day" are diff time). Problem was that "no trade" checking running trades only. In case where first block (once a day) open trade and SL or TP was hit before time set up in second block "once a day", then second block was processed anyway. In final calc. 2 trades were open in such case.

                        How did I solved it ?
                        EA checks equity just before trades in first block are open. Second block checks that equity and in case is same then block 2 is processed.dreema5.png

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

                        Online Users

                        H
                        M
                        M
                        H
                        A
                        T
                        N
                        C

                        18
                        Online

                        146.8k
                        Users

                        22.4k
                        Topics

                        122.6k
                        Posts

                        Powered by NodeBB Forums | Contributors