#include <r.h>
typedef struct {
string Asset1;
string Asset2;
} Pairs;
function run()
{
set(PLOTNOW);
StartDate = 2015;
EndDate = 20190101;
BarPeriod = 5 * 1440;
static Pairs Pair1;
// ---------------------------------------
// Startup and data loading
// ---------------------------------------
if(is(INITRUN))
{
printf("Script is running!\n");
// start R
if(!Rstart("Test.R", 2))
{
print("Error - can't start R session!");
quit();
}
}
Rx("testnames <- testfunction()", 2);
Pair1.Asset1 = Rd("testnamen[[1]]"); // Doens't work due to Pointer Error - Can't figure it out
Rv("testnamen", Pair1.Asset1, 2); // No Error but no value in Pair.Asset1
printf("Test Wert 1: %s\n", Pair1.Asset1);
watch("!----\n");
}
R Code:
testfunction <- function() {
return(c("Asset", "Name"))
}