fxDreema

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

    balance / equity and free margin zero until finish trade

    Questions & Answers
    2
    4
    557
    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
      rpelliciari last edited by

      Hi.
      Using my MT5 release provided by my Broker, the values for balance / equity and free margin remains zero all time until the trade not finish.
      For example, if I got $ 100 of profit during a succesfully closed trade I will have $ 100 available for balance / equity and free margin. And so on...
      But, thinking about an EA execution, can this cause some issues to start a trade ?

      I dont have in my code any money mgmt block basing on my balance. Can I face some issue from this way to start a trade through an EA ?
      Can my EA understand that there isn't funds to start a trade transaction ?

      Thanks guys !

      Ricardo Pelliciari.

      1 Reply Last reply Reply Quote 0
      • R
        rpelliciari last edited by

        I got it. Basing on MQL5 API we have a method called "AccountFreeMargin()" that returns a double value that can be handled.
        Basing on this, is it possible to declare a fixed Free Margin as a variable or something like this ?

        Thanks !

        1 Reply Last reply Reply Quote 0
        • R
          rpelliciari last edited by

          Ok, I already solved this situation. It was a pretty simple solution, for instance.

          Basing on this article, we have to start an EA instance the values for "balance", "equity" and "free margin". That is the same value, thinking about an EA initialization.
          ( http://www.luckscout.com/leverage-margi ... x-trading/ )

          From this way, all that we need to do is use our "onInit()" abstract EA method and setup the variables basing on a new static double variable.
          And thats it ! See ya !

          ......
          margin operations.png

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

            Look at the name of this block - Modify Variables. Modify... Variables. Variables, not Constants. Even it's color is blue-ish, like the color of Variables. Use Variables in it, not Constants.

            Variables are global variables. Constants are the same, but they are those "input" global variables... but not exactly variables, because MQL5 is giving error messages when you try to modify them.

            Again, Variables are variable, they can be modified. Constants are constant, the idea is to never modify them!

            Also, connect this block with other block (for example "Pass"). If a block is not connected, it is not used at all.

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

            Online Users

            H
            F
            E
            B
            Z
            A
            C
            J
            S
            T
            K
            S

            24
            Online

            146.9k
            Users

            22.4k
            Topics

            122.6k
            Posts

            Powered by NodeBB Forums | Contributors