我想把“唐奇安通道”修改一下
要求:开仓的条件不变,平仓点位在盈利10点或亏损5点,盈利和亏损哪个先到,就按哪个点位平仓,不用等这个K线走完,平仓后重新等待开仓信号,其它条件不变。
//中间变量
INPUT:X(20,1,100,1),NMIN(10,1,100,1),SS(1,1,10000,1);
X周期高点:=REF(HHV(H,X),1);//X是参数,自行调整
X周期低点:=REF(LLV(L,X),1);
手数:=SS;
开仓时间:=TIME>OPENTIME(1) AND TIME<CLOSETIME(0)-NMIN*100;
平仓时间:=TIME>=CLOSETIME(0)-NMIN*100;
{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;//输出当前资产,但不影响坐标最高最低值
if enterprice-c>10*mindiff then sellshort;
if c-enterprice>5*mindiff then sellshort;
if c-enterprice>10*mindiff then sell;
if enterprice-c>5*mindiff then sell;