MqlTick Structure
Overview
The MqlTick structure is designed for storing the latest prices of a trading symbol. It facilitates fast retrieval of essential current price information.
Fields
time (datetime): Timestamp of the last price update.bid (double): Current Bid price.ask (double): Current Ask price.last (double): Price of the last executed trade.volume (ulong): Volume associated with the last trade price.Usage
Variables of type MqlTick can be used to retrieve Ask, Bid, Last, and Volume values in a single call to the SymbolInfoTick() function.
Example
void OnTick()
{
MqlTick last_tick;
if(SymbolInfoTick(Symbol(), last_tick))
{
Print("Time: ", last_tick.time, ": Bid = ", last_tick.bid, " Ask = ", last_tick.ask, " Volume = ", last_tick.volume);
}
else
{
Print("SymbolInfoTick() failed, error = ", GetLastError());
}
}