Rss & SiteMap

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

专业程序化软件提供商
共6 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]日内策略变量无法赋值?

1楼
grayelf 发表于:2016/8/7 21:23:11
 运行在5分钟k线,我现在新交易日出现的时候记录当天开盘价,最高价,最低价,上一日收盘价。
但是shelf+q查看变量值,变量值都是##。。。why?

if date<>ref(date,1) then begin
    daylow:=low;
    dayhigh:=high;
    dayopen:=open;
    lastdayclose:=ref(close,1);
    lastdaybars:=1;
    cs:=1;
    End
else BEGIN
    dayhigh:=max(ref(dayhigh,1),high);
    daylow:=min(ref(daylow,1),low);
    dayopen:=ref(dayopen,1);
    lastdaybars:=ref(lastdaybars,1)+1;
    lastdayclose:=ref(lastdayclose,1);
    End

2楼
jinzhe 发表于:2016/8/8 9:15:27
用的是序列计算还是逐k线计算?
3楼
grayelf 发表于:2016/8/8 13:28:33
 序列模式
4楼
jinzhe 发表于:2016/8/8 13:33:39

你这样写要用逐k线计算才能实现,然后代码这样改:

c1:=ref(c,1);
if date<>ref(date,1) then begin
    daylow:=low;
    dayhigh:=high;
    dayopen:=open;
    lastdayclose:=c1;
    lastdaybars:=1;
    cs:=1;
End

h1:=ref(dayhigh,1);
l1:=ref(daylow,1);
o1:=ref(dayopen,1);
lb1:=ref(lastdaybars,1);
ldc:=ref(lastdayclose,1);
if date=ref(date,1) then  BEGIN
    dayhigh:=max(h1,high);
    daylow:=min(l1,low);
    dayopen:=o1;
    lastdaybars:=lb1+1;
    lastdayclose:=ldc;
 End

5楼
jinzhe 发表于:2016/8/8 13:34:24

有个简单的方法来记录当天开盘价,最高价,最低价,上一日收盘价。

o1:valuewhen(todaybar=1,o);

hh:hhv(h,todaybar);

ll:llv(l,todaybar);

cc:ref(c,todaybar);

6楼
grayelf 发表于:2016/8/9 21:38:37
 好的,非常感谢!
共6 条记录, 每页显示 10 条, 页签: [1]


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