Bayesian regression - Has anyone made an EA using this algorithm? - page 53

 
Yuriy Asaulenko:

C R's problem is that I don't know him. :) It's a matter of time, slowly getting the hang of it.

The more difficult one is to provide real-time data exchange between R - software - MT5. I can't think of anything clever except files. I suppose that they will do for starters and then we will see.

But I do not see the exchange protocol (interface) yet.

We have a R-MT4 connection. It has been working for a long time. It is written in Pascal, there is a source code.
 
СанСаныч Фоменко:
There is a R-MT4 bundle. It has been working for a long time. It is written in Pascal and there is a source code.

I don't write in Pascal (it was a long time ago), but I'm getting the hang of it. I would be grateful. I'll send you my mail in person.

I've started to look at the Pipes for exchange with MT, while I'm reading the docs.

In CRAN(section - Other) and onet have seen COM-DLLs for R (section - Other). Haven't looked at them yet.

It seems so far:

MT - decision processing software - R.

 
Yuriy Asaulenko:

I don't write in Pascal (it was a long time ago), but I'm getting the hang of it. I would be grateful. I'll send you my mail in person.

I've started to look at the Pipes for exchange with MT, while I'm reading the docs.

In CRAN(section - Other) and onet have seen COM-DLLs for R (section - Other). Haven't looked at them yet.

So far it looks like this:

MT - Decision Processing Software - R.

I posted this, it's someone else's, just moved it to the kodobase

https://www.mql5.com/ru/code/10684

And this is an example.

https://www.mql5.com/ru/code/10718

There is also one in VLAD, which has a more complicated scheme, but more promising.

R-only decision making is extremely powerful: both R itself and its packages. R code is extremely compact and very efficient for computationally complex algorithms.

Another nuance of R.

R is an interpreter but the kernel that interprets R strings is in C, the interfaces to which are well documented. Furthermore, there are packages for communicating with C. One solution: add code to the R kernel which interfaces with MT.

 
СанСаныч Фоменко:

R-only decision making is extremely powerful: both R itself and its packages. R code is extremely compact and for computationally complex algorithms very efficient.

Another nuance of R.

R is an interpreter but the kernel that interprets R strings is in C, the interfaces to which are well documented. Furthermore, there are packages for communicating with C. One solution: add code to the R kernel which interacts with MT.

This is understandable. However, the integration and interaction of R and C/C++ applications is really well described, e.g. in Rcpp and RInside packages, etc.. That is, a C++ application interacts with an R kernel.

But how to add code to R kernel? - You have to develop your own package for R with linkage to MT and other? ? It is, imho, more complicated than R to assign complex mathematics, get results and make a decision in the application.

Anyway, I can't imagine.

 
Yuriy Asaulenko:

This is understandable. However, the integration and interaction of R and C/C++ applications is really well described, e.g. in Rcpp and RInside packages, etc. That is, a C++ application interacts with an R kernel.

But how to add code to R kernel? - You have to develop your own package for R with linkage to MT and other? ? It is more complicated, imho, than R to do complicated maths, get results and make decisions in the application.

Anyway, no idea.

What kind of book is this? Writing R Extensions.

The link is right in the R help.

 
СанСаныч Фоменко:

What kind of book is this? Writing R Extensions

The link is right in the R help

is all about either making your own packages or interacting with them. :) - Writing R Extensions covers how to create your own packages, write R help files, and the foreign language (C, C++, Fortran, ...) interfaces.

So far, I prefer - the foreign language (C, C++, Fortran, ...) interfaces. I've already tried it - in C/C++/C# new data types appear from R and address the kernel via DLL. Seems like the functionality of packages is called directly from the program. It seems to me that the interaction types are very close, only in the latter case there is no need to make it out as a package. By the way, R itself recommends to write complex functionality within scripts in C/C++/F even without packaging it as a package (except I don't know if it works under UNIX, where the compiler is built into the OS).

 
Yuriy Asaulenko:

Exactly about - either prepare your packages or interact. :) - Writing R Extensions covers how to create your own packages, write R help files, and the foreign language (C, C++, Fortran, ...) interfaces.

So far, I prefer - the foreign language (C, C++, Fortran, ...) interfaces. I've already tried it - in C/C++/C# new data types appear from R and address the kernel via DLL. Seems like the functionality of packages is called directly from the program. It seems to me that the interaction types are very close, only in the latter case there is no need to make it out as a package. By the way, R itself recommends to write complex functionality within scripts in C/C++/F even without packaging it as a package (except I don't know if it works under UNIX, where the compiler is built into the OS).

Unfortunately my knowledge in this field is extremely limited.

Good luck. I sincerely wish you results.

 
СанСаныч Фоменко:

Unfortunately my knowledge in this area is extremely limited.

Good luck. I sincerely wish you results.

Thank you.

I understood the general interaction with R. I have mastered the simplest functionality. What's next, I don't know what to do. I have absolutely no idea what to do with packets either.

So far I need correlation and autocorrelation functions and polynomial regression . I can't get my bearings, I can't find them. Where to look for them?

 
Yuriy Asaulenko:

Thank you.

The interaction with R is generally sorted out. I have mastered the simplest functionality. But I don't know what to do next. I have absolutely no idea what to do with packets either.

So far I need correlation and autocorrelation functions and polynomial regression . I can't get my bearings, I can't find them. Where to look for them?

?var()

?cov()

?cor() 

The simplest autocorrelation:

x <- rnorm(1000, 0, 1)
cor(x[1:999], x[2:1000])

built-in function:

acf(x, lag.max = NULL,
    type = c("correlation", "covariance", "partial"),
    plot = TRUE, na.action = na.fail, demean = TRUE, ...)

pacf(x, lag.max, plot, na.action, ...)

In R for fitting a polynomial regression model (not orthogonal), there are two methods, among them identical. Suppose we seek the values of beta coefficients for a polynomial of degree 1, then 2 nd degree, and 3 rd degree:


fit1 <- lm(sample1$Population ~ sample1$Year)
fit2 <- lm(sample1$Population ~ sample1$Year + I(sample1$Year^2))
fit3 <- lm(sample1$Population ~ sample1$Year + I(sample1$Year^2) + I(sample1$Year^3))

these functions go in the base.

 

You can try searching for packages by keywords in the list of all packages:https://cran.r-project.org/web/packages/available_packages_by_name.html

These packages are divided into groups and if you know which group your application belongs to, it might be easier to look for packages in the/go?link=https://cran.r-project.org/web/views/ group.

Many other packages contain good examples of how to use the manuals and added pdf's

CRAN Packages By Name
  • cran.r-project.org
The package will formally test two curves represented by discrete data sets to be statistically equal or not when the errors of the two curves were assumed either equal or not using the tube formula to calculate the tail probabilities