fxDreema

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

    My first try

    Questions & Answers
    2
    15
    1876
    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.
    • isp00rt
      isp00rt last edited by

      Dear all,

      This is my first try using this wonderful tool, so some help is needed, please. I want an Ea helping me in my manual trading. Essentially I want a script with an EA's feature, as you'll see.

      https://fxdreema.com/shared/7hipqN0Hb

      My project: I visually identify a trade on a chart and I create a single pending order per chart. Only one trade will be open per chart. I never open at current price. All my orders are pending ones.

      Conditions:

      1. I want the EA to create the pending order with the size, open price, TP and SL manually specified.

      2. Once price reaches TP:
        a) Half the size of the trade is closed. The other half remains open.
        b) SL is moved to breakeven plus 1 pip.

      3. EA is automatically closed.

      As you can see it is a very simple one, but my lack of experience in programming and in using this builder has me stuck in my current project. Could someone please check any possible error? Additionally, there several things I don't know how to implement right now.

      a) How can be specified the SL is moved only when TP is reached?
      b) How pending order type can be specified (sell limit, sell stop, etc.)?
      c) How can partial size close be specified?

      Thank you,

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

        I will suggest to study how to use pink blocks, here are some examples, one of which (the last one) shows partial close: https://fxdreema.com/examples/#Loop-(For-each...)

        a) When TP is reached, the trade is closed. In this case, what SL do you want to move?
        b) The type of the pending orders depends on the open price, it is automatic. For example, try to set value of -20 for Price offset.
        c) The only block that can close a trade paritally is the pink "close (partially)": https://fxdreema.com/demo/mt4-loop-partial-close Note that this block should be used with "For each Trade", as it's shown in the example. The way trades are partially closed is also interesting - the original trade appears fully closed and new one appears to be opened, but the new trade shares some properties with the original - Open price, SL, TP.

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

          Thank you for your suggestion. I didn't take pink blocks into account. I followed your suggestions and some changes have been done. Bow about your questions.

          a) I want to move the SL of my trade. I don't want to close all the trade, just a part of it. This is why I need a partial close block. As I said in my initial message, once the TP is reached, half the size is closed but the other half is still open until I close the trade manually. I need the EA to move the SL at that moment so that the trade is safe from any potential loss.

          b) Impressive! So if i understand it correctly, if I want a sell limit I just need to specify a price above the current price and in case of sell stop I should select a price below the current price. Right?

          c) Great! I think I got it now.

          Now an additional one. How can I make the EA is self removed once it did all it's supposed to do?

          Thank you.

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

            Well, the pink "close (partially)" is the only block who can do that and yes, it is part of this ping group of blocks. So you should try to understand them 🙂

            There is a block called Terminate

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

              Thanks for the suggestion. One additional question, please. I would like to add a log creator to help me identify any possible error occurred (invalid stop, invalid proce, etc.). Could you please tell me what block do that?

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

                Well, for the most time the EA will decide what lot size and what stops to use. For example, if you try to open 0 lots, it will open the minimum lots (0.01 maybe). Also, if the EA can't create/modify/close some trade/order, it will try few times. If something is not fixable, MetaTrader itself will put error messages in it's log. Otherwise the gray outputs in some blocks are designed to be active in case of error.

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

                  I think I got it!

                  https://fxdreema.com/shared/TRecybmZb

                  As it is a manual initiallized EA it can be backtested, so could someone please check it to confirm it is correctly designed to do what is listed in my first message. I would much appreciate it. 😏

                  Thank you in advance

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

                    This doesn't look good for me. First of all, about the pink blocks: https://fxdreema.com/examples/#Loop-(For-each...)
                    And about the way they are connected... https://fxdreema.com/demo/mt4-wrong-closing-rule

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

                      Thank you very much for your help. I noticed that the current structure will ask for a buy AND a sell pending orders to be created when what I want is selecting a buy OR a sell pending order case by case. Sadly, I can't see how this "OR" option can be added right now. Is it any of the blue color blocks, maybe?

                      Thanks a lor again.

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

                        I don't understand this question 🙂

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

                          I'm sorry. English is not my native language. What I want to know is how can I implement the following with my EA:

                          1. I detect a trade oportunity
                          2. I decide I will set a pending order. A buy OR a Sell. Never both of them at the same time.
                          3. Then the EA makes all the work as programmed once the trade is open.

                          As I said in my last message I know how to implement that my EA asks for a buy AND a sell. What I don't know is how can I distribute blocks so that it is me who decides if a buy or a sell pending order is set. Could you please tell me how could I do that?

                          Thank you again and excuse my English, please. 😳

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

                            Ok. Let me add some more info in order to clarify my point. As I said, I'm not a mql4 programmer, so I asked for help in order to create my EA. I was said by a true programmer that if I wanted an EA controlling many different trades in many different charts I had to design one in which each pending order had to be created by the EA itself, and not manually set by me on the MT4 platform. Otherwise no EA would be able to recognize which open trade belongs to each chart.

                            This is why I can't insert my pending orders manually and then put the EA to manage them once become active (but I admit this is what I wanted initially). According to the programmer It MUST be the EA that will have to set each pending order. This is why my EA is designed to create both a buy and a sell pending order. The problem is that I don't know how can the EA know when will I need one or the other. As it is designed now, I will be offered both options at the same time whereas I will only set a boy OR a sell.

                            Am I clearer now? 😏

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

                              Depends on the Magic number. Manual trades/orders have Magic number of 0. EAs should make trades/orders with different number, but they can also work with trades/orders with Magic number of 0.

                              Try one of these: http://prntscr.com/c5e24v

                              If you want the EA to only control manual trades/orders, the easiest is to set the Magic to 0.

                              I still don't get these AND and OR questions 🙂 But in blocks like "No trade" or "No pending order" there are few filter options.

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

                                Sorry for this delay, but I needed some vacation time! 😆 Ok. Let me try to explain myself again. Let's imagine the EA makes what I want it to do. If I put it into a chart two windows will pop up: one asking for a buy trade AND another one for a sell trade at the same time. The problem is that I just want to open one single trade, not both simultaneously on the same chart. This is why I say that I don't know how to make that just one OR the other pops up. I know I could create two different EAs, one for buys and another for sells, but I find it a very unelegant way to do it. So, is there a way to create one single code for both options within one same EA?

                                I hope it helps. 😉

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

                                  Window pop ups?

                                  Anyway, whan any EA does in general is to check how many trades exists, to check some other things and to create new trades. "Buy now" and "Sell now" blocks, when you run them, they are going to make a new trade every time. So the should manage how often these blocks run. How... with other blocks such as "No trade", "Once per bar", "Condition" or others. Blocks like "No trade" also have filter settings inside.

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

                                  Online Users

                                  Q
                                  C
                                  T
                                  S
                                  A
                                  M
                                  R
                                  G
                                  G
                                  Y
                                  C
                                  S

                                  46
                                  Online

                                  146.7k
                                  Users

                                  22.4k
                                  Topics

                                  122.6k
                                  Posts

                                  Powered by NodeBB Forums | Contributors