fxDreema

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

    Closing all trades in one pair when target is met (equality?) when trading with multiple pairs

    Questions & Answers
    4
    9
    3639
    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.
    • R
      RN81 last edited by

      Hello,

      I'm new to the whole trading business but have spent a lot of time the last couple of months getting to know the system and this program. I like working on a EA and learnt a lot from reading the forum an the tutorials.

      The problem i'm having at the moment is that I want to close all trades in one pair when it hits a certain target. Lets say €50,-.
      This is counted from the no trade point. so trades that have already closet count towards this target.

      Because I want to work with multiple pairs at once, the equality doesn't work for this as a condition. Somewhere on the forum I learnt that I can use the modify variables block to close all trades of all pairs when a certain profit is made. I'm using that as well.

      Basically this is what i'm looking for:

      Take profit : 50 pips per trade (know that one)
      Close all trades of one pair: when target is met, say +500 pips in total per pair (don't know that one)
      Close all trades of all pairs: when target is met, say +5000 pips in total over all trades, Equality. (I know how to do that one to)

      Thanks for reading and hope someone can help me with this.

      1 Reply Last reply Reply Quote 0
      • H
        Hadees last edited by Hadees

        Maybe this will help you - This checks for profit in money http://icecream.me/3c0204d7e5c57b6619d3346cb502e463
        (Assign groups and symbol if you want it to become more refined.)

        1 Reply Last reply Reply Quote 0
        • R
          RN81 last edited by

          Thank you.

          I'm using profit in money in my ea at the moment. Thought it was easier to explain this way.
          Now I know what I did wrong with the bucked trades.

          I was using the if trade block as a start. I assume this is not a block that cycles until there are no trades running, but only cycles once if there opens a trade?
          Why are u using the per second block? Is this a better choice then the per tick block? Or is it just your preference?

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

            I use per second because i want it to check for profit every second until it reaches my desired TP. Ticks are unreliable in my opinion so i like this better... not sure if it is the right way but it works for me đŸ™‚

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

              @rnonnekes81 You tried some of those "Check profit..." blocks? Also those bucket blocks can be used, but you can easily use them in a wrong way. Can you make some simple EA that shows what is going on? I don't really understand that "no trade point" thing.

              1 Reply Last reply Reply Quote 0
              • R
                RN81 last edited by

                I see what you mean.
                Will workout a ea this weekend when my day job is over.

                Hadees his solution works, but not completely. But that's because my explanation was not accurate enough.

                thanks in advance

                1 Reply Last reply Reply Quote 0
                • R
                  RN81 last edited by

                  @fxdreema

                  Made a little EA, hope this helps a bit.

                  https://fxdreema.com/shared/ZAFDnVON

                  Thanks

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

                    Ok, you have multiple pairs, many trades, only 1 Equity and 1 Balance value. You tried to compare different values and you don't like the result. This makes me think that the values you compared are not the right ones. Can you describe what value do you want to get?

                    That Bucket block is useless there. This block would make a list of trades, that's all. Then in another block you can get the results. See this:
                    0_1549041840244_c458deb6-d77a-4853-8a50-8aac293d648d-image.png
                    In block 5 here only a list of Buy trades is created. Then in block 8 the count of these trades is calculated... and also other values (https://fxdreema.com/demo/mt4-bucket-trades)
                    The idea of those blocks is to be able to select group of trades, calculate some value out of them and use that value somewhere.

                    1 Reply Last reply Reply Quote 1
                    • G
                      guss09 last edited by

                      I use "Check Profit (unrealized)" Block and "Close trades" Block to close all my open trades if my profit reach $5 for example
                      0_1549061472333_Close trades.PNG

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

                      Online Users

                      M
                      S
                      T
                      O
                      G
                      B
                      A
                      P
                      I
                      M
                      M
                      J
                      T
                      S
                      T
                      M

                      28
                      Online

                      146.7k
                      Users

                      22.4k
                      Topics

                      122.6k
                      Posts

                      Powered by NodeBB Forums | Contributors