Iexperienced some very unpleasant problems: I noticed that somepositions were opened by one of my strategy when that should nothappen. I investigated and I was surprised to learn that, sometimes,the values used by the strategies (quotation or indicators) were notcorrect! And I am talking about a real account!
Ican not say if that is due to the internet connection or because ofsome problems in the server of the broker. But it is happening moreoften than you imagine!
Theattached script can be introduced/adapted in any strategy exceptthose running on tick charts. It will solve most of the problems!
Thebasic idea is to read twice the required values, at a reasonable timeinterval (fraction of a second). If the two readings are identical,we can assume they are correct and we can use those values in ourstrategy.
Bypersonal experience I can tell that may not be enough in some cases.That is why, a second check may consist in comparing the value on thelast candle with the one on the previous one and validate the newvalue only the difference is reasonable.
Youmay use the attached script as it is, just to check if you have sucha problem but you did not noticed it! (It will only put in the loginformation about how often problems appear.)