fxDreema

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

    Question on arrays in fxDreema. Part 2

    Questions & Answers
    5
    12
    981
    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.
    • l'andorrà
      l'andorrà last edited by

      I'm moving closer to master arrays in fxDreema but I found an issue with some blocks that I simply can't move through. This is my test project right now:

      https://fxdreema.com/shared/WKPCTo6ae

      I know how to fill all arrays with the correct info when a trade is open and reinitialize them when it is closed. In my example I'm using just two trades but there will be many more in the final version.

      The problem arises when I want to add partial close in between. If I switch off blocks 7, 10 and 11, ie, no partial close is considered, everything works smoothly. However, when they are switched on the arrays are not properly updated or reinitialized. I guess the issue is how both 'fully closed' and 'partially closed' options on blocks 7 and 8 are storing the value of the ticket number. I need to count how many times a trade is partially closed because different percentages will be applied accordingly. I'm using the ticket number to identify the correct trade and update that info, but to no avail so far.

      Does someone know how the ticket is stored on both options? Any help will be fully appreciated.

      (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

      (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

      (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

      S R 2 Replies Last reply Reply Quote 0
      • S
        seb 0 @l'andorrà last edited by seb 0

        @l-andorrà
        I didn't use these features a lot on fxdreema but, from what I see, what could be relevant to update your arrays values is not to create an other array "array_partial_close" .
        Instead when a position is closed partially, you can update the "array_ticket_number" , and attribute a sub 1 number. Instead of replacing 1 by 0 as with a full close, replace 1 by 0.5, if the partial close is 50% of the initial amount.
        So the value update will be : array_ticket_number[i]=array_ticket_number[i]-(volumeClose/initialVolume)
        Is that what you want ?

        l'andorrà 1 Reply Last reply Reply Quote 0
        • R
          RGoo @l'andorrà last edited by RGoo

          turned off

          RGoo

          l'andorrà 1 Reply Last reply Reply Quote 0
          • l'andorrà
            l'andorrà @seb 0 last edited by

            @seb-0 Thank you for the reply. The truth is that I need that ticket number for other parts of the bot that are not included here, so mastering how those blocks store the info would definitely help me with those other parts too.

            Your suggested formula is what I have in mind, but for it to work I need the correct ticket number to be stored into the array. And that is what is not happening yet. 😞

            (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

            (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

            (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

            1 Reply Last reply Reply Quote 0
            • l'andorrà
              l'andorrà @RGoo last edited by

              @RGoo Thank you for the reply. That is exactly how I arrived here. I created simpler cases of the array and they worked as expected. I can make it work to store info correctly and to reinitialize them as far as there are no partial close. As soon as I include it nothing works because of the way those blocks store the ticket number.

              I don't see where that 'last_i' variables is used other than being set into 0 when a trade is closed. What is its purpose?

              (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

              (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

              (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

              S 1 Reply Last reply Reply Quote 0
              • S
                seb 0 @l'andorrà last edited by

                @l-andorrà
                Ok I tried the things and I found that the feature "(in Loop)Trade\Order in loop" works out as it loads the ticket of the initial position, not the ticket of its last close.
                Capture d’écran (625).png

                l'andorrà 1 Reply Last reply Reply Quote 0
                • l'andorrà
                  l'andorrà @seb 0 last edited by

                  @seb-0 I selected the purple dot option, not the pink one, but the problem persists.

                  (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

                  (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

                  (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    seb 0 @l'andorrà last edited by

                    @l-andorrà
                    As you can see with this configuration my platform returns me only the tickets of the initial trades. Isn't it the case for you ?
                    Capture d’écran (626).png
                    Capture d’écran (627).png

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

                      This should only be a hint, I didn't want to write in the program structure of your EA. But I still think you should think about the logic again.
                      Here's an example: If you want to store 2 values related to a trade in variables to work with later, consider the following: The trade has a ticket number and an initial size (lots) that should be stored. Then a possible array would be something like this: (double) trade[5][2] , where the numbers in the brackets don't matter as long as they are larger than the number of variables you want to store. Well, you open the first trade and want to save the ticket number for this trade, then you put it in the variable: trade[0][0]. For example, if the ticket number is 65, the current size of the variable trade[0][0] == 63, you store the lots in the variable trade[0][1]. You can now easily find both variables via the assignment trade[0][...], The next trade has the variables trade[1][0] and trade[1][1] etc. If the lot size changes, you search the variable you changed via a loop and save trade[...][1] again.

                      RGoo

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

                        Oh no, tickets. Tickets are crazy AF in MQL5, I don't recommend working with them at all. You know I recently worked on these blocks, and still I can't directly tell you what is going on with the tickets.

                        In MQL4 you create some order - running order, pending order - you got a new ticket number. Easy. A little bit more complicated when you decide to partially close a trade - the original one is closed and a new one is opened, but it's OpenPrice is the same as the original. Still easy.

                        In MQL5 there are positions, deals and orders. You decide to just open a new "trade", and you end up with a new order, which leads to a new deal, which leads to a new position. You got all three, and all with same or different tickets, depending on the environment. There is also something else called Position Identifier. If you think the arrays are complicated, try to understand orders, deals and positions in MQL5.

                        In MQL5 when you partially close a position, its ticket remains the same, but a new deal is created. You can have many deals (with different tickets) belonging to the same position. Even when you open and close a position, there are 2 deals - one IN deal for the open and one OUT deal for the close.

                        You are collecting ticket numbers in the Trade event, they are probably ticket numbers of positions. I'm not even sure what they are, and I don't really know what they should be - the tickets of the position or the tickets of the last deal.

                        When it comes to tickets, internally the blocks know when and what to do with them. I don't recommend working with tickets from outside. But if you do, and if you really understand how orders, deals and positions work in MQL5, you can experiment with them and give ideas for how the tickets can be used by users like you.

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

                          And by the way, there is a difference in the special "on Trade" blocks for MQL4 and MQL5. For MQL5 there are two additional blocks "Position incremented" and "Position decremented". I guess the "Position closed" block works only on the final close when there are multiple partial closes. If you ask me, I don't know if it works the same in MQL4. And if it works differently, I don't know which way is the right way - the MQL4 way or the MQL5 way... especially after having these blocks like this for years.

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            Alan.paredes2 @fxDreema last edited by

                            @fxDreema could you implement a tool in the platform that allows users to test and debug each programming block individually before integrating it into the complete bot.

                            To achieve this, the platform could include a debugging function that allows users to input test data and observe the output of each block. This would allow users to better understand how each block works individually and ensure they are programming correctly.

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

                            Online Users

                            P
                            B
                            S
                            S
                            T
                            F
                            I
                            S
                            S
                            G
                            I

                            19
                            Online

                            146.6k
                            Users

                            22.4k
                            Topics

                            122.6k
                            Posts

                            Powered by NodeBB Forums | Contributors