A bit confusing thread title, but i could not define it better, sorry for that.
The question is:
1. I have a bid/ask price (actual or historic)
2. I want to find out (using mql4 or mql5 code) whether this price was reached by dropping by X amount of pips or by raising by X amount of pips.
If my X is 10 pips and EUR/USD is traded at 1,2154 now.
Has this price arrived to this level after dropping from 1,2164 or after gaining from 1,2144? In another words, when this price was taken(1,2154), which price is closer, 1,2164 or 1,2144 ?
Yes, it is confusing! And your text is confusing too!
If you take the current ask/bid price, you simply look at the previous tick ask/bid and you can calculate by how much the price has increased or decreased, both at the ask level or bid level. It can even be a combination of one price increasing while the other decreasing, or you can simple look at the mid price instead.
Is that what you are asking?
If you are asking how to this in MQL code, then the easiest and simplest way that will work on both MQL4 and MQL5, is simply to save the current Bid & Ask prices on every call to OnTick() event handler, and on the next tick event, simply compare the current to the previous prices, and repeat the process.
In MQL5 however, you can run over the tick history (using for example "CopyTicks()" and do something similar over the entire history data.
Alright, i will have to iterate then and once 10 pip difference is caught, that will be the answer.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.