Programatic MQL4 access to ticks in the TickChart window

 

If I right click on a symbol I can view a tick chart. it shows the past 100 ticks or so.

Is there any way to get programmatic access using MQL4 to this short history of ticks? I'm guessing not as I can't find anything on the forum about it, but I thought someone may have a trick up their sleeve that I hadn't thought of.

Stewart

 
As far as I know . . . if you want access to any tick history you have to build it yourself as you go . . record each tick as it happens.
 
stewart:

If I right click on a symbol I can view a tick chart. it shows the past 100 ticks or so.

Is there any way to get programmatic access using MQL4 to this short history of ticks? I'm guessing not as I can't find anything on the forum about it, but I thought someone may have a trick up their sleeve that I hadn't thought of.

Stewart

Well, if you want to look back over the last 100 ticks all you need is an array of say 110 doubles and you use it as a circular buffer. Of course you could just shift the 100 values up on every new point but that is programatically ugly (uses up computer power needlessly). Certainly a modern machine could handle a 100 point array without problems but if you went to 10,000 points then a circular buffer would definitely be needed.

Basically this consists of a function which you call to either get or set the value. It's not difficult if you are a reasonable programmer. If you are a beginner then maybe just shuffle the values down the buffer but use the same sort of interface, perhaps like this ...

#define MODE_SET 123456
#define MODE_GET 132637
#define TICK_ARRAY_LENGTH  200
double tickArray[TICK_ARRAY_LENGTH];

// function prototype
double TickArray(double price, int mode, int index=0);
Reason: