以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]求高手帮我改下公式  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=9274)

--  作者:itachi
--  发布时间:2011/12/7 20:48:41
--  [求助]求高手帮我改下公式

sh:=h;sl:=l;

bh:=(h>ref(h,1) and l<ref(l,1)) or (h<ref(h,1) and l>ref(l,1));

if barslast(not(bh))<=1 and h>ref(h,1) and l<ref(l,1) and ref(h,1)>ref(h,2) then

begin

sl:=ref(sl,1);

end

sh1:sh;

sl1:sl;

这个在序列模式下显然是不行的,怎么改能? 如果直接在逐k线模式下,提示不能使用ref函数,怎么办 求高人帮下小弟,先谢过了

[此贴子已经被作者于2011-12-7 20:58:24编辑过]

--  作者:itachi
--  发布时间:2011/12/7 20:50:13
--  

奇怪 为什么不会换行啊?

Google浏览器里不能换行,特意换成ie重新编辑了

[此贴子已经被作者于2011-12-7 20:54:45编辑过]

--  作者:阿火
--  发布时间:2011/12/7 21:23:33
--  

把统计类函数放在if语句之外

 

sh:=h;sl:=l;

mid:=ref(sl,1);

bh:=(h>ref(h,1) and l<ref(l,1)) or (h<ref(h,1) and l>ref(l,1));

if barslast(not(bh))<=1 and h>ref(h,1) and l<ref(l,1) and ref(h,1)>ref(h,2) then

begin

sl:=mid;

end

sh1:sh;

sl1:sl;


--  作者:itachi
--  发布时间:2011/12/8 12:22:25
--  

 先谢谢了

假如我要使前一日的sh的值为当日的sh(即h),怎么改呢

sh:=h;sl:=l;

mid:=ref(sl,1);

bh:=(h>ref(h,1) and l<ref(l,1)) or (h<ref(h,1) and l>ref(l,1));

if barslast(not(bh))<=1 and h>ref(h,1) and l<ref(l,1) and ref(h,1)>ref(h,2) then

begin

sl:=mid;

这里再加一行,使前一日的sh取今日的sh的值

end

sh1:sh;

sl1:sl;