Loop through arrays with custom block
-
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 loopsSolution 1: A custom block which sets a global LoopIndex
Solution 2: Setting this global LoopIndex as an array with the block numbert as identifier.
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:
-
What trade strategy are you trying to do? There may be an easier way.