Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共3 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[原创]平仓明细输出到csv的模板

1楼
z7c9 发表于:2011/1/9 18:00:09

以下内容为程序代码:

1 runmode:0;
2
3 input:debug(1,0,1,1);
4
5 pathfile:='c:\tradelog.csv';
6
7 enterhour:=ref(hour,enterbars);
8 enterminute:=ref(minute,enterbars);
9
10 commission:=selfdata('commission');
11
12 if holding>0 then begin
13     lots:=holding;
14     
15     if debug=1 then begin
16         debugcontent:=numtostr(year,0)+'-'+numtostr(month,0)+'-'+numtostr(day,0)+','+stkname+','+
17                     numtostr(enterhour,0)+':'+numtostr(enterminute,0)+','+numtostr(enterprice,0)+',Buy,'+
18                     numtostr(hour,0)+':'+numtostr(minute,0)+','+numtostr(exitprice,0)+','+
19                     numtostr(exitprice-enterprice,0)+','+numtostr(2*commission,0)+','+numtostr(lots,0)+','+
20                     numtostr(numprofit(1),0)+','+numtostr(asset,2);    
21         debugfile2(pathfile,debugcontent,0,0);                
22     end
23 end
24
25 if holding<0 then begin
26     lots:=holding;
27     if debug=1 then begin
28         debugstring:=numtostr(year,0)+'-'+numtostr(month,0)+'-'+numtostr(day,0)+','+stkname+','+
29                     numtostr(enterhour,0)+':'+numtostr(enterminute,0)+','+numtostr(enterprice,0)+',Sell,'+
30                     numtostr(hour,0)+':'+numtostr(minute,0)+','+numtostr(exitprice,0)+','+
31                     numtostr(enterprice-exitprice,0)+','+numtostr(2*commission,0)+','+numtostr(lots,0)+','+
32                     numtostr(numprofit(1),0)+','+numtostr(asset,2);    
33         debugfile2(pathfile,debugcontent,0,0);                
34     end
35 end

 

 

图片点击可在新窗口打开查看

[此贴子已经被作者于2011-1-9 18:02:03编辑过]
2楼
guotx2010 发表于:2011/1/9 18:30:49

不错的东西,可是我放到我的交易系统中,输出的数据重复3遍,而且只有BUY没有Sell

 

3楼
z7c9 发表于:2011/1/11 10:12:09
图片点击可在新窗口打开查看
共3 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.03516 s, 3 queries.