fxDreema

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

    Loop through arrays with custom block

    Tutorials by Users
    2
    2
    2512
    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 MetaTrader

      Problem 1: I need to loop through an array of Symbols and execute some code blocks for each iteration knowing the number of iteration.
      Problem 2: I need to nest those loops

      Solution 1: A custom block which sets a global LoopIndex
      Solution 2: Setting this global LoopIndex as an array with the block numbert as identifier.

      0_1512686256167_1acef93b-6169-457d-a6e8-c981dffd1bd7-grafik.png

      Do not forget the global variable at the bottom of my image
      Now you can use the new block several times....

      As input for the block (cycles) use the ArraySize of the array you want to loop through.
      To know the current iteration use aLoopIndex[BlockNumber] where BlockNumber is the id of the loop block. Sample is looping through aFoo and Alerting the current iteration and the current Array Element:

      0_1512686915818_a71596b9-99bd-46e0-8be4-e05146b04310-grafik.png

      1 Reply Last reply Reply Quote 0
      • I
        Implosion last edited by

        What trade strategy are you trying to do? There may be an easier way.

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

        Online Users

        T
        B
        A
        P
        A
        A

        14
        Online

        146.7k
        Users

        22.4k
        Topics

        122.6k
        Posts

        Powered by NodeBB Forums | Contributors