- initialize
- login
- shutdown
- version
- last_error
- account_info
- terminal_info
- symbols_total
- symbols_get
- symbol_info
- symbol_info_tick
- symbol_select
- market_book_add
- market_book_get
- market_book_release
- copy_rates_from
- copy_rates_from_pos
- copy_rates_range
- copy_ticks_from
- copy_ticks_range
- orders_total
- orders_get
- order_calc_margin
- order_calc_profit
- order_check
- order_send
- positions_total
- positions_get
- history_orders_total
- history_orders_get
- history_deals_total
- history_deals_get
copy_ticks_from
Get ticks from the MetaTrader 5 terminal starting from the specified date.
copy_ticks_from(
|
Parameters
symbol
[in] Financial instrument name, for example, "EURUSD". Required unnamed parameter.
from
[in] Date the ticks are requested from. Set by the 'datetime' object or as a number of seconds elapsed since 1970.01.01. Required unnamed parameter.
count
[in] Number of ticks to receive. Required unnamed parameter.
flags
[in] A flag to define the type of the requested ticks. COPY_TICKS_INFO – ticks with Bid and/or Ask changes, COPY_TICKS_TRADE – ticks with changes in Last and Volume, COPY_TICKS_ALL – all ticks. Flag values are described in the COPY_TICKS enumeration. Required unnamed parameter.
Return Value
Returns ticks as the numpy array with the named time, bid, ask, last and flags columns. The 'flags' value can be a combination of flags from the TICK_FLAG enumeration. Return None in case of an error. The info on the error can be obtained using last_error().
Note
See the CopyTicks function for more information.
When creating the 'datetime' object, Python uses the local time zone, while MetaTrader 5 stores tick and bar open time in UTC time zone (without the shift). Therefore, 'datetime' should be created in UTC time for executing functions that use time. Data received from the MetaTrader 5 terminal has UTC time.
COPY_TICKS defines the types of ticks that can be requested using the copy_ticks_from() and copy_ticks_range() functions.
ID |
Description |
---|---|
COPY_TICKS_ALL |
all ticks |
COPY_TICKS_INFO |
ticks containing Bid and/or Ask price changes |
COPY_TICKS_TRADE |
ticks containing Last and/or Volume price changes |
TICK_FLAG defines possible flags for ticks. These flags are used to describe ticks obtained by the copy_ticks_from() and copy_ticks_range() functions.
ID |
Description |
---|---|
TICK_FLAG_BID |
Bid price changed |
TICK_FLAG_ASK |
Ask price changed |
TICK_FLAG_LAST |
Last price changed |
TICK_FLAG_VOLUME |
Volume changed |
TICK_FLAG_BUY |
last Buy price changed |
TICK_FLAG_SELL |
last Sell price changed |
Example:
from datetime import datetime
|
See also
CopyRates, copy_rates_from_pos, copy_rates_range, copy_ticks_from, copy_ticks_range