以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  是否正确  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=68559)

--  作者:yeqiu
--  发布时间:2014/8/10 22:47:04
--  是否正确
 

以下是否正确?

当日开盘后第一次跌幅达12点开空,

当日开盘后第一次升幅达12点开多

variable:n:=0;

H1:=hhv(h, todaybar);

if h1-L>=12 and n=0 then
begin
buyshort(holding=0,1,market);
n:=1;
end
aaa:H1-L,noaxis,linethick0;


L1:=llv(L,todaybar);
if h-L1>=12 and n=0 then
begin
buy(holding=0,1,market);
n=1;
end


if time>=145700 then
 sell(holding>0,holding,market);
 sellshort(holding<0,holding,market);


if time=closetime(0) then begin
n:=0;
end


--  作者:jinzhe
--  发布时间:2014/8/11 8:50:13
--  

if time>=145700 then
 sell(holding>0,holding,market);
 sellshort(holding<0,holding,market);


要用begin end把两句平仓语句括起来
--  作者:yeqiu
--  发布时间:2014/8/11 21:38:06
--  

variable:n:=0;

H1:=hhv(h, todaybar);

L1:=llv(L,todaybar);

aa:h-l1,noaxis,linethick0;
bb:h1-L,noaxis,linethick0;
if h1-L>=4 and n=0 then
begin
buyshort(holding=0,1,market);
n:=1;
end
if h-L1>=4 and n=0 then
begin
buy(holding=0,1,market);
n:=1;
end


if H-enterprice >=4 then sell(holding>0,0,market);
if enterprice-L>=4 then sellshort(holding<0,0,market);

sell(time>151200 and holding>0, 0, market);

sellshort(time>151200 and holding<0, 0, market);

if time=closetime(0) then begin

n:=0;
end

此代码测试为开空(期指8/11)

将开空代码移至开多代码下方时测试即为开空

但按盘面显示应该先符合开多条件

请问那里出错?


--  作者:yeqiu
--  发布时间:2014/8/11 21:38:36
--  

图片点击可在新窗口打开查看此主题相关图片如下:图像 010.gif
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:图像 011.gif
图片点击可在新窗口打开查看

--  作者:jinzhe
--  发布时间:2014/8/12 8:56:20
--  
同一根k线开多开空条件都满足,出信号的会是写在前面的开仓语句
--  作者:yeqiu
--  发布时间:2014/8/12 9:21:17
--  
不是应该执行先成立的语句吗?图上先成立的应是开多
--  作者:jinzhe
--  发布时间:2014/8/12 9:27:10
--  

写在前面的,就不是先成立了?


--  作者:pxmygl
--  发布时间:2014/8/12 9:30:42
--  
开空还没成立时,开多就己经成立了
--  作者:yeqiu
--  发布时间:2014/8/12 9:43:21
--  
对,不是应该先执行时间上先成立的语句吗,
--  作者:jinzhe
--  发布时间:2014/8/12 9:52:45
--  

用户多加理解“写在前面先运行”这句话