Research in matrix packages

 
It is possible to get history and real-time feed (+ trade) directly from R. History: OHLC (up to seconds) + ticks + Level2.

Manual. I think it may be relevant at least as an updated online DB for custom feeds in MT5.

But I want to master not only MQL, but also mathematical packages. For example, look how quickly and easily calculate the average spread of the last seven days:
ticks<-ttFeed.TickBestHistory("EURUSD", Sys.Date()-7, Sys.Date())
mean(ticks$ask - ticks$bid)

Result:

2.987979 e-05
Just two lines! There's no need to think about downloading fresh tick history, looping and so on. Everything is done by itself!

Unfortunately, I know practically nothing in R. I would like examples of visualization of the same price. To see the spread distribution and other simple "on the fly" actions, which in R take one/two lines.

And I'm not even speaking about testers variants (with possibility to choose optimization model (not only GA)) in R.

The same applies to Matlab with Mathematics. If anyone is friendly, please share simple and illustrative examples.
 
zaskok3:
It is possible to get history and real-time feed (+ trade) directly from R. History: OHLC (down to seconds) + ticks + Level2.

Manual. I think it may be relevant at least as an updated online DB for custom feeds in MT5.

But I want to master not only MQL, but also mathematical packages. For example, look how quickly and easily calculate the average spread of the last seven days:

Result:

Just two lines! There's no need to think about downloading fresh tick history, looping and so on. Everything is done by itself!

Unfortunately, I know practically nothing in R. I would like examples of visualization of the same price. To see the spread distribution and other simple "on the fly" actions, which in R take one/two lines.

And I'm not even speaking about testers variants (with possibility to choose optimization model (not only GA)) in R.

The same applies to Matlab with Mathematics. If anyone is friendly, please share simple and illustrative examples.

I've been working with Matlab for a long time, a week ago I installed R, I'm slowly learning it. I don't know about R, but Matlab has a handy feature - if you write a program as a function, you can easily put it in a DLL, which you can then call in the usual way from MQL.

For MQL4, you need to have a 32-bit version of Matlab. By the way, the latest version 2015b wrote that there will be no more support for 32-bit systems, this is the last version that supports it.

 

Incidentally, Microsoft is also interested in R, with the official announcement of Microsoft R Open in January 2016

https://habrahabr.ru/post/275113/

Revolution R переименован в Microsoft R и доступен бесплатно для разработчиков и студентов
Revolution R переименован в Microsoft R и доступен бесплатно для разработчиков и студентов
  • habrahabr.ru
За девять месяцев, с тех пор как Microsoft приобрела Revolution Analytics, компанией было выпущено много обновлений для Revolution R Open и Revolution R Enterprise, не говоря уже об интеграции R с SQL Server, PowerBI, Azure и Cortana Analytics. Американская компания Revolution Analytics является производителем программного обеспечения для...
 
Someone searches for tick history, collects it in different places, tortures CopyTicks, etc. And someone writes just two lines.


Write to a tick historyfile for yesterday's day (similarly done for any interval):

ticks<-ttFeed.TickBestHistory("EURUSD", Sys.Date()-1, Sys.Date())
write.table(ticks, file='ticks.csv', row.names=F)
The result is in attached file.
Files:
ticks.zip  713 kb
 

S1 timeframe bids bars over the last 300 seconds:

now <-as.POSIXct(Sys.time())  
prevNow <-as.POSIXct(now-(300))  
bars <-ttFeed.BarHistory("EUR/USD", "Bid", "S1", prevNow, now)
write.table(bars, file='bars.csv', row.names=F)
The result is in the attached file.
Files:
bars.zip  4 kb
 
zaskok3:
Someone searches for tick history, collects it in different places, tortures CopyTicks, etc. And someone writes just two lines.


Write to a tick historyfile for yesterday's day (similarly done for any interval):

The result is in attached file.
And where does this story come from?
 
Alexey Volchanskiy:
Where does the story come from?
From one ECN/STP with the ability to trade via MT4 in particular.
 
zaskok3:
It is possible to get history and real-time feed (+ trade) directly from R. History: OHLC (up to seconds) + ticks + Level2.

Manual. I think it's useful at least as an updated online DB for custom feeds in MT5.

But I want to master not only MQL, but also mathematical packages. For example, look how quickly and easily calculate the average spread of the last seven days:

Result:

Just two lines! There's no need to think about downloading fresh tick history, looping and so on. Everything is done by itself!

Unfortunately, I know practically nothing in R. I'd like examples of visualization of the same price. To see the spread distribution and other simple "on the fly" actions, which in R take one/two lines.

And I'm not even speaking about testers variants (with possibility to choose optimization model (not only GA)) in R.

The same applies to Matlab with Mathematics. If anyone is friendly, please share simple and illustrative examples.
Tomorrow I'll post a couple of useful codes on the subject.
 
Alexey Burnakov:
Tomorrow I'll post a couple of useful codes on the subject.

By the way, if there are any people who know R, a beginner's question. I see that there are several R distributions, R-server, some "A web application framework for R" http://shiny.rstudio.com/ , monster packages from Microsoft... What to choose?

A web application framework for R
.
 
Alexey Volchanskiy:

By the way, if there are any people who know R, a beginner's question. I see that there are several R distributions, R-server, some "A web application framework for R" http://shiny.rstudio.com/ , monster packages from Microsoft... What to choose?

A web application framework for R
.

Hello. First install R: https://cran.r-project.org/bin/windows/base/

Optionally you can install R Studio: https://www.rstudio.com/products/rstudio/download/

Studio is much more convenient to work with.

 
Alexey Burnakov:
I'll post a couple of useful codes on this topic tomorrow.

Basic graphs:

#  time series

plot(lateral_residuals$`lateral_linear_model$residuals`, type = 'l')

#  histogram

hist(lateral_residuals$`lateral_linear_model$residuals`)

#scatterplot

 plot(x$V1, x$V2)

#two  or more semitransparent histograms of distribution

a=rnorm(1000, 3, 1)
b=rnorm(1000, 6, 1)
hist(a, xlim=c(0,10), col="red")
hist(b, add=T, col=rgb(0, 1, 0, 0.5) )
# histogram with density

library(ggplot2)
ggplot(combined_residuals, aes(x = combined_residuals$'value', fill = combined_residuals$'group')) +
        geom_histogram(alpha = .5, binwidth = 0.05) +
        geom_density(alpha = .3, col = 'blue') + xlim(-3, 3)

#  boxplots

library(ggplot2)

ggplot(a_sample, aes(x = x$V1))+ 
        geom_boxplot()

ggplot examples: http://www.mitchr.me/SS/exampleR/rcode/ggplot.html

Reason: