以文本方式查看主题

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

--  作者:300qh
--  发布时间:2013/1/19 11:12:35
--  这样编写有问题吗?请改正


买1开多条件:********;
买1止损条件:********;
买1止盈条件:********;
买1移止条件:********;
if 买1开多条件 and holding<=0 then begin
sellshort(1,0,thisclose);
buy(1,1,thisclose);
end

if 买1止损条件 and holding>0 then begin
sell(1,0,thisclose);
end

if 买1止盈条件 and holding>0 then BEGIN
sell(1,0,thisclose);
end

if 买1移止条件 and holding>0 then BEGIN
sell(1,0,thisclose);
end


买2开多条件:********;
买2止损条件:********;
买2止盈条件:********;
买2移止条件:********;
if 买2开多条件 and holding<=0 then begin
sellshort(1,0,thisclose);
buy(1,1,thisclose);
end

if 买2止损条件 and holding>0 then begin
sell(1,0,thisclose);
end

if 买2止盈条件 and holding>0 then BEGIN
sell(1,0,thisclose);
end

if 买2移止条件 and holding>0 then BEGIN
sell(1,0,thisclose);
end

 

卖1开空条件:********;
卖1止损条件:********;
卖1止盈条件:********;
卖1移止条件:********;
if 卖1开空条件 and holding>=0 then begin
sell(1,0,thisclose);
buyshort(1,1,thisclose);
end

if 卖1止损条件 and holding<0 then begin
sellshort(1,0,thisclose);
end

if 卖1止盈条件 and holding<0 then BEGIN
sellshort(1,0,thisclose);
end

if 卖1移止条件 and holding<0 then BEGIN
sellshort(1,0,thisclose);
end

 

卖2开空条件:********;
卖2止损条件:********;
卖2止盈条件:********;
卖2移止条件:********;
if 卖2开空条件 and holding>=0 then begin
sell(1,0,thisclose);
buyshort(1,1,thisclose);
end

if 卖2止损条件 and holding<0 then begin
sellshort(1,0,thisclose);
end

if 卖2止盈条件 and holding<0 then BEGIN
sellshort(1,0,thisclose);
end

if 卖2移止条件 and holding<0 then BEGIN
sellshort(1,0,thisclose);
end


--  作者:jinzhe
--  发布时间:2013/1/21 9:11:11
--  

把持仓判断条件写在下单语句中比如

sellshort(holding<0,)

buy(holding=0,)


--  作者:300qh
--  发布时间:2013/1/21 20:46:48
--  

以上这样,如果有很多组买卖条件,只要不断增加就可以了是吗?

持仓判断写在开平仓函数里,与直接写在外面,有什么区别?请指点一下


--  作者:jinzhe
--  发布时间:2013/1/22 8:55:28
--  
上面的语法都没问题,平仓反手把持仓判断写进下单语句而不是外面是怕下单时平仓判断有误
--  作者:300qh
--  发布时间:2013/1/22 18:38:28
--  
谢谢大师傅