MT5.Quick_GetSymbol: Load data quickly from MT5

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/Source_MT5.R

Description

Function to load sSymbol in Data.frame or xts if specified. All the data come from socket. It's pretty quickly function to obtain data.

Data is loaded silently and will take longer as defined iRow is.

Usage

1
MT5.Quick_GetSymbol(sSymbol, iTF, iRows = 5, xts = FALSE)

Arguments

sSymbol

character; target symbol.

iTF

int; target time frame. See details.

xts

bool; if xts = TRUE the function will return a xts instead. See details.

iRow

int; how many rows. It's start from last. (default: 5)

Details

It should be used only for tiny table sizes. For big size tables consider to use MT5.GetSymbol() instead.

Supported time frames (iTF). See references for even more details.

Value

Always returns OHCLV format. Date will be exhibited as it xts parameter is defined.

xts = FALSE (default)

Returns [nx10] {data.frame} {Year, Month, Day, Hour, Minute, Open, High, Low, Close, Volume}

xts = TRUE

Returns [nx5] {xts} {Open, High, Low, Close, Volume}

On failure attempts it will return a empty data.frame.

Author(s)

Guilherme Kinzel, guikinzel@gmail.com

References

https://en.wikipedia.org/wiki/Open-high-low-close_chart

https://www.mql5.com/en/docs/constants/chartconstants/enum_timeframes

See Also

MT5.GetSymbol(), MT5.QuickLastRow_GetSymbol()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 

MT5.Quick_GetSymbol("EURUSD", iTF = 5, iRows = 3)

## Returns
##   Year Month Day Hour Minute    Open    High     Low   Close Volume
## 1 2020    12  11    1      5 1.21411 1.21414 1.21405 1.21409     39
## 2 2020    12  11    1     10 1.21408 1.21419 1.21404 1.21418     56
## 3 2020    12  11    1     15 1.21421 1.21421 1.21405 1.21408     63

MT5.Quick_GetSymbol("EURUSD", iTF = 5, iRows = 3, xts = TRUE)

## Returns
##                        Open    High     Low   Close Volume
## 2020-12-11 01:05:00 1.21411 1.21414 1.21405 1.21409     39
## 2020-12-11 01:10:00 1.21408 1.21419 1.21404 1.21418     56
## 2020-12-11 01:15:00 1.21421 1.21421 1.21405 1.21415     82


## End(Not run)

Kinzel/mt5r documentation built on March 25, 2021, 9:57 p.m.