fxDreema

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

    Formula block - count trades of certain Group

    Questions & Answers
    2
    2
    910
    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.
    • D
      DarK last edited by

      Hi,

      I use formula for counting history trades so i can set lot size for future pending trades of certain group#.

      How can I count trades of other group# of trades in the same EA?

      Thnx

      BR

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

        I can see you start counting when the EA is started... or at least it looks like this. Actually you can count over the past trades and orders using "For each...." blocks. Well, now I realized that I should add option in "For each Closed Trade" to not go to very old history trades, but at least you can specify exact amount of past closed history trades to work with.

        I can suggest to define and use a variable (click Variables) instead of Formula's result variable.

        Here is a little example of how to calculate lot sizes of buys and sells: http://fxdreema.com/shared/bvrTBQFKb
        Or even better with this one: http://fxdreema.com/shared/NwqfdGorc
        this example is better because you loop trades once, and for each of them you ask for some of it's properties (in the case - it's type) before incrementing other parameter. So you can actually loop all available trades from all groups, and within the loop to check it's group number.... I think you will get it 🙂

        Read the information of these pink blocks to understand how they work. You will probably realize how this second properties panel works.
        I used "OrderLots()" which is a native MQL4 function that returns the lot size of the currently loaded trade, but you can also use "Formula" or "Condition (+Adjust field)" or "Modify Variables" to modify a variable. In these blocks the given parameter (for example lot size) is hidden somewhere in the pink "(in loop)...." category.

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

        Online Users

        A
        M
        E
        A
        E
        N
        S

        15
        Online

        146.7k
        Users

        22.4k
        Topics

        122.6k
        Posts

        Powered by NodeBB Forums | Contributors