MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading Language Documentation

Automata-Based Programming as a New Approach to Creating Automated Trading Systems Automata-Based Programming as a New Approach to Creating... TrailingStop DemoTrailingStop Demo Try product
TrailingStop Demo
Author: dupter
Subscribe to signal
Torisoft
45.39%, 1 453.90 USD
Screenshot
EURUSD, M5
Demo
IncMFIOnArray Library
IncMFIOnArray
Author: Integer

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.

Example:

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());
//---
  }

See also

Structures and Classes


Updated: 2010.08.05