fxDreema

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

    Check for duplicate magic numbers

    Questions & Answers
    2
    3
    440
    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
      Breeeeen last edited by

      Hi everyone,

      Is there a simple way (including using custom code) to check if another EA with the same magic numbers are running on the MT4/MT5 client?
      I want to use my EA with multiple charts but need to keep them separate of each other, and the easiest is to just stop it running if a duplicate magic number was detected.

      Appreciate any help, thanks.

      Breeeeen

      jstap 1 Reply Last reply Reply Quote 0
      • jstap
        jstap @Breeeeen last edited by

        @breeeeen If on the same terminal then a block that checks for running trades will check for any running the same magic number, at least if you have the settings set that way.

        Learn fxDreema Without the Wait!

        My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

        The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

        Don’t miss out

        Click here➡️ https://mybook.to/fxDreema to get your copy today!

        Enjoy! 😊

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

          Hi again @jstap 🙂
          I suspect that may cause issues if there are existing trades and the EA is being re-initialized or was removed and subsequently re-added.

          After doing quite a bit of reading and thinking, I managed to implement something half-acceptable: I added a terminal variable (which changes based on group ID) and a condition to check the terminal variable.
          The condition runs first, and if there is an existing terminal variable with the same value, an alert pops up (although nothing stops the EA from continuing to run). Not the most refined but it works I guess. Main trouble I find now is that terminal variable doesn't update when I change the settings on the EA. In fact, nothing on the "On Init" tab runs after changing a parameter, which was counter to my understanding of what "on init" would represent.

          I'll leave this topic open in case someone has a more refined solution than what I have.
          Cheers.

          Breeeeen

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

          Online Users

          E
          M
          F
          E
          T
          S
          A
          M
          M
          E
          C
          M
          L
          F
          F

          29
          Online

          146.6k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors