Download MetaTrader 5
To add comments, please log in or register
Learn operation principles of Trading Signals for MetaTrader.
tegabach
17
tegabach 2015.07.28 19:21 
I am building a new indicator using the OnCalculate function for the first time. As I'm going through the logic in my brain, I can't get past the problem of what to do if I have multiple For loops that depend on prev_calculated settings when a recall occurs in the middle of a For loop. For example, a recall of OnCalculate occurs at iteration 162  of For loop 1, and prev_calculated is set at 162 upon re-entry of the OnCalculate function. For loop 1 continues where it was interrupted and completes its job. Here is where I see a problem... For Loop 2 is now using the prev_calculated value of 162 as the starting point, never processing bars 0 through 161. Can someone please shed some light on how to get through this? It may be something simple that I don't understand about how OnCalculate works, but I want to get past this so I can continue with the logic for my Indicator. Thank you in advance!
Keith Watford
Moderator
7947
Keith Watford 2015.07.28 19:42  
Why would there be a recall of OnCalculate before all code in the indicator is executed?
/
To add comments, please log in or register