有二个模型,都是图表交易,逐K线,现在要把他们组合成一个图表逐K线交易的模型,应该怎么做?
模型1:开仓条件AA,平仓条件BB。
模型2:开仓条件CC,平仓条件DD。
模型1 先触发 就执行模型1,其间即使 模型2的开仓条件成立,也不执行模型2。
模型2 先触发 就执行模型2,其间即使 模型1的开仓条件成立,也不执行模型1。
谢谢!!!
if aa and holding=0 then buy(holding=0,1,market);
if cc and holding=0 then buy(holding=0,1,market);
两个开仓条件都限定没有持仓时才能下单,这样就能避免条件满足就下单。
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编辑过]
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;