Custom Timeseries Insertion and Manipulation in MQL5

 

Hi there,

I am new in all this and while writing an EA, I need to have my own timeseries that I can store some data as history to refer to later in the code.

Lets say I have something like this:

// some global variables
int direction = 0;
int directionHistory[];
.
.
// Inside OnInit()
   ArraySetAsSeries(directionHistory, true);
.
.
// Inside OnTick()
   direction = getNewDirection();
   directionHistory.Push(direction);
   ArrayPrint(directionHistory)

Is this the correct way to add elements to the timeseries?

The print has some garbage data in it!


Thanks,

Reza

 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893