fxDreema

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

    Closing trades when loss exeeds XX,XX

    Questions & Answers
    3
    7
    1574
    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.
    • ekanters
      ekanters last edited by

      Hi,
      This is not a full automated robot because I think I can do the charts better than a robot can. But setting a bunch of trades takes a lot of time so that is where the robot comes in. So far so good and it works just fine.

      Now I wanted to add a block on tick (checking all the time) that would close all trades and pending orders when all trades (minimum 3) exeed a certain loss. Lets say max loss may not exeed 150 dollar on all trades combined. So when total loss of combined trades is 150 dollar and 1 cent it should close all current trades and remaining pending orders in grid.

      I have found these 2 blocks but can't figure out how to get this working.

      For clarification I have attached a picture so its easier for you to see what I am doing.

      Thanks in advance.

      Erik

      ......
      Close trades.jpg

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

        Try this:

        "Check current unrealized profit" -> "Close trades"

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

          Have send question with video link by email. Hope you can help me out 🙂
          Have same problem with ""Check current unrealized profit"
          Of course its me who just don't understand how to place them.
          Erik

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

            This looks like a tutorial 🙂

            The first thing I notice is that you are using this block "check loss" in not the way that it is supposed to be used. Many people does not understand this concept by the way. This block is designed to work when "For each Trade" or another "For each..." block is placed above it. This block works on a single trade/order, it works for the currently selected trade (by some "For each..." block).

            All the other blue blocks - they work on a whole group of trades/orders. They first create a list of all the trades/orders that should be closed, then the actual closing starts - one after another all trades/orders from the list are closed. And this happens within the block.

            "check loss" and all the other blocks that have the same color are to be used inside a loop. Here is more about it: https://fxdreema.com/demo/mt4-loop-how-it-works. On this example all the pink block that you see form trailing stop, which otherwise exists as a single block. But using pink blocks is more open, because it's in a lower level.

            Block "Check current unrealized profit" first creates a list of trades using all the filters, then for this list it calculates the profit in the way you have selected (money, pips...), and then compares that result to the value you have entered. If the comparison is true - the path to the orange output is taken.

            In the last days I answered to a question about this block on e-mail. I will put my answer here just in case:

            __You know that this block selects multiple trades, calculates their total/average profit and compares that value to what you have entered in "Profit amount". The first thing that this block does is to select those trades that have specific parameters, all the filter does exactly that. Each trade moves through these filters first and only the ones you need pass. "Filter trades with certain profit" is just some additional filter where you can say that you want only trades with given profit to be used.

            Then, after all these filters you have only few trades, and you calculate their current unrealized profit. Well, by default only the Group filter is "on", all the others are optional. The one you ask for is the one where you can say "I know that I have trades here and there, but I want only those that have profit bigger than 10 dollars". Or you may want only those that have profit less than 5 pips. I think you get the idea now [/quote:280de3dp]

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

              Thanks I will dig in to it 🙂 BTW the video was made for my trading partner in arms. For the record these 2 stochastic settings could indicate the start of a trend. Above 70 trend up and below 30 trend down. So now the tutorial is complete 🙂 Thanks again.

              1 Reply Last reply Reply Quote 0
              • N
                NCS last edited by

                Hi, got a problem compiling "check current unrealized profit" when I connect directly an block to it, in this scenario the "close trades" block.

                I settled the above in the "on Trade" section.

                It caused only when I activate the choices under "Profit settings for the filtered trades" - if they are not activated - no problems cause.

                Compilation errors:

                error 116= "sign" - declaration without type
                error 256= "profit_moneyinp23_CompareProfit." - undeclared identifier
                error 256= "profit_pipsinp23_CompareProfitA." - undeclared identifier
                error 256= "profit_suminp23_CompareProfitAmou." - undeclared identifier

                Please help

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

                  if you have checked the Compare parameter to be input parameter, uncheck it

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

                  Online Users

                  E
                  H
                  R

                  10
                  Online

                  146.7k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors