设为首页收藏本站

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

两种写法得出的结论不一样,求高手解答一下。 [复制链接]

Rank: 1

精华
0
UID
125429
积分
3
帖子
3
主题
0
阅读权限
10
注册时间
2013-7-24
最后登录
2017-10-31
1#
发表于 2017-10-22 15:54:34 |显示全部楼层
time 是Bar的开始时间,在当根Bar没结束前time==0.1000你里面的代码每来个tick都会执行,直到当根Bar完成,High,Low也会更新,自然取不到正确值。

使用道具 举报

Rank: 1

精华
0
UID
125429
积分
3
帖子
3
主题
0
阅读权限
10
注册时间
2013-7-24
最后登录
2017-10-31
2#
发表于 2017-10-22 18:40:11 |显示全部楼层
这个可能是Highest,Lowest底层封装的机制问题,写在外面是每个BAR执行一遍(历史回测)在条件T=0.1000里是只执行一次,你看看在实盘下或模拟盘中能否取到该值。

使用道具 举报

Rank: 1

精华
0
UID
125429
积分
3
帖子
3
主题
0
阅读权限
10
注册时间
2013-7-24
最后登录
2017-10-31
3#
发表于 2017-10-23 23:50:31 |显示全部楼层
If(Time>0.233700)
{
High10=Highest(high,59);
Low10=Lowest(low,59);
SetGlobalVar(0,High10);
SetGlobalVar(1,Low10);

PlotNumeric("aa",high10,0,-1,0);
PlotNumeric("bb",low10,0,-1,0);
}
PlotString("H10",text(high10),h,-1,0);
PlotString("L10",text(low10),l,-1,0));
这样写盘中能取到0.233700之后的最高,最低值
If(Vol>0)
{
High10=Highest(high,59);
Low10=Lowest(low,59);
SetGlobalVar(0,High10);
SetGlobalVar(1,Low10);

PlotNumeric("aa",high10,0,-1,0);
PlotNumeric("bb",low10,0,-1,0);
}
PlotString("H10",text(high10),h,-1,0);
PlotString("L10",text(low10),l,-1,0);
这样写在盘中能取到正确值。

使用道具 举报

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

bottom

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

GMT+8, 2024-5-9 19:31

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部