等级: 超级版主
- 注册:
- 2021-5-24
- 曾用名:
|
新建一个公式A里面
a:close/llv(close,3)>(19.9/100)
然后策略中去引用这个公式
DIFF :=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA :=EMA(DIFF,9);
MACD :=2*(DIFF-DEA);
cond0:stkindi('','A.a',0,6,0);
cond1:cross(0,MACD);
cond2:c<ma(c,15) and c>ma(c,25);
//选股条件、死叉、价格在均线之间
if cond0 and cond1 and cond2 then
begin
tbuy(1,10%,lmt,ma(c,25)+0.5),PERTRADER;
END
//如果挂单超过60秒撤单在下
if TGLOBALSUBMITEX(1,'','',1)>60 then
begin
TCANCEL(1,1);
tbuy(1,10%,mkt),PERTRADER;
END
//1450分满足1和2条件进行撤单
if currenttime>145001 and cond1 and cond2 and TISREMAIN(1 )=1 then
begin
TCANCEL(1,1);
END
//有老仓且价格小于均线
if tbuyholdingex('','',1)-tbuyholdingex('','',0)>0 and c<ma(c,60) then
begin
tsell(1,tbuyholdingex('','',1)-tbuyholdingex('','',0),lmt,ma(c,15)-0.5);
END
if c<ma(c,35) then
begin
tsell(1,tbuyholdingex('','',1),mkt);
END
|
|