[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Help With Writing Table to File



PureBytes Links

Trading Reference Links

After calculating 11 variables to output to a file, they plot 
correctly, and the table is created correctly, but all numbers in 
the table are displayed as negative one to the 10th power........

If I substitute an integer for the variable, the integer is 
prepresented in the table, but I cannot get decimal numbers to be 
represented in the table.

Any help with formating the StrFormat setup would be appreciated if 
that is where the trouble lies.

AFL Below:

_SECTION_BEGIN("Correlation");
//correlation Selected Ticker to S&P Sectors

CP=Param("CorrelationPeriods",63,1,1000,1);


xlb=Foreign("xlb","C");
xlbc=Correlation(C,xlb,CP);
//Plot(xlbc,"Materials",colorBrown,4);

xle=Foreign("xle","C");
xlec=Correlation(C,xle,CP);
//Plot(xlec,"Energy",colorBlue,4);

xlf=Foreign("xlf","C");
xlfc=Correlation(C,xlf,CP);
//Plot(xlfc,"Financials",colorGreen,4);

xlv=Foreign("xlv","C");
xlvc=Correlation(C,xlv,CP);
//Plot(xlvc,"Healthcare",colorRed,4);

xli=Foreign("xli","C");
xlic=Correlation(C,xli,CP);
//Plot(xlic,"Industrials",colorOrange,4);

xlk=Foreign("xlk","C");
xlkc=Correlation(C,xlk,CP);
//Plot(xlkc,"Technology",colorBrightGreen,4);

xlp=Foreign("xlp","C");
xlpc=Correlation(C,xlp,CP);
//Plot(xlpc,"Staples",colorViolet,4);

xly=Foreign("xly","C");
xlyc=Correlation(C,xly,CP);
//Plot(xlyc,"Discretionary",colorBlack,4);

OIx=Foreign("$xoi","C");
oixC=Correlation(C,OIx,CP);
//Plot(oixC,"Oil",colorBlack,4);

GLD=Foreign("$xau","C");
gldC=Correlation(C,gld,CP);
//Plot(gldC,"Gold",colorGold,4);

TYX=Foreign("$tyx","C");
TYXC=Correlation(C,TYX,CP);
//Plot(TYXC,"10Yint",colorGreen,4);

Plot(0.65,"",colorBlue,styleLine+8);
Plot(0,"",colorBlue,8);

_SECTION_END();

_SECTION_BEGIN("LinktoWrite");

pp=xlbc;
Plot(pp,"pp",colorRed,1);
qq=xlec;
Plot(qq,"qq",colorOrange,1);
rr=xlfc;
Plot(rr,"rr",colorYellow,1);
ss=xlvc;
Plot(ss,"ss",colorLime,1);
tt=xlic;
Plot(tt,"tt",colorGreen,1);
uu=xlkc;
Plot(uu,"uu",colorTeal,1);
Vv=xlpc;
Plot(Vv,"vv",colorBlue,1);
ww=xlyc;
Plot(ww,"ww",colorViolet,1);
xx=oixC;
Plot(xx,"xx",colorRed,1);
yy=gldC;
Plot(yy,"yy",colorOrange,1);
zz=TYXC;
Plot(zz,"zz",colorYellow,1);

_SECTION_END();

_SECTION_BEGIN("Write Data to File");

rs1 = fopen( "SectorCorrelation13week.csv", "w"); 
if( rs1 ) 
{ 
   fputs( "Date,pp,qq,rr,ss,tt,uu,vv,ww,xx,yy,zz,\n", rs1 ); 

   y = Year(); 
   m = Month(); 
   d = Day(); 

   for( i = 0; i < BarCount; i++ ) 
   { 
      Dt = StrFormat("%02.0f-%02.0f-%02.0f,", y[ i ], m[ i ], d[ 
i ] );
		fputs( Dt, rs1 ); 
     
     data = StrFormat("%1.3f,%1.3f,%1.3f,%1.3f,%1.3f,%1.3f,%1.3f,%
1.3f,%1.3f,%1.3f,%1.3f,\n",
							pp[i],qq
[i],rr[i],ss[i],tt[i],uu[i],Vv[i],ww[i],xx[i],yy[i],zz[i],uu[i]);
		fputs( data, rs1 );
   } 

   fclose( rs1 ); 
} 

_SECTION_END();

Buy=1;
Sell=0;







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/