fxDreema

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

    Closing All Position when x% of Balance

    Questions & Answers
    2
    2
    962
    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
      rockycenk last edited by

      Hello everyone;

      I would to ask if it is possible to close all open position when the loss reached 5 % of balance ?

      I have tried to do that within the loop section using "check loss" block, however this block serve to close the position one by one, thus the cumulative loss would exceed the 5 %.

      I could not find any block to monitor all position and when their loss reach 5 % immediately close them.

      Can anyone would help me about this subject ?

      Regards;

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

        Well, they are always closed one by one by EAs, or at least I don't know any way to tell the server to close multiple at once.

        But you probably mean something different, as you are using a block that serves 1 trade at a time, because all blocks with pink color are just like this.
        If you want to compare the general Balance with Equity or Profit, use Condition block. You will also need to use the "Adjust" field to transform one of the operands to % value. Look in the description of Condition for more info.

        Or if you want to use the profit only from certain group of trades (or those that you have from this exact EA), then use "Check current unrealized profit" block. Well, the little problem here is that you have very simple input field for "Profit amount", but this can be better. Inside this field you can write not only numeric value, but also a whole MQL4 formula, so you can calculate the % value directly. To get the current balance use AccountBalance(). For example, 5% of the balance will be value like *-AccountBalance()5/100 (with minus sign).
        Ah.... and to close all trades use "Close trades" block with the same filter settings as those used in "Check current unrealized profit". Of course, this will close them one after another as I mentioned above, but it will close them all 🙂
        Try this with some 1000 initial balance: http://fxdreema.com/shared/oRW5zQPke
        I have this result (with some weird visual bug that I see for the first time, but anyway): http://prntscr.com/360ryr

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

        Online Users

        C
        K
        A
        D

        15
        Online

        146.7k
        Users

        22.4k
        Topics

        122.6k
        Posts

        Powered by NodeBB Forums | Contributors