Structure for Current Prices
返回当前价格的结构(MqlTick)
这是一个用于存储符号最新价格的结构。它旨在快速获取关于当前价格的最常用信息。
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
};MqlTick类型的变量允许在调用SymbolInfoTick()函数时获取Ask、Bid、Last和Volume的值。
示例:
void OnTick()
{
MqlTick last_tick;
//---
if(SymbolInfoTick(Symbol(),last_tick))
{
Print(last_tick.time,": Bid = ",last_tick.bid,
" Ask = ",last_tick.ask," Volume = ",last_tick.volume);
}
else Print("SymbolInfoTick() failed, error = ",GetLastError());
//---
}另请参阅
最后更新于