This is the code I'm trying now, and it yields a matrix in R of the right dimensions, but its contents are again total bs:


[2,] 2.29175545475632e-312 5.98860202721352e-67 7.38971488557103e-130

[3,] 1.74969279245251e-113 1.73618583701266e-218 1.03164333975554e-312

[4,] 1.66834019294894e-267 3.22670143784907e-94 1.85094398490310e-313

etc.

Is this a typecasting issue? How do I get the right price figures into the matrix?

Quote:
#include <default.c>
#include <r.h>

#define NUM_ASSETS 505
#define DAYS 50

int asset_num;
vars Prices[NUM_ASSETS];

function run()
{
StartDate = 20100101;
BarPeriod = 60*24;
LookBack = DAYS;
Commission = Spread = Slippage = 0;

int i;

assetList("History\AssetsSP500.csv");

asset_num = 0;

while(loop(Assets))
{
asset(Loop1);

if(priceClose(0)!= 0 && priceClose(DAYS) != 0 && asset_num < NUM_ASSETS)
{
Prices[asset_num] = series(priceClose(),DAYS);
}
else if(asset_num == NUM_ASSETS)
break;
asset_num++;
}

if(!(is(LOOKBACK)))
{
Rstart("",2);
Rset("y",Prices,DAYS,NUM_ASSETS);
Rx("y",3);
}
}