设为首页收藏本站

 找回密码
 注册
查看: 1687|回复: 0
打印 上一主题 下一主题

关于TB回溯最大周期的若干问题 [复制链接]

Rank: 1

精华
0
UID
208306
积分
37
帖子
7
主题
5
阅读权限
10
注册时间
2015-5-4
最后登录
2018-8-21
跳转到指定楼层
1#
发表于 2016-12-13 10:07:40 |只看该作者 |倒序浏览
本帖最后由 outlawjk 于 2016-12-13 10:09 编辑

令BST=BarsSincesToday,当BST=0时,对BST进行回溯,求得昨日K线数BarCounts,并求四日净值;原本理应回溯444根K线,但是MaxBarsBack显示的最大回溯周期为288;
关于TB的最大回溯周期是如何确定的,望各位大神赐教。



代码示例如下(测试品种AU000,周期5min,测试时间20150601-20150815)
Params
Vars
NumericSeries a;
Numeric netday(4);
NumericSeries bst;
NumericSeries BarCounts;
NumericSeries start;
NumericSeries net;
NumericSeries tp1;
Begin

BST=BarsSinceToday;
if (BST==0)BarCounts=BST[1]+1;                         //每日k线数
tp1=BarCounts*netday;
a=CloseD(1)+2;

If(BST==0)start=Open[tp1]; %四日前开盘价;

net=Open/start;   %四日净值
PlotNumeric("a",a);
Commentary("a="+Text(a));
Commentary("BarCounts="+Text(BarCounts));
Commentary("BNetday="+Text(BarCounts*netday));
Commentary("CloseD(1)="+Text(CloseD(1)));
Commentary("CurrentBar="+Text(CurrentBar));
Commentary("MaxBarsBack="+Text(MaxBarsBack));

end
您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-4-26 04:27

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部