Im trying to get access to the dynamic array's elements as timeseries but I have no Idea what is wrong with my method, it just doesn't work and no amount of searching helped me.
After I store values into the array for each bar that EA process, I want to read the last added element using index 0 . so I tried this:
now I'm expecting catalog[0] gives me the latest added value but it gives me the first one. I tried different variations with ArraySetAsSeries() placed after value assignment and it
didn't work either. Im really puzzled and would appreciate any suggestions.
Oh right.. thank you very much Sir. I have a vague memory of reading something along the line that "ArraySetAsSeries() only changes the getting method and not the setting method"
too much reading scrambled my memory I guess.
Just in case someone else might find this useful, here's how I managed to work the problem:
// declaring global variable string catalog[]; void OnTick() { // first we set the array as non-series ArraySetAsSeries(catalog, false); int last = ArraySize(catalog); ArrayResize(catalog, last + 1); catalog[last] = "some incremented string value"; // now we can set the array as series ArraySetAsSeries(catalog, true); // this gives us the last added element Comment(catalog[0]); }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Im trying to get access to the dynamic array's elements as timeseries but I have no Idea what is wrong with my method, it just doesn't work and no amount of searching helped me.
After I store values into the array for each bar that EA process, I want to read the last added element using index 0 . so I tried this:
now I'm expecting catalog[0] gives me the latest added value but it gives me the first one. I tried different variations with ArraySetAsSeries() placed after value assignment and it
didn't work either. Im really puzzled and would appreciate any suggestions.