等级: 免费版
- 注册:
- 2021-11-23
- 曾用名:
|
楼主 |
发表于 2021-12-2 14:18
|
显示全部楼层
//定义变量
//MACD
DIFF:=EMA(C,12)-EMA(C,26);
DEA:=EMA(DIFF,12);
MACD:=2*(DIFF-DEA);//MACD指标
M金叉:CROSS(MACD,0);
M死叉:CROSS(0,MACD);
//均线
A1:=MA(C,8);
A2:MA(C,100);
//时间
开仓时间:=TIME>=021300 AND TIME<=014500;
平仓时间:=TIME<=014500;
手数:=SS;
//止盈
//IF C-AVGENTERPRICE>100*MINDIFF THEN BEGIN
//SELL(1,HOLDING,MARKET);
//END
//交易条件
开多条件:=M金叉 AND C>A2;
平多条件:=M死叉 AND MACD<-0.1;
开空条件:=M死叉 AND C<A2 ;
平空条件:M金叉 OR MACD>-0.1;
//止损
//IF AVGENTERPRICE-C>30*MINDIFF THEN BEGIN
//SELLSHORT(1,HOLDING,MARKET);
//END;
//交易系统
平空:SELLSHORT(平空条件 AND holding<0,HOLDING,MARKETR);
1111111开多:BUY(开多条件 AND holding=0,1,MARKETR,手数);
平多:SELL(平多条件 AND holding>0,HOLDING,MARKETR);
22222222开空:BUYSHORT(开空条件 AND holding=0,1,MARKETR,手数);
//其他
当前持仓:HOLDING,COLORGRAY,LINETHICK0;
当前资产:ASSET,NOAXIS,COLORGRAY;
|
|