- Do not store as-series indexes. When a new bar start they are now all wrong. You can store the candle time and find the candle. Or you can store a non-series index and convert back.
#define SERIES(I) (Bars - 1 - I) // As-series to non-series or back.
-
Help you with what? You haven't stated a problem, or a vague want. All you've done is stated a vague possible solution to an unstated problem.
-
Your posted code doesn't have an array. What's the problem?
-
Your “goal is to look up a candle number?” Index of what?
How To Ask Questions The Smart Way. 2004
Be precise and informative about your problem
- Do not store as-series indexes. When a new bar start they are now all wrong. You can store the candle time and find the candle. Or you can store a non-series index and convert back.
-
Help you with what? You haven't stated a problem, or a vague want. All you've done is stated a vague possible solution to an unstated problem.
-
Your posted code doesn't have an array. What's the problem?
-
Your “goal is to look up a candle number?” Index of what?
How To Ask Questions The Smart Way. 2004
Be precise and informative about your problem

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'd like to add to the indexes of an array with a loop. I'm new to coding (not just mql4) so I'm not sure this is the best way to do this at all. What my goal is, is to use an array to look up a candle number. I'm counting every time the MACD line crosses over and counting those "events". I'm also noting the candle number for each of those events. So, every time there is a crossover I'll send an alert that says on cross up 3 we are on candle 34 (just for example, it's something like that). My current code is below. For example, it's not in the code but I'd like to be able to say "myArray[3]" and it will equal 34 (as per the example I'm using). I hope I'm making sense.
Any thoughts or suggestions?