以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 高级功能研发区 (http://www.weistock.com/bbs/list.asp?boardid=5) ---- 请教各位自定义函数算法优化的问题 (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=1985) |
-- 作者:volersky -- 发布时间:2010/6/29 21:58:38 -- 请教各位自定义函数算法优化的问题 因backset函数不能嵌套,所以我自写函数,但我写的自定义函数太慢了,实盘无法用,哪个大侠能不能帮我优化下,咸激不尽 我在公式里这么调用的: yy:HPPOS(); drawline(yy,h,yy,h,2),linethick3,colorgreen; 以下为自定义函数部分: Function HpPos(Formula) Set History = Formula.ParentGrid.GetHistoryData() DataCount = 0 rTime=0 lTime=0 i=history.Count-4 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) boolL=history.Low(i) if boolH and (not boolL) 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 if Formula.IndexData=rTime then HpPos=history.high(rTime) exit function end if if Formula.IndexData=lTime then HpPos=history.high(lTime) exit function end if End Function 补充一下,我用的是多图组合,一个图上可以看好几个品种的 [此贴子已经被作者于2010-6-29 22:04:47编辑过]
|
-- 作者:volersky -- 发布时间:2010/6/30 17:35:29 -- 自已顶一下 已解决了,通过frame与grid对象解决了! |