以文本方式查看主题

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

--  作者:wzywzy292
--  发布时间:2012/7/19 22:23:36
--  [求助]
 有二个模型,都是图表交易,逐K线,现在要把他们组合成一个图表逐K线交易的模型,应该怎么做?

模型1:开仓条件AA,平仓条件BB。
模型2:开仓条件CC,平仓条件DD。

模型1 先触发 就执行模型1,其间即使 模型2的开仓条件成立,也不执行模型2。

模型2 先触发 就执行模型2,其间即使 模型1的开仓条件成立,也不执行模型1。


谢谢!!!






--  作者:jinzhe
--  发布时间:2012/7/20 8:43:00
--  

if aa and holding=0 then buy(holding=0,1,market);

if cc  and  holding=0 then buy(holding=0,1,market);

两个开仓条件都限定没有持仓时才能下单,这样就能避免条件满足就下单。


--  作者:wzywzy292
--  发布时间:2012/7/20 10:12:05
--  
IF AA=1 THEN GOTO 模型1@;
IF CC=1 THEN GOTO 模型2@;

模型1@;
if aa and holding=0 then BEGIN
buy(holding=0,1,market);
SELL(BB,1,market);
END;
goto end@;
模型2@;
if CC and holding=0 then BEGIN
buy(holding=0,1,market);
SELL(DD,1,market);
END;
goto end@;
end@;

这样写只执行模型1 不执行模型2,请教是什么地方的问题,谢谢!!!
[此贴子已经被作者于2012-7-20 10:14:52编辑过]

--  作者:wzywzy292
--  发布时间:2012/7/20 15:56:03
--  
 高手帮我
--  作者:just
--  发布时间:2012/7/20 16:43:41
--  


if aa=1 and holding=0 then BEGIN
buy(holding=0,1,market);
SELL(BB,1,market);
END
if CC=1 and holding=0 then BEGIN
buy(holding=0,1,market);
SELL(DD,1,market);
END;