fxDreema

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

    EA creating two trades instead of one

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

      Hello,

      I have a strange bug in my EA that is somehow creating two positions despite having flags and checks in place so that only one trade should happen.

      My EA checks for certain conditions and flags in order to enter a trade. If all conditions are met, it places a trade, resets the flags and moves on. For some reason, it is now creating two positions when the order is sent and I have no idea why. At the top of my logic, I check for position count, it needs to be less than 1 for this group (yes, double checked all the groups are correct) and if there are no positions it goes down and if all logic is passed, it opens a trade (single buy/sell now) and then resets the flags. No idea why, but this is somehow opening 2 trades.

      This EA has previously been working and this is suddenly happening... Any chance there has been some alterations to the back end code?

      The condition before the two sells is for testing, it's a boolean check to see if I want to use lots or % for the trade. There is NO way that is being executed at the same time.

      efab1c48-096c-41bd-bd60-0b7025dfa11d-image.png
      5e82dd7c-3484-49a0-86a7-48a2e7b9316b-image.png

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

        I ended up finding the issue - something I've never seen before. I have 4 once per bar blocks that execute and they were out of order and this is somehow causing my trades 'once per bar' to execute twice? I re-ordered them and this solved the issue. Still a VERY strange issue considering I disable the flags after a trade is place, at the top of my 'once per bar' I have a number of positions check to make sure it's less than 1, and 'on trade' I disable the flags also.
        image.png

        Sorry - thought I fixed the issue with the above renumbering, but it was actually this block... I didn't realize it goes down the logic path two times in this scenario.

        e88787be-cb46-4030-bb66-0667b9e5aeac-image.png I turned off the 2nd condition and I no longer get double trades. Dummy.

        1 Reply Last reply Reply Quote 1
        • l'andorrà
          l'andorrà last edited by

          The most important is you noticing. Congrats!

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

          Online Users

          F
          M
          J
          J
          M
          P
          E

          18
          Online

          147.0k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors