fxDreema

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

    Minimum Volume Info

    Questions & Answers
    2
    2
    490
    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.
    • afgmarkets
      afgmarkets last edited by

      Hi people!

      In order to get a proper partial closing and avoid the "Invalid Volume" log, I would like to calculate this partial volume with a variable. Do you know how can I get the minimum volume value on the EA? Maybe on Market Properties? I could do it with a constant (introducing 0.01 for Forex and 0.1 for indexes, e.g.) but I some of you know it...

      Thank you very much!

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

        @afgmarkets this bunch of code returns the minimum volume:
        SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MIN)
        https://www.mql5.com/en/docs/marketinformation/symbolinfodouble
        https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_double
        However the partial closing bug is not just about minimum volume, but also lack of rounding (or flooring) the number.
        You can do the % calculation manually and then just put the code in Custom input field instead of the percent field.

        This code calculates 33% of your position and then floors the value to nearest hundredth:
        MathFloor(PositionGetDouble(POSITION_VOLUME)*0.33 *100)/100

        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

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

        Online Users

        M
        N
        C
        S
        S
        P

        15
        Online

        146.7k
        Users

        22.4k
        Topics

        122.6k
        Posts

        Powered by NodeBB Forums | Contributors