每个K线柱的日期时间属性上的时间都是固定的,当判断最后一跟K的时间不同了,就表示已经新产生一根K了
没法回答,你都没有说清楚你要什么地方使用,怎么帮你弄?
History2.close(History2.Count-1) = close
History2.high(History2.Count-1) = mxhigh
History2.low(History2.Count-1) = mxlow
History2.Date(History2.Count-1) = mxdate
History2.Volume(History2.Count-1) = mxxVolume
History2.OpenInt(History2.Count-1) = mxOpenInt
call History2.SaveData(xinheyue,xinshichang,1)
if abs(close-mxopen) > qj then
'根据条件新建一个K线 ,并保存。
call History2.InsertAt(History2.Count)
History2.open(History2.Count-1) = close
History2.close(History2.Count-1) = close
History2.high(History2.Count-1) = close
History2.low(History2.Count-1) = close
History2.Date(History2.Count-1) = mxdate
History2.Volume(History2.Count-1) = 0
History2.OpenInt(History2.Count-1) = OpenInt
call History2.SaveData(xinheyue,xinshichang,1)
mxxVolume = 0
end if
call Application.ActivateFrameWithCode("Technic",xinheyue,xinshichang,0)
call Technic.Refresh
上面红色部分, 这个条件不行,应怎么改才能和K线实际运行相一致?
那个代码是建立等价k,所以是价差达到一定程度才新建。你要根据k线运行可以如下去操作,记录下数据的count,然后当这个总量大于保存的count时候就满足条件了
dim num
call application.SetTimer(0,1000)
Sub APPLICATION_Timer(ID)
set Data1= marketdata.GetHistoryData("cl00","nm",0)
if Data1.count>num then
'新建k的动作程序
num = Data1.count
end if
application.MsgOut Data1.count
End Sub