I've read through a number of examples of code from the forum regarding loops where some operation is done for each bar of code. I'm looking for something different (I think) but can't find an example to follow.
I have an indicator with an inputs for the number of moving averages to review. In the example, let's assume num_avg = 5. Each moving average is 5 bars longer than the previous one and the beginning moving average length is 7. So moving averages would be 7, 12, 17, 22, 27 in this example. I want a loop that will take the user input (num_avg = 5) and calculate each of the moving average values as described here and sum them.
Any guidance about how to structure this would be much appreciated. I know exactly how to do this in VBA but no idea how in AFL.