Help noob with arrays
- Arr[i] = aValue; not arr[n] = { value, value, value...};
- type Arr[n] = { const1, const2, ...}; or simply type Arr = { const1, const2, ...}; can not use non-constant values to initialize a new array.
- Don't try to use any price or server related functions in
OnInit (or on load,) as there may be no connection/chart yet:
- Terminal starts.
- Indicators/EAs are loaded. Static and globally declared variables are initialized. (Do not depend on a specific order.)
- OnInit is called.
- For indicators OnCalculate is called with any existing history.
- Human may have to enter password, connection to server begins.
- New history is received, OnCalculate called again.
- New tick is received, OnCalculate/OnTick is called. Now TickValue, TimeCurrent and prices are valid.
Thanks all. I'll work on a replacement code and display for comment
Robert Browne:
Thanks all. I'll work on a replacement code and display for comment
Thanks all. I'll work on a replacement code and display for comment
DRY :)
So I'm making my first effort into using arrays.
I'm simply trying to store close price at certain times to retrieve later in my code. Is this code going to achieve the desired result or have I ballzed up completely.