
等级: 新手上路
- 注册:
- 2022-3-24
- 曾用名:
|
//中间变量
INPUT:X(5,1,100,1),SS(1,1,10000,1);
X周期高点:REF(HHV(H,X),1);//X是参数,自行调整
X周期低点:REF(LLV(L,X),1);
手数:=SS;
开仓时间1:=(TIME>091000 AND TIME<112500);
开仓时间2:=(TIME>133500 AND TIME<145500);
平仓时间1:=(TIME>091000 AND TIME<112500);
平仓时间2:=(TIME>133500 AND TIME<145500);
//交易条件:
开多平空条件:=High>=X周期高点 and 开仓时间1 and holding<=0;
开空平多条件:=Low<=X周期低点 and 开仓时间1 and holding>=0;
开多平空条件:=High>=X周期高点 and 开仓时间2 and holding<=0;
开空平多条件:=Low<=X周期低点 and 开仓时间2 and holding>=0;
//交易系统
收盘平多:sell(平仓时间1 and holding>0, 0, thisclose);
收盘平空:sellshort(平仓时间1 and holding<0,0,thisclose);
收盘平多1:sell(平仓时间2 and holding>0, 0, thisclose);
收盘平空1:sellshort(平仓时间2 and holding<0,0,thisclose);
平空:sellshort(开多平空条件 and holding<0, 手数,limitr,X周期高点);
平多:sell(开空平多条件 and holding>0,手数,limitr,X周期低点);
开空:buyshort(开空平多条件 and holding=0,手数,limitr,X周期低点);
开多:buy(开多平空条件 and holding=0, 手数,limitr,X周期高点);
当前持仓:HOLDING,COLORGRAY,LINETHICK0;
当前资产:ASSET,NOAXIS,COLORGRAY;//输出当前资产,但不影响坐标最高最低值
|
|