//類型:中長期通道突破
//版本:1.0
//修訂時間:2012.11.4
//Designed By Rogarz
//中間變量
input:m(50,5,300,30),N(1.25,0.1,10,0.1),d(30,1,100,1),ss(1,1,100,1);
variable:x:=50;
MID :
LOWER:MID - N*STD(CLOSE,M);//布林下軌
CYC:=enterbars+1,noaxis;//開倉至今的周期數(shù)
HC30:=ref(hhv(c,d),1);//30周期收盤價高點(diǎn)
LC30:=ref(LLV(c,d),1);//30周期收盤價低點(diǎn)
手?jǐn)?shù):=ss;
出場MA:ma(close,if(holding<>0,if(cyc>=40,10,51-cyc),50));
//交易條件
開多平空條件:=c>HC30 and h>ref(upper,1);//收盤價大于30周期收盤價最高值且最高價上穿上軌
開空平多條件:=c收盤價小于30周期收盤價最高值,且最低價下穿下軌
多頭出場條件:=c<</SPAN>出場MA and 出場MA
空頭出場條件:=c>出場MA and 出場MA>LOWER;
//交易系統(tǒng)
多頭出場:sell(多頭出場條件 and holding>0,手?jǐn)?shù),limitr,c);
空頭出場:sellshort(空頭出場條件 and holding<0,手?jǐn)?shù),limitr,c);
平空:sellshort(開多平空條件 and holding<0,手?jǐn)?shù),limitr,c);
平多:sell(開空平多條件 and holding>0,手?jǐn)?shù),limitr,c);
開空:buyshort(開空平多條件 and holding>=0,手?jǐn)?shù),limitr,c);
開多:buy(開多平空條件 and holding<=0,手?jǐn)?shù),limitr,c);
//注意先平后開原則。
請查看下面的鏈接。
http://help.shwebstock.com.cn/dispbbs.asp?boardid=14&id=372614&page=&star=1