Error connecting Zorro and R (R Bridge)

Posted By: ealvarpe

Error connecting Zorro and R (R Bridge) - 05/24/16 18:33

I´m implementing an strategy that calls R through the Bridge on INITRUN, and then every new bar.
The problem is that it correctly calls and works on the INITRUN, but not after this. From the first bar, it gives me an error and abort.

The error in the zorro´s window is:

MytestR compiling.................
print(rout)

[1] 0 10 20 30 40
0 10 20 30 40
Test: MytestR EUR/USD 2014..2015
R error -
Error: cannot find the function "neural.init"

Execution interrumpted

Error - R session aborted!
Quit


Below is the code:

#include <r.h>

bool callRFunction() {
var vecIn[5],vecOut[5];
int i;
for(i=0; i<5; i++)
vecIn[i] = i;

Rset("rin",vecIn,5); // set up a vector
Rx("rout <- rin * 10"); // perform some arithmetics
Rx("print(rout)",3); // print rout to the Zorro window
Rv("rout",vecOut,5); // read it back

if(!Rrun()) {

printf("Error - R session aborted!");
return false;
}
else
for(i=0; i<5; i++)
printf("%.0f ",vecOut[i]);


return true;
}


void run()
{
BarPeriod = 60;
StartDate = 20140101;
EndDate = 20150101;

if(is(INITRUN)) {

Rstart("",2);
var vecIn[5],vecOut[5];
int i;
for(i=0; i<5; i++)
vecIn[i] = i;

Rset("rin",vecIn,5); // set up a vector
Rx("rout <- rin * 10"); // perform some arithmetics
Rx("print(rout)",3); // print rout to the Zorro window
Rv("rout",vecOut,5); // read it back

if(!Rrun())
printf("Error - R session aborted!");
else
for(i=0; i<5; i++)
printf("%.0f ",vecOut[i]);
}
else
callRFunction();
}
Posted By: boatman

Re: Error connecting Zorro and R (R Bridge) - 05/25/16 00:37

I might be missing something, but how did you get that error relating to neural.init when I don't see that function called anywhere in the script you posted?
Posted By: jcl

Re: Error connecting Zorro and R (R Bridge) - 05/25/16 06:35

That error was on our side. Edit r.h and comment out the "neural" function. It's listed in the bug list under "What's New".
© 2024 lite-C Forums