fxDreema

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

    How to terminate EA if target Equity is reached?

    Questions & Answers
    2
    24
    4953
    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.
    • F
      fxforgood last edited by

      Dear fxdreema,
      Can you give me a clue or template Please, if I would like my EA to self terminate when target equity is reached?
      Let say If I start my EA with $1000 and then in a week My equity is increased to $500, then EA should terminate herself.

      Thank You

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

        There is a block "Terminate" (in the lowest category) which will cause the EA to seld-terminate. I think that checking equity is pretty easy with "Condition". It depends on how you want to set this $1000 value - you can manually set it or it can be the balance at the moment when the EA starts to work. Then for which equity we are talking about - the main equity (or profit) of the account or what is generated from all the trades created by the same EA.

        1 Reply Last reply Reply Quote 0
        • F
          fxforgood last edited by

          __There is a block "Terminate" (in the lowest category) which will cause the EA to seld-terminate. I think that checking equity is pretty easy with "Condition". It depends on how you want to set this $1000 value - you can manually set it or it can be the balance at the moment when the EA starts to work. Then for which equity we are talking about - the main equity (or profit) of the account or what is generated from all the trades created by the same EA.[/quote:3asvd6bz]

          Thank You very much, I will try and let you know a.s.a.p

          1 Reply Last reply Reply Quote 0
          • F
            fxforgood last edited by

            Dear fxdreema,
            Is it true like this?
            Or do you have any other template?

            https://fxdreema.com/shared/fOTr3Rc4e

            PS: I just tried and it didn't work
            Thanks

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

              On the left side you have the current unrealized Profit, which is Equity minus Balance and this is only if there is a trade currently opened. This profit is the current result of the currently opened trade/s. If no trades are opened Equity is equal to Balance.

              On the right side you have the Initial balance. Compare Equity or Balance with it, not the current unrealized profit.

              1 Reply Last reply Reply Quote 0
              • F
                fxforgood last edited by

                This is working and EA terminated when equity increases to $50
                https://fxdreema.com/shared/bcOIe7RUd

                But Can you help me how to set this +50 into formula and variable so that I can change it anytime I want in the input parameter, instead of change it in the meta trader editor. I am new to this and still cannot find any clue at all.

                And I have been trying so many time but it didn't worked out
                Thank you

                PS: fxdreema is the best EA builder I've ever known. I mean it

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

                  https://fxdreema.com/help/-/working%20w ... 0variables
                  https://fxdreema.com/demo/mt4-variables

                  1 Reply Last reply Reply Quote 0
                  • F
                    fxforgood last edited by

                    __https://fxdreema.com/help/-/working%20with%20fxdreema/constants%20and%20variables
                    https://fxdreema.com/demo/mt4-variables[/quote:27tvzfft]

                    Thank you so much
                    I will check it out and hope I can understand...
                    Your prompt response is damn fast on the weekend
                    Sorry to bother you
                    happy weekend

                    1 Reply Last reply Reply Quote 0
                    • F
                      fxforgood last edited by

                      Dear Fxdreema,

                      I found some critical error on my EA, do you know why?
                      At first she ran well but then I got some message of error

                      https://fxdreema.com/shared/NRJwRZrye

                      ......
                      fxdreema error.png

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

                        It should be fixed

                        1 Reply Last reply Reply Quote 0
                        • F
                          fxforgood last edited by

                          When will you fix it?
                          I still found the error and EA stops suddenly during BT

                          Thanks

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

                            Yes, I was thinking about another problem. This one is still there and I am investigating it now. It will be fixed eventually.

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

                              This problem is from the function which is responsible to delete the second OCO pending order when the first one is opened. And normally everything works fine, but in your situation this problem follows another problem. Because you use big lot size, when one of the pending orders is reached, it can't be opened. Instead, it is deleted but for some reason it still can be selected with OrderSelect() in MQL4. That's why this error appears. Before OrderDelete() there is OrderSelect(), but OrderSelect() successfully selects the ticket and then OrderDelete() fails to delete it.

                              And I'm not sure what to do in this situation. That pending order is not opened as it was expected and because ot that the strategy fails. The error that follows does not allow the EA to continue working, but this is probably better, because do you need such broken EA to continue working?

                              Even if I mute this error, what to do with this faulty pending order, this is my question? 🙂 For trades, if you request such a big lot size, the EA just calculates the biggest possible lot size and uses it, but pending orders are opened on the server.

                              1 Reply Last reply Reply Quote 0
                              • F
                                fxforgood last edited by

                                Ok Thank You

                                maybe I should find out any other strategy instead
                                thank you again

                                1 Reply Last reply Reply Quote 0
                                • F
                                  fxforgood last edited by

                                  Actually My strategy is simple and it was working well on previous version of fxdreema.

                                  Just now I tried to make sure that it is working or not and it is not.

                                  Let say, if I open buy sell at the same time, and one of the trades that is going against us will be backed up by Pending stop order at certain point in reverse direction.

                                  it used to work well but now I can do nothing
                                  I was wondering if the off line version is still remain the same as before or you have updated too..
                                  Please let me know, if you can send me a copy of previous version of that offline version that allow me to work with my strategy

                                  thank you
                                  fxforgood

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

                                    I only added the newest MQL compilers in built 100, but all blocks are old.

                                    The last things I did was to enable Strict mode and fix many small issues here and there. As a result at least 2 unexpected problems were reported and in both cases everything worked if I disable Strict mode (remove #property strict). But I tested your idea with and without Strict mode and it failed in both cases, so now I believe that at least I didn't introduced a new problem. Whatever it is, it is old I think. And the problem appears in one function that should close OCO pending orders (when one of them closes => close the other one). And it normally works, but not when one of the orders failed to open because of too big lot size. At least this is what I found to be the problem. I test with initial $1000 dollars and 1 lot appears to be too big.

                                    So.. do you see the same thing on your side? Do you have pending order deleted because it's lot is too big, or I am looking at something else?

                                    1 Reply Last reply Reply Quote 0
                                    • F
                                      fxforgood last edited by

                                      https://fxdreema.com/shared/CDXjkVAK

                                      Based on that project,
                                      I tried to use 0.1 lot for initial balance of $100,000
                                      there is still an issue of error
                                      but when I turn off the group block of pending order EA runs no problem.
                                      maybe you could fix it cause I could possibly do any wrong perception in developing this project, or maybe you have an alternative to make it through...thank you again

                                      Below is working well but this is not like what I expected

                                      https://fxdreema.com/shared/3EJSOEWHc

                                      1 Reply Last reply Reply Quote 0
                                      • F
                                        fxforgood last edited by

                                        this one is doable

                                        https://fxdreema.com/shared/G6OdIPVkd

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

                                          Now the problem is totally different and is here http://prntscr.com/9e7kty
                                          http://i.imgur.com/dUSTLUa.png

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

                                          Online Users

                                          H

                                          8
                                          Online

                                          146.8k
                                          Users

                                          22.4k
                                          Topics

                                          122.6k
                                          Posts

                                          Powered by NodeBB Forums | Contributors