收盘价上破布林通道上轨就开多 ,收盘价从开多以来的最高点 回落了超过1%就平一半仓, 收盘价反破了中轨就全部平仓。做空以此类推。
以多头为例,这样试下:
INPUT:M(26,5,300,30),N(2,0.1,10,1),SS(2,1,100,1);
MID : MA(CLOSE,M);
UPPER: MID + N*STD(CLOSE,M);
LOWER: MID - N*STD(CLOSE,M);
KD:CROSS(C,UPPER);
PD1:CROSS(MID,C);
PD2:((HHV(c,ENTERBARS+1)-c)/HHV(c,ENTERBARS+1))>=0.01;
平多2:SELL(PD2 and holding=ss,holding/2,market);
平多1:SELL(PD1,holding,market);
BUY(KD AND HOLDING=0,SS,MARKET);
INPUT:M(26,5,300,30),N(2,0.1,10,1),SS(2,1,100,1);
MID : MA(CLOSE,M);
UPPER: MID + N*STD(CLOSE,M);
LOWER: MID - N*STD(CLOSE,M);
KD:=CROSS(C,UPPER);
PD1:=CROSS(MID,C);
PD2:=((HHV(c,ENTERBARS+1)-c)/HHV(c,ENTERBARS+1))>=0.01;
KK:=CROSS(LOWER,C);
PK1:=CROSS(C,MID);
PK2:=(C-(LLV(c,ENTERBARS+1))/LLV(c,ENTERBARS+1))>=0.01;
平多2:SELL(PD2 and holding=ss,holding/2,market);
平多1:SELL(PD1,holding,market);
BUY(KD AND HOLDING=0,SS,MARKET);
平空2:SELLSHORT(PK2 and holding=-ss,holding/2,market);
平空1:SELLSHORT(PK1,holding,market);
BUYSHORT(KK AND HOLDING=0,SS,MARKET);
ss是手数,是你调整的参数。
INPUT:M(26,5,300,30),N(2,0.1,10,1),SS(2,1,100,1);
这几个都是参数。