fxDreema

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

    Object naming with arrays

    Bug Reports
    3
    6
    2554
    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.
    • roar
      roar last edited by

      https://fxdreema.com/shared/dCBq6vAYc
      As a test, here's an EA which draws 3 vertical lines to candles 1, 2 and 3.

      However, due to using an array to name the objects (I think), the lines and names dont match, something goes wrong..

      @fxDreema would you please look at this, or explain where I made an error

      0_1611613519497_e44f99b7-3c09-4c2a-84f7-66cb6b86252b-image.png

      0_1611613587425_9642e30d-8953-40fe-bf8f-b5f45bbe483d-image.png

      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

      M 1 Reply Last reply Reply Quote 1
      • M
        miki @roar last edited by

        @roar If they pass individually, that's right. Probably conflicts are to occur when passing different data to the same variable at the same time.

        roar 1 Reply Last reply Reply Quote 1
        • roar
          roar @miki last edited by roar

          @miki I think it has something to do with fxdreemas own naming system.
          If "Draw line" block is replaced with some ObjectCreate code, everything draws correctly
          https://fxdreema.com/shared/SRxnX09Tb

          Well I'll just use the actual function then, not a huge problem

          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

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

            @roar error is in the output code. FxDreema code is:
            0_1611652570090_Immagine.png

            right code is:
            0_1611652739603_Immagine.png
            and it work right.

            roar 1 Reply Last reply Reply Quote 2
            • roar
              roar @miki last edited by

              @miki thats it, youre right!

              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
              • fxDreema
                fxDreema last edited by

                They are in fact 4 lines printed on the chart.

                0_1613316388520_57ecc03e-7e3a-4d58-a38e-ff8beb9bf886-image.png
                fxd_line_5_0 is the one that appears first on candle 1. Eventually id3_thirdline appers on top of it.

                Well, as @miki says, there is right and wrong code in this particular situation. But the thing is that there could be a reason for "// Set variables (in)" to be at the bottom, and this is because in that Variables window you could use those P1, P2, P3 things, which are shortcuts for ObjName, ObjectType, ObjColor and the others. It's like the chicken and egg problem.

                It looks that my assumption was that in the Variables window we should be able to use the Px values after they are modified. And there could be an use case where we want this, for example:
                https://fxdreema.com/shared/5zi3oorD
                0_1613319210950_29fdf18f-54bc-42af-b934-44854e770b51-image.png

                But when I'm thinking about it, this use case is less intuitive and less possible from the one @roar stumbled upon, so I decided to fix the problem by moving "Set variables (in)" at the top. This means that the example that I'm giving above will be wrong.

                I hope that this update doesn't change anyone's project, because it is always possible that someone is doing the things in the way my example works.

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

                Online Users

                S
                M
                E
                G
                D
                A
                A

                32
                Online

                146.7k
                Users

                22.4k
                Topics

                122.6k
                Posts

                Powered by NodeBB Forums | Contributors