分析家公式网,提供指标公式,股票软件 用户登录  |  用户 注册

软件名称:[B]金字塔 和风模板:月收益统计功能[/B]
软件类型:国产软件
运行环境:Win9X/Win2000/WinXP/Win2003/
软件语言:简体中文
授权方式:免费版
软件大小:1.00 KB
官方主页:Home Page
更新时间:2012-01-20 10:10:35
软件简介:

由于金字塔现在的模型测试中没有按月统计的功能,尝试在公式中加入简单的几行代码,实现收益按月统计,统计结果保存在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;    
                              



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

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 (ma1ma2 or t2),1,thisclose); buy(holding=0 and ma1>ma2 and t1,1,thisclose); buyshort(holding=0 and ma11 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;


 


[url=http://www.70822.com/soft/sort013/sort068/down-43392.html]金字塔 和风模板:月收益统计功能[/url]

关于本站 | 网站帮助 | 广告合作 | 声明 | 友情连接 | 网站地图 |
分析家公式网声明:本站所有股票公式软件资料均网上公开收集,如侵权请联系删帖。站内所有广告,均与本站无关!
Copyright © 2003-2024 70822.Com. All Rights Reserved .
页面执行时间:62.50000 毫秒