How can I validate ASK price before sending order in case of Old Tick?

 

I have an EA based partly on a martingale system. The issue I have seen whilst testing on some platforms, e.g. ICMarkets is that orders can be triggered incorrectly on receipt of an "Old Tick".

Here is an example from a debug comment I placed in the code:



As you can see here the Ask is completely incorrect for EURUSD, yet this is what was returned by:

double ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);

A Buy order is then triggered (by the EA) because mathematically 0.00219 is less than 1.07174 by more than then the martingale threshold set (100 pips).

I have been thinking of how to solve this issue, as I cant guarantee that I wont see Old Ticks in the future. The problem is usually reflected in the journal in one of 2 ways:

(1) 

(2) 

The Old Ticks are the most common variant, but occassionally I see the "future price" or "old last price" issue.

Anyway my code that triggers an order looks like this:

To get round the issue, I would ideally like to extract the description from the tick to identify it as a case of "Old Tick", "Future Price" or "Old Last Price". But I dont see how you can access this information, it does not seem to be retrievable from Tick data, there is no description or Comment associated with an MqlTick struct (that I am aware of anyway), we get the following only:

So I can only work with the above to try to identify whether my tick is valid. I thought above storing the last valid tick and comparing each new tick to see if it is within a certain range of the previous good tick, but that assumes you can identify an initial valid tick; if the program starts and immediately receives invalid ticks, you have no reference tick to compare too! 

The "time" property would seem to be the most logical other field to help identify a problem if this provides a Date that is not, say within, certain parameters.

I must admit on perusing the forums I have not seen any definitive answer to this issue, although most discussions on the topic of "Old Ticks" seem to refer to old versions of MT4, it still seems to be a problem. 

Has anyone got a standard, tried and tested workaround for the issue ? 

Tony