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

[amibroker] Referral for help with fputs code



PureBytes Links

Trading Reference Links

I originally posted this message a few days ago and did not get a 
reply.  Can someone refer me to a good afl programer who can assist 
me. 

Thanks 
JB



Hi Tomasz,

I have been trying to figure out this code for several weeks. I am
stuck. Hopefully you can help me. I am trying to modify the
correlation matrix to output the results to a csv file. I have not
been able to get every paired correlation written to the csv. I would
also like to be able to add a filter before writing out to the csv
for example corr>=.75;

here is the code so far:


WLNum = Param("WatchList Number",6,0,500,1);
CorrPd = Param("Correlation Period",1000,1,5000,1);
list = GetCategorySymbols( categoryWatchlist, WLNum);
Listname = CategoryGetName( categoryWatchlist, WLNum );
Yea = Year();
Mon = Month();
Daz = Day();
Dh = StrFormat("%02.0f%02.0f%02.0f", Mon, Daz, Yea );
fh = fopen("E:\\Program
Files\\AmiBroker\\Test\\ "+"Pairs_"+Dh+"_"+Listname+".csv", "w");
fputs( "Ticker 1,Ticker 2, Correlation \n", fh );
WLNum = Param("WatchList Number",27,0,500,1);
CorrPd = Param("Correlation Period",1000,1,5000,1);
list = GetCategorySymbols( categoryWatchlist, WLNum);
SetOption("NoDefaultColumns",True);
Filter = Status("LastBarInTest");
SetSortColumns( 1 );
AddTextColumn(Name(),"Correlation",1.0);
Ticker1= Name();
for( Col=0; (Ticker2=StrExtract( List, Col))!= ""; Col++)
{
Var2 = Foreign(Ticker2,"C");
Corr = Correlation( C, Var2, CorrPd);
Output = ticker1 + ","+ Ticker2+","+Corr+"\n";
fputs(Output,fh);
Color = IIf(Corr>0, colorBrightGreen, IIf(Corr<0,
colorRed,colorWhite));
Color = IIf(Ticker1==Ticker2, 1, Color);
AddColumn( Corr, Ticker2, 1.3, 1, Color);
}
fclose(fh);

your help is greatly appreciated



------------------------------------

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/