以下是一段阳线阴线统计的程序,原来运行于30分钟周期。现在主程序需要运行于5分钟周期,但这段代码还是需要在30分钟k线周期上统计。
请问如何修改实现?谢谢
duopiaoDP:=0;
kongpiaoDP:=0;
for con=0 to ss do
begin
if ref(c,con)>ref(o,con) then duopiaoDS:=duopiaoDS+1;
if ref(c,con)<ref(o,con) then kongpiaoDS:=kongpiaoDS+1;
end
(duopiaoDP kongpiaoDP 是阳线 阴线计数器,ss是统计周期数(待优化参数))
(这个是5分钟周期上判断有效30分钟时间点的语句:
time30:=time=013000 or time=020000 or time=023000 or time=030000 or time=033000 or time=133000 or time=140000 or time=141500 or time=141500 or time=150000 or time=153000 or time=180000 or time=183000 or time=190000;)
原来是用于30分钟的,现在需要在主程序5分钟周期内实现访问30分钟的数据,实现跟原来一样的统计效果。需要如何改写?谢谢
在5分钟周期上用stkindi直接引用上述代码的结果
不好意思,以前没用过跨周期引用,能麻烦您写一下吗?谢谢!
duopiaoDP:=0;
kongpiaoDP:=0;
for con=0 to ss do
begin
if ref(c,con)>ref(o,con) then duopiaoDS:=duopiaoDS+1;
if ref(c,con)<ref(o,con) then kongpiaoDS:=kongpiaoDS+1;
end
d1:duopiaods;
d2:kongpiaods;
这公式命名为"公式1"
然后新建一个公式,命名任意,代码为:
dd1:stkindi('','公式1.d1',0,4);
dd2:stkindi('','公式1.d2',0,4);