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