Libraries: mt4R for new MQL4 - page 4

 
282253055:
RAssignVector(rhandle, "foo", vecfoo, ArraySize(vecfoo));
RExecute(rhandle, "baz <- foo * 42");
k = RGetVector(rhandle, "baz", vecbaz, ArraySize(vecbaz));

RExecute(rhandle, "write.table(baz, ""c:/docs/mtest.csv"")");

in your test file when i add a read or write file it does not work. but in R works fine.


The 2nd argument to RExecute is incorrect.

Please fix as

RExecute(rhandle, "write.table(baz, \"c:/docs/mtest.csv\")");

or

RExecute(rhandle, "write.table(baz, 'c:/docs/mtest.csv')");


I've confirmed that both are good with R 3.0.2.

 
282253055:
RAssignVector(rhandle, "foo", vecfoo, ArraySize(vecfoo));
RExecute(rhandle, "baz <- foo * 42");
k = RGetVector(rhandle, "baz", vecbaz, ArraySize(vecbaz));

RExecute(rhandle, "write.table(baz, ""c:/docs/mtest.csv"")");

in your test file when i add a read or write file it does not work. but in R works fine.


The 2nd argument to RExecute is incorrect.

Please fix as

RExecute(rhandle, "write.table(baz, \"c:/docs/mtest.csv\")");

or

RExecute(rhandle, "write.table(baz, 'c:/docs/mtest.csv')");


I've confirmed that both are good with R 3.0.2.

 
Good, thanks.
 
Good, thanks.
 

Hi,

Thanks in advance.

This is Deb.

I am new to mt4 and as well as to mt4R. I need your assistance to start with.

I am currently using R-3.1.2 on Windows 8. I've installed metatrader 4 (mt4).

I am looking for some steps to install mt4R and a workout example(s). It is good gave a little document.

Once again, thank you very much for the time you have given.

Regards,

Deb

 
Hello,

I am currently testing this system? Does it burn your account in long term or does it work?

I would like to know if someone has the same problem as me

The R graphics popup and close 1 sec later, how can i fix this problem?

Thanks for helping

Have a good day
 

Hey all,  I am just starting, total noob with mql4, a bit more familiar with R. I have a few questions:


1. After downloading the right files for the new mt4 new version (here: https://github.com/micclly/mt4R), I can now compile mt4R.mqh, mt4Test.mq4 and the two indicators without problem. But when I try to attach the script mt4rTest.mq4 to a chart, this is what DebugView messages. (Maybe because we are saturday?) I am worried about the line
Quote
[2204] Invalid parameter passed to C runtime function.
. Can you please check if this output is normal?
Quote
[1576] installed exception handler for C:\Users\ASUS UX32L\AppData\Roaming\MetaQuotes\Te rminal\50CA3DFB510CC5A8F28B48D1BF2A 5702\MQL4\Libraries\mt4R.dll
[1576] <2> Create: trying to start R: C:/Program Files/R/R-3.2.1/bin/x64/Rterm.exe --no-save
[2204] Invalid parameter passed to C runtime function.
[1576] <2> ExecuteCode: in >>> options(digits=15)
[1576] <2> ExecuteCode: out <<<
[1576] <2> Create: R successfully started
[1576] RInit: RHandle = 6EDF95C (116259164)
[1576] <2> ExecuteCode: in >>> foo <- c(0, 1.25, 2.5, 3.75, 5)
[1576] <2> ExecuteCode: out <<<
[1576] <2> ExecuteCode: in >>> baz <- foo * 42
[1576] <2> ExecuteCode: out <<<
[1576] <2> ExecuteCode: in >>> as.vector(baz)
[1576] <2> ExecuteCode: out <<< [1] 0.0 52.5 105.0 157.5 210.0
[1576] RDeinit: RHandle = 6EDF95C (116259164)
[1576] <2> Stop: Stopping R
[1576] <2> Stop: sending quit()
[1576] <-1> TPlotEventLoop: terminating
[1576] <-1> TRConsole: destroying
[1576] removed exception handler for C:\Users\ASUS UX32L\AppData\Roaming\MetaQuotes\Te rminal\50CA3DFB510CC5A8F28B48D1BF2A 5702\MQL4\Libraries\mt4R.dll
[5356] SHIMVIEW: ShimInfo(Complete)

2. It would be a huge help if you could provide me with the simplest possible mt4R program that can show me how exactly mt4R and R communicate. For example:
  1. Every 3 seconds let's say:
  2. Send OHLC data to R (closing prices, for example, reversed(?))
  3. Use R to do a simple operation with the timeseries, say, multiply the last record by 2
  4. Plot this data in a R window for a second
  5. get these data back from R into mt4R
  6. Alert the last record (multiplied by 2)

3. In your opinion, what is the best documentation out there for me?

My aim is to design the simplest EA that could communicate with R, so that I would make all my changes in R, not in the EA, as was told earlier in this thread too). I realize that I ask a lot so the first answer gets 1000+ awesomeness points !!!!!!!

(this post is also posted on http://www.forexfactory.com/showthread.php?t=260422&page=9, will post the answers of this forum here if I get any). MANY thanks in advance.

 

Hi again,

I am now running arbomat and trendomat without problem. Would still be useful to have a working example of software sending information to and receiving from R.


Thanks !

 

I have just installed MT4R-1.4.0 snapshot b7 with MT4 Build 902 (23 Oct 2015) running under MS Windows XP SP3   R version  3.2.2

The installation was straight forward and only took about 10 minutes including a quick read of the documentation.

I tested the installation using the mt4RTest.mq4 script stepping through it with the debugger. It worked fine "out of the box".

I was very pleased to find that this very useful piece of software had been updated from the original  MT4R -1.3... version which is now obsolete since MT4 build 600.  Looking at the 2010 vintage of  MT4R 1.3 my first thought was  "damn" - I am going to be up for many hours of work converting this. Then I found micclly's contribution.

Thank you micclly  very much for your efforts.

Regards

Tim Wilson

 

Hi there! Different instances of my EA are attributing the same integer as a handle for R, which trigger a mess when further executing commands with that handle, as they are calling for the same R session instead of calling for independent sessions... 

How the handle attributed? is that some kind of random generated number depending on the internal clock, in which case simultaneous calls of Rinit  increase the chance to get the same handle? 

Is there a way to avoid that? I was thinking of setting the handle as global variables that could be checked and de-initialize/ re-initialize R until I get different Handle but this solution is rather cumbersome. Any idea?

Thanks  

Reason: