
等级: 新手上路
- 注册:
- 2021-10-13
- 曾用名:
|

楼主 |
发表于 2022-4-14 09:03
|
显示全部楼层
//中间变量
INPUT:X(10,1,100,1),NMIN(1,1,100,1),SS(1,1,10000,1);
X周期高点:=REF(HHV(H,X),1);//X是参数,自行调整
X周期低点:=REF(LLV(L,X),1);
手数:=SS;
开仓时间:=(TIME>=010400 and time<=013000) OR (TIME>=130400 and time<=133000) AND TIME<T0TOTIME(TIMETOT0(CLOSETIME(3))-NMIN*60);
平仓时间:TIME>=T0TOTIME(TIMETOT0(CLOSETIME(0))-NMIN*60) or (time<130000 and time>=T0TOTIME(TIMETOT0(CLOSETIME(1))-NMIN*60)) ;
{NMIN为参数,CLOSETIME(0)-NMIN*100表示 收盘时间-提前N分钟 N由NMIN控制}
//交易条件:
开多平空条件:=High>=X周期高点 and 开仓时间 and holding<=0;
开空平多条件:=Low<=X周期低点 and 开仓时间 and holding>=0;
//交易系统
收盘平多:sell(平仓时间 and holding>0, 0, thisclose);
收盘平空:sellshort(平仓时间 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;//输出当前资产,但不影响坐标最高最低值
补充内容 (2022-4-14 09:04):
老师 再帮我加一个盈利回撤80% 平仓 谢谢 |
|