MQL4 Reference Constants, Enumerations and Structures Data Structures Structure for Current Prices

MQL4 Help as One File:

The Structure for Returning Current Prices (MqlTick)

This is a structure for storing the latest prices of the symbol. It is designed for fast retrieval of the most requested information about current prices.

struct MqlTick
   datetime     time;          // Time of the last prices update
   double       bid;           // Current Bid price
   double       ask;           // Current Ask price
   double       last;          // Price of the last deal (Last)
   ulong        volume;        // Volume for the current Last price

The variable of the MqlTick type allows obtaining values of Ask, Bid, Last and Volume within a  single call of the SymbolInfoTick() function.


void OnTick()
   MqlTick last_tick;
      Print(last_tick.time,": Bid = ",,
            " Ask = ",last_tick.ask,"  Volume = ",last_tick.volume);
   else Print("SymbolInfoTick() failed, error = ",GetLastError());

See also

Structures and Classes