fxDreema

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

    Close trade only if condition is recurring

    Questions & Answers
    3
    4
    453
    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.
    • Z
      zaccroft last edited by

      Hey Guys,

      Looking for some guidance. I am trying to figure out the best way to build a condition, that will close a previous trade and open a new one, only if the conditions recurring are not the same ones that originally occurred.

      Thanks

      S 1 Reply Last reply Reply Quote 0
      • S
        seb 0 @zaccroft last edited by

        @zaccroft
        Hey you could add a variable, which increases by 1 every time one of both conditions occurs, and when the value of one is above the one that made you take the last trade, close positions, SELL now.

        1 Reply Last reply Reply Quote 0
        • Z
          zaccroft last edited by

          Hey thanks for the response @seb-0

          The problem is that if I set it, to check the condition say once a tick (or even once an hour), it will see the old condition and it will proceed to close the open position to re-open a new one, leaving it in an infinite loop of closing/re-opening since condition 1 = condition 1.

          I want it to have the ability to ignore the first position, unless a new instance of that conditions occurs.

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

            @zaccroft does the block "no trade" solve your problem?
            Or if its a above/below condition, switch to "cross above" / "cross below"

            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

            S
            F
            C
            A
            E

            10
            Online

            146.7k
            Users

            22.4k
            Topics

            122.6k
            Posts

            Powered by NodeBB Forums | Contributors