fxDreema

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

    Arrays...

    Questions & Answers
    4
    9
    5289
    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.
    • M
      MetaTrader last edited by

      I also often work with arrays and I always encapsulate them in a function with a static array
      Its a way of pseudo OOP in MQL4

      // usage
      // index and value both empty gives back the arraysize on int & index
      // index empty value set is array push
      // index set value empty is get value
      // index set value set is set value
      double myArray(int &index = EMPTY_VALUE, double value = EMPTY_VALUE){
      static double arr[];
      // pseudo code from here
      if (index is empty) resize array by +1
      if (index out of array) resize array
      if (value is Empty) return value of arr[index]
      else set arr[index] to value and return value
      }

      1 Reply Last reply Reply Quote 0
      • B
        Babago last edited by

        Hi FxDreema,
        i'm using some "Custom MQL4 block" working with some arrays that i declared inside the block.
        how can i read these arrays in another "Custom MQL4 Code" blocks?

        Is there a way to globally declare an array?
        I tried to declare in the "on Init" panel but doesn't work
        and arrays can't be declared in the "Variables" input form...

        Can you help me?

        1 Reply Last reply Reply Quote 0
        • M
          miro1360 last edited by

          __Hi FxDreema,
          i'm using some "Custom MQL4 block" working with some arrays that i declared inside the block.
          how can i read these arrays in another "Custom MQL4 Code" blocks?

          Is there a way to globally declare an array?
          I tried to declare in the "on Init" panel but doesn't work
          and arrays can't be declared in the "Variables" input form...

          Can you help me?[/quote:1qh64lv8]

          in past I had also working with this and only way was declaring it manually in code using MetaEditor after creating mq4, but admin said, that maybe in future he create something to make this custom codes to define own parts of code in tops, like functions, arrays, etc .. I am waiting for this 😄

          Between trading and gambling is a very small gap, be careful.

          1 Reply Last reply Reply Quote 0
          • B
            Babago last edited by

            Thank you Miro1360!
            i'm using this software since two years and more and this is the only feature i feel missing..
            Hope admin will add it soon 😉

            Thanks again!
            Dave

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

              What do you want to do with these arrays? Because working with arrays in MT4/MT5 is not very pleasant. You can try to write some custom functions in the Studio and use them instead. I also use many functions for all these blocks, with many static parameters inside them.

              1 Reply Last reply Reply Quote 0
              • B
                Babago last edited by

                Thanks Admin!
                i used a custom block to catch some global variables, order them and put in relation with the name of the pair it referring..
                then i would like to use blocks to check them and build different actions and different entries..
                for the moment i didn't find a workaround..

                i will try to follow your advice but i didn't understand well what do you mean to "create function" and call them...
                Can you build me a very very simple example of what you mean?
                i hope it will be helpful also for others..

                PS. every day i use FxDreema i think is really an amazing software! Thanks again to have created it!

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

                  https://fxdreema.com/studio/
                  Look at the right side, on the bottom. Hit "New" and write some function. Then you should be able to use this function in the blocks... if everything works in the Studio, because I don't know many people who use it and bugs are expected 🙂

                  1 Reply Last reply Reply Quote 0
                  • B
                    Babago last edited by

                    i feel stupid...
                    i read you in other topics suggest "Look at the right side, on the bottom" but i can't find it... 😳

                    1 Reply Last reply Reply Quote 0
                    • B
                      Babago last edited by

                      oh ok.. i starting to understand...
                      i never know about Studio..

                      i'm going to do some searching on the forum starting from this..
                      post/11013

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

                      Online Users

                      M
                      U
                      S
                      9
                      S
                      E
                      E

                      17
                      Online

                      146.7k
                      Users

                      22.4k
                      Topics

                      122.6k
                      Posts

                      Powered by NodeBB Forums | Contributors