fxDreema

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

    % profit for all trades...

    Questions & Answers
    5
    8
    4332
    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.
    • A
      alessandromagno last edited by

      Hi guys i'm trying to make my EA to close all open trades once the total profit amount in % of the money account reaches 1 or 2 or 3%.

      Let's say I have set the percentage at 2%. I have an account of 1000, my floating profit is +20 (equity 1020), 5 open trades. Then my EA must closes all 5 positions, waiting for the next condition to start again.

      In check profit unrealized I see there's no option about % to close the trades. Nor in TP option under buy/sell blocks. So i tried with: bucket of trades (blue box) -> check profit (magenta box)->close trades

      0_1523287677691_Senza titolo.jpeg
      But i see there's something wrong because it closed my unique trade at 0.42 cents instead of waiting for 20$.
      What's wrong: the method or "2" i put in the field?

      Thanks

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

        There is no % option, but the option is in money... dollars. As you probably know, you can use native MQL functions in all input fields. So the default value is 0, but you can put something like:

        AccountBalance() * 3 / 100.
        

        AccountBalance() gives you the current Balance, the amount of money you had before opening the trades. Let's say that the balance is 1000, then 1000*3/100 equals to 30 (dollars) 🙂

        drayzen S 3 Replies Last reply Reply Quote 0
        • A
          alessandromagno last edited by

          thank you

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

            @fxdreema said in % profit for all trades...:

            There is no % option, but the option is in money... dollars. As you probably know, you can use native MQL functions in all input fields. So the default value is 0, but you can put something like:

            AccountBalance() * 3 / 100.
            

            AccountBalance() gives you the current Balance, the amount of money you had before opening the trades. Let's say that the balance is 1000, then 1000*3/100 equals to 30 (dollars) 🙂

            Hi @fxDreema ,
            Is there any way to do this so that the percentage figure is a Constant? (or some other method so it's available for optimisation)

            ..the alien does not concern itself with the opinions of humans..

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

              @drayzen said in % profit for all trades...:

              3 / 100

              just replace the "3 / 100" with your constant, type it there.

              AccountBalance() * yourconstant
              

              Need small help? Tag me in your post
              Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

              drayzen 1 Reply Last reply Reply Quote 0
              • drayzen
                drayzen @roar last edited by

                Thanks again @roar ,
                I was hoping Constants would be addressable like that, awesome! 🙂
                Be good to add a note about this being possible here: https://fxdreema.com/help/working-with/constants-and-variables

                ..the alien does not concern itself with the opinions of humans..

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

                  @fxdreema
                  Have experimented as follows, but after closing the trades often came out a minus. Please be so good and post here a fitting example of what this task exactly fulfilled.

                  example
                  Trade 1 -12.25
                  Trade 2 + 5.25
                  Trade 3 +17.00
                  ...........................
                  Total 10.00

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

                    @fxdreema said in % profit for all trades...:

                    AccountBalance() * 3 / 100.

                    AccountBalance () gibt Ihnen den aktuellen Kontostand, den Geldbetrag, den Sie vor der Eröffnung der Geschäfte hatten. Nehmen wir an, der Kontostand beträgt 1000, dann entspricht 1000 * 3/100 30 (Dollar) 🙂

                    how did you write that? with me always comes an error message
                    Sorry google translate

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

                    Online Users

                    S
                    A
                    B
                    A
                    J

                    14
                    Online

                    146.7k
                    Users

                    22.4k
                    Topics

                    122.6k
                    Posts

                    Powered by NodeBB Forums | Contributors