An addendum:
Debugging the code I can see that the OnCalculate event is being called 2 or 3 times while METATRADER5 is being loaded with "Prev_Calculated" = 0.
I don't understand this sequential calling without any "prev_calculated", nor why my loop does not handle it accordingly.
Wow! It was solved...
This is the normal behavior of INDICATORS, and due to a global variable, almost half of the code wasn't being executed.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi!
I'm facing a problem here that is getting me crazy!
I have an INDICATOR that works on the last close price (like Close[1]), and everything is functioning perfectly, either with TESTER or using real-time charts. I have no problem at all changing Timeframe and so forth.
The problem: if I close the Terminal with the Indicator loaded (it uses either the MAIN chart as a specific chart window), when I call again Metatrader5 it:
First I will show the normal screen:
And now, what appears in the Terminal when I close the terminal and load it again:
I'm aware of the "Prev_Calculated" index, and as I said before, the problem occurs ONLY in that specific situation: when I close META and open it again. For all other cases, the indicator works normally.
Follows, which I understand to be the relevant pieces of code:
And the OnCalculate event:
Important to say again: the same ARRAYS which the PANEL values are based, are the arrays utilized as BUFFERS for the lines.
What am I missing here?
I appreciate any help on it.