以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  [原创]平仓明细输出到csv的模板  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=4758)

--  作者:z7c9
--  发布时间:2011/1/9 18:00:09
--  [原创]平仓明细输出到csv的模板

以下内容为程序代码:

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编辑过]

--  作者:guotx2010
--  发布时间:2011/1/9 18:30:49
--  

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

 


--  作者:z7c9
--  发布时间:2011/1/11 10:12:09
--  
图片点击可在新窗口打开查看