Ask Price from Three Seconds Ago with MQ4

 

Using MQ4, how how can I get the ask price of a pair from three seconds ago?

 This does NOT work:

price_3_seconds_ago = MarketInfo(pair, MODE_BID, -3); 
 
hknight:

Using MQ4, how how can I get the ask price of a pair from three seconds ago?

 This does NOT work:

You cannot !  unless you save all the Ask prices with datetie stamps.  Then you can find the Ask price if you have the value just before and after 3 seconds ago.


Using MarketInfo and asking for BID price will never get you an Ask price . . . unless there is zero Spread. 

 

Of course it doesn't work. Did you bother to read the documentation? Where did you come to think that marketInfo takes three parameters?

You can ONLY get the H, L, O, C of the current or previous bars.

If you want a price seconds ago, YOU must remember the CURRENT value and wait.

Reason: