fxDreema

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

    What block do I use to close position if indicator reverses

    Questions & Answers
    2
    4
    1220
    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.
    • D
      dbenie last edited by

      I have a logic to open position (long or short) when cci crosses 0 level. But the position does not close automatically when cci reverses and crosses the 0 level.
      What block do I use to close the open position? I used several block but without success.

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

        Close each trade (in MQL4) or Close each position (in MQL5), it's a blue block.

        1 Reply Last reply Reply Quote 0
        • D
          dbenie last edited by

          Where do I place this Close each trade (in MQL4) block? I tried several options, but doesn't work. See my ea called "simple ma cross test". Where should I place this block in this ea.

          Thanks,

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

            Place that block where it's needed!

            Normally the EA does what it does on every tick. When a tick comes - certain code is executed. In fxDreema this is when you put blocks in "on Tick". So, when a new tick comes - the blocks on the top in "on Tick" will be executed. Depending on what they do, the blocks below them will be/will not be executed. The logic flows from the top to the bottom.

            In your case, "No trade is running" is executed on every tick. When there are trades and the yellow output is active, the next blocks will be executed - in your case two "Close each losable trade". The "Condition"-s that follows does not matter in your connection. So maybe you can try to put them above the "Close..." blocks 😉

            Another block that is frequently used with "Condition" is "Once per bar"... just in case.

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

            Online Users

            E
            R
            S
            M
            N
            E
            T
            J

            14
            Online

            146.8k
            Users

            22.4k
            Topics

            122.6k
            Posts

            Powered by NodeBB Forums | Contributors