fxDreema

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

    Loop through double variables to find variable name

    Questions & Answers
    3
    5
    1161
    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.
    • H
      Heisenburg last edited by

      Hi, I have a scenario where I have a lot of double variables created (for example (High, and high 5%, high 10% are variable names) , each of which will always ultimately be my Order price, stop loss and take profit.
      I have different buying and selling scenarios whereby they all ultimately go to the same bucket of pending orders at which point I have an order price, which is stop loss and take profit variable.

      I would like the robot to tell me what the double price variable name is once an order is triggered. For example when an order price double variable is created I want to loop through all the double variable names to find out the order price of the double variable name. So eg if order price double price = High 5% (double variable name) then return High5% Would anyone know how to do this? I envisage having to create a collection of double variables then running a custom code block but I don't have a clue how to code.
      Thanks

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

        You can't get variable names. I think that when the source code is compiled, all variable names are just gone. They are used only for us, to be able to read the source code. The program itself works with the memory addresses behind variables. If you want to map values with names in MQL4, I imagine using 2 arrays. But arrays are very annoying for me in MQL4.

        By the way, I can see your project and it has more than 1400 blocks. I honestly don't understand how some people like you are able to work with such projects, for me personally even 20 blocks are much. But I think you can remove many blocks with different techniques. Like this row of Formula blocks starting with block 13 - all those are just calculations with Variables and one block with custom MQL4 code can replace them all.

        H 1 Reply Last reply Reply Quote 0
        • H
          Heisenburg @fxDreema last edited by

          @fxdreema
          Thanks a lot for the info, I am taking your advice on those formula blocks to reduce into one block. The limiting factor for me is I only know very basic coding hence why I did that bit I've figured out how to do it.
          On the array idea, would you have any examples I could refer to in order to try that? Thanks

          1 Reply Last reply Reply Quote 0
          • J
            josecortesllobat last edited by

            Here you have @miro1360 post where you can find array´s info

            https://fxdreema.com/forum/topic/4501/video-tutorial-signals-dashboard-ea-advanced-looping-objects-arrays/4

            Hope this helps

            H 1 Reply Last reply Reply Quote 0
            • H
              Heisenburg @josecortesllobat last edited by

              @josecortesllobat
              Thanks, I have seen that before but looks like too much for my brain to deal with unfortunately.

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

              Online Users

              H
              H
              A

              7
              Online

              146.7k
              Users

              22.4k
              Topics

              122.6k
              Posts

              Powered by NodeBB Forums | Contributors