再次谢谢管理员谢谢版主
因为你们的backset不支持嵌套,然后自定义公式会不断的重画,有循环,实盘根本不能用。如果你们把backset搞好后,我也不想麻烦。
我把sub子程序贴出来,请大大帮我分析下:
Sub kp_Paint()
set Grid30=kp.GetGridByName("Win30")
DrawQSX(Grid30)
End Sub
Sub DrawQSX(Grid)
Set History =Grid.GetHistoryData()
DataCount = 0
rTime=0
lTime=0
i=history.Count-4
spaceNumber=Grid.ShowLastCyc
CS=0
do
boolH=history.high(i)>history.high(i-1) and history.high(i)>=history.high(i-2) and history.high(i)>=history.high(i-3) _
and history.high(i)>=history.high(i+1) and history.high(i)>=history.high(i+2) and history.high(i)>=history.high(i+3)
if boolH then
DataCount=DataCount+1
if DataCount=1 then
RTime=i
end if
if DataCount=2 then
LTime=i
exit do
end if
end if
i=i-1
loop
hLeftPrice=history.high(LTime)
hRightPrice=history.high(RTime)
xhLeft=Grid.PelsByPos(LTime,false)
xhRight=Grid.PelsByPos(RTime,false)
yhLeft=Grid.PriceToPels(hLeftPrice)
yhRight=Grid.PriceToPels(hRightPrice)
xhLastPos=Grid.PelsByPos(history.Count+spaceNumber,false)
CS1=FormatNumber(CDbl((hleftPrice-hRightPrice)/(Rtime-Ltime)),2)
CS=(yhleft-yhright)/(xhRight-xhLeft)
ZhuLi=HLeftPrice-CS1*(History.Count-Ltime-1)
Grid.drawtext 0,20,"zhuli:"+Cstr(Zhuli),rgb(0,255,0)
yhLastPos=yhRight+(xhright-xhLastPos)*CS
Grid.drawline xhleft,yhleft,xhLastPos,yhlastPos,rgb(255,0,0),3
End Sub
原码就这样了,在框架内的自选股一点问题都没有,速度也很理想,但在框架上调自选股以外的,马上卡死!
请管理员和版主教我,谢谢!
再补充下,断线处理中,反正不管你如果操作,只要不小心切到自选股以外的,直接卡死!这样处理,实盘速度很快!
再补充下,刚测试的,实盘中,用鼠标点击自选股切换也会卡死!
[此贴子已经被作者于2010-7-1 11:05:37编辑过]