[R-SIG-Finance] R and Metatrader

Bernd Kreuss prof7bit at googlemail.com
Sun Oct 24 10:02:55 CEST 2010



yoda55 wrote:
> 
> 
> Has anyone ever tried to connect R to MetaTrader (MT4 or MT5)?
> 

For the sake of completeness I must point you to this:
http://www.forexfactory.com/showthread.php?t=260422

It does not require to run any kind of server in R or needs any packages
installed. It will start Rterm.exe as a background process and communicate
with its command line via stdin/stdout. It defines a bunch of functions that
let you assign strings, numbers, vectors and matrices to R variables, lets
you execute arbitrary R code with a synchronous (blocking) function call and
get the results back into MQL4 variables (vectors into arrays)). It has also
functions to execute code asynchronously without waiting for it (and then
poll for its completion during the following ticks) to make it possible to
write MT4 indicators which do not allow long running or blocking tasks.

The DLL itself (full source code is available) is written in Object Pascal
(FPC) and the TRConsole class which wraps the Rterm process can also
separately be used for your own projects, it does not rely on any windows
specific API so it is easily usable with no or only minimal modifications
for Linux and Mac applications too.

Bernd

-- 
View this message in context: http://r.789695.n4.nabble.com/R-and-Metatrader-tp1693168p3009005.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list