fxDreema

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

    Do not open a new trade if one is already running with the same currency

    Questions & Answers
    2
    13
    1616
    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.
    • M
      mariofxn last edited by

      I'm trying to get my EA to not open any new trade if there is already one trade open, unless this trade is already set to BreakEven or trails its stop in profit.

      Example: EA opens trades in EURUSD - trade is not yet BE (or trails in profit) -> do not open any new trade with EUR as main currency or counter currency (same for USD).
      If current trade is already BE (or trails in profit) a new trade with both, EUR and USD as main or counter currency, can be opened.

      Is there a way to handle this?
      Greetings, M

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

        This might work, can't test right now... At the moment it only tests the currency, breakeven condition can be added later
        https://fxdreema.com/shared/Q63lqaJ2b

        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
        • M
          mariofxn last edited by

          Thanks @roar

          Will test it out tomorrow once the market is open 🙂

          Just to be sure: i've added currentsym (string) and open_new (bool) - at least i got it to compile

          1 Reply Last reply Reply Quote 1
          • M
            mariofxn last edited by

            Just tried it and got a stack overflow exc, any idea?

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

              @mariofxn Hmm, maybe the loop goes mad if there are no trades... Lets put a "no trade" block at the very top, and skip the whole checking process if there are no running 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

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

                @roar tried with no trade/order at the very top, still the same

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

                  @mariofxn When I put just that project to backtest, no errors.. Hope I'll remember to test this tomorrow, live market is just much easier

                  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

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

                    @roar i've tried to put the block elsewhere but it doesnt help.
                    Would be awesome if you could let me know what you get tomorrow in the live environment.

                    Thanks

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

                      @mariofxn
                      https://fxdreema.com/shared/Fo6LLNiCc
                      I changed the loop filters, seems working now - if GBPUSD trade is open, the bot will not open new EURUSD trades.

                      The breakeven is still not implemented. I can't help with that right now, having a really busy week...

                      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

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

                        @roar awesome, many thanks for the help. Will give it a try soonest

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

                          @roar works great, thanks a lot.

                          Maybe you find the time to also check the case where BE is hit, allowing the same symbol to be traded again.

                          Thanks much in advance
                          M

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

                            @roar i'm still testing the current one; however i experience a lot of open trades on the same pair (as main- and counter currency)
                            F.e.: my EA opens a trade in GBPCAD with 1 sec between trades (i'm opening 3 trades at the same time right now)
                            1 sec later another GBPJPY opens (3x), followed by 3 more EURGBP trades 2 seconds after.

                            I have 0 idea what i can do or where i shall place the loop so that this doesnt happen again, do you have any idea?

                            Right now, i have the loop at the very top on the onTick page, after that i check all my conditions based on the rules and start buying/selling whichever is applicable.

                            Any response is highly appreciated and needed.
                            Regards,
                            M

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

                              @mariofxn Interesting.. So does the EA open too many trades on the same pair or the different pair? Do you intend to open multiple trades?

                              Could you share a version of your project so I can troubleshoot? You get the shared link form upper left corner

                              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
                              • 1 / 1
                              • First post
                                Last post

                              Online Users

                              W
                              O
                              D

                              11
                              Online

                              146.9k
                              Users

                              22.4k
                              Topics

                              122.6k
                              Posts

                              Powered by NodeBB Forums | Contributors