Rss & SiteMap

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

专业程序化软件提供商
共122 条记录, 每页显示 10 条, 页签: [1] [2][3][4][5][6][7][8] ...[13]
[浏览完整版]

标题:和风模板:月收益统计功能

1楼
jim5jim 发表于:2011/8/31 22:12:21

由于金字塔现在的模型测试中没有按月统计的功能,尝试在公式中加入简单的几行代码,实现收益按月统计,统计结果保存在txt文件中,形式如下:

macross_report IF00 月度汇总报告 测试日期:20110831
201004收益: 29940                                 
201005收益: 60780                                 
201006收益: -43680                                
201007收益: -6060                                 
201008收益: -30420                                
201009收益: 18720                                 
201010收益: 83760      

以此为模板,还可以增加每月交易次数,胜率等数据。

可以在进行回测的时候设置report参数为1,平时在图表上使用时report设为0;

                       

input:n1(5,1,100,1),n2(20,1,100,1),report(0,0,1,1);
//需要生成报告时,将参数report设为1
variable:rz1=1;
if barpos()=1 then
begin
if report=1 then
debugfile2('C:\Documents and Settings\Administrator\桌面\month.txt',FORMULANAME()&' '&stklabel&' 月度汇总报告 测试日期:%0.f',currentdate+19000000,0);
rz1:=asset();
end;

//一个均线交叉的系统作为例子
ma1:=ma(c,n1);
ma2:=ma(c,n2);
t1:=time>=091500 and time<=144500;
t2:=time>=151000;
sell(holding>0 and (ma1<ma2 or t2),1,thisclose);
sellshort(holding<0 and (ma1>ma2 or t2),1,thisclose);
buy(holding=0 and ma1>ma2 and t1,1,thisclose);
buyshort(holding=0 and ma1<ma2 and t1,1,thisclose);

//生成月统计
rz2:=ref(ASSET(),1) ;
rd:=ref(date,1);
 if barpos<>1 and (month<>ref(month,1) or islastbar) then
 begin
 if report=1 then debugfile2('C:\Documents and Settings\Administrator\桌面\month.txt',numtostr((rd+19000000)/100,0)&'收益: %0.f ',rz2-rz1,0);
    rz1:=rz2;
 end;

     
                             


以下内容只有回复后才可以浏览
2楼
msedu 发表于:2011/8/31 23:06:10

不错,好东西

3楼
anglechenyu 发表于:2011/9/1 1:46:15
看看
4楼
guotx2010 发表于:2011/9/1 8:48:40
好东西,看看!
5楼
王锋 发表于:2011/9/1 9:27:55
图片点击可在新窗口打开查看还要回复啊
6楼
solarhe2006 发表于:2011/9/1 11:05:01
图片点击可在新窗口打开查看
7楼
solarhe2006 发表于:2011/9/1 11:25:17

兄在此基础上能完善金字塔的测评功能最好了。

从胜率到风险回报比,能单独把策略的测评写成一个指标,有曲线有数据,且能输出。

具体参数参考http://ishare.iask.sina.com.cn/f/14868076.html

8楼
pancg 发表于:2011/9/1 13:10:27
这功能应该不错,学习学习。
9楼
wzywzy292 发表于:2011/9/1 19:47:41
 不错,好东西,可通过不了
[此贴子已经被作者于2011-9-1 19:59:26编辑过]
10楼
鸟人爱理财 发表于:2011/9/1 20:06:53

谢谢楼主

 

共122 条记录, 每页显示 10 条, 页签: [1] [2][3][4][5][6][7][8] ...[13]


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