以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  高级功能研发区  (http://www.weistock.com/bbs/list.asp?boardid=5)
----  [求助]VBA中,如果判断一分钟的K线柱本柱已走完?  (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=97931)

--  作者:hxl
--  发布时间:2016/5/27 22:50:55
--  [求助]VBA中,如果判断一分钟的K线柱本柱已走完?
VBA中,如果判断K线图中的一分钟的K线柱本柱已走完?
--  作者:王锋
--  发布时间:2016/5/29 15:56:54
--  
每个K线柱的日期时间属性上的时间都是固定的,当判断最后一跟K的时间不同了,就表示已经新产生一根K了
--  作者:hxl
--  发布时间:2016/5/29 20:05:17
--  
请问,VBA原码应如何写?帮帮忙,谢谢了………
--  作者:王锋
--  发布时间:2016/5/29 21:26:12
--  
没法回答,你都没有说清楚你要什么地方使用,怎么帮你弄?
--  作者:hxl
--  发布时间:2016/5/29 23:29:24
--  
 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线实际运行相一致?

--  作者:yukizzc
--  发布时间:2016/5/30 12:17:04
--  

那个代码是建立等价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