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.

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)

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.

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.

  • 1: PERIOD_M1

  • 2: PERIOD_M2

  • 5: PERIOD_M5

  • 15: PERIOD_M15

  • 30: PERIOD_M30

  • 60: PERIOD_H1

  • 120: PERIOD_H2

  • 240: PERIOD_H4

  • 480: PERIOD_H8

  • 1440: PERIOD_D1

  • 7200: PERIOD_W1

  • 216000: PERIOD_MN1

References

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

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

See also

Examples

if (FALSE) { 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 }