引用上一日的开高低收:
callstock(stklabel,vtopen,6,-1);
callstock(stklabel,vthigh,6,-1);
callstock(stklabel,vtlow,6,-1);
callstock(stklabel,vtclose,6,-1);
同品种用stklabel
是不是时间是没有+4个小时的?
tt:=todaybar;
c1:=ref(valuewhen(time=230000,c),tt);
o1:=ref(valuewhen(time=210500,o),tt);
h1:=ref(valuewhen(time=230000,hhv(h,barslast(time=210500)+1)),tt);
l1:=ref(valuewhen(time=230000,llv(l,barslast(time=210500)+1)),tt);
c2:=ref(valuewhen(time=150000,c),tt);
o2:=ref(valuewhen(time=090500,o),tt);
h2:=ref(valuewhen(time=150000,hhv(h,barslast(time=090500)+1)),tt);
l2:=ref(valuewhen(time=150000,llv(l,barslast(time=090500)+1)),tt);
oo:if(time>210000 and time<=230000,o1,o2);
cc:if(time>210000 and time<=230000,c1,c2);
hh:if(time>210000 and time<=230000,h1,h2);
ll:if(time>210000 and time<=230000,l1,l2);
说明一下,OO,CC,HH,LL为所求值,代码以5分钟周期为例,其他周期自行做下修改即可
150000为白天收盘k线,090500为白天开盘k线
230000为夜晚收盘k线,210500为夜晚开盘k线