MT5CopyTicksRange {MetaTrader}R Documentation

Get ticks from the specified period

Description

Gets the specified number of ticks of a financial instrument from within the specified period.

Usage

  MT5CopyTicksRange(symbol, from, to, flags)

Arguments

symbol

symbol name, for example "EURUSD"

from

the date, from which you want to request ticks specified in seconds since 1970.01.01

to

the date, up to which you want to request ticks specified in seconds since 1970.01.01

flags

a flag to define the type of the requested ticks, specified as a value of the MT5_COPY_TICKS enumeration

Details

For additional information, see https://www.mql5.com/en/docs/series/copyticks

Value

Returns a matrix with tick values:

time Time of the last price change specified in milliseconds since 1970.01.01
bid Bid price
ask Ask price
last Price of the last deal
volume Volume of the last deal
flags Tick flags specified as values of the MT5_TICK_FLAG enumeration
                 time     bid     ask last volume flags
    [1,] 1.548634e+12 0.71748 0.71784    0      0   134
    [2,] 1.548634e+12 0.71749 0.71784    0      0   130
    [3,] 1.548634e+12 0.71764 0.71802    0      0   134
    [4,] 1.548634e+12 0.71766 0.71804    0      0   134
    [5,] 1.548634e+12 0.71778 0.71816    0      0   134
  

Examples

  # start MetaTrader 5 Terminal (you should have it installed), call on first request only
  MT5Initialize()
  # wait for connection with broker server, call on first request only
  MT5WaitForTerminal()
  # get data
  MT5CopyTicksRange("AUDUSD", as.POSIXct("2019-01-27 13:00:00"),
    as.POSIXct("2019-01-28 13:01:00"), MT5_COPY_TICKS_ALL)

[Package MetaTrader version 5.0.0 Index]