Phil's System策略的修改版--by EasyTrader
語法:TS2000i
Inputs: ATRLen(10),Lvl(10),Pct(2.2);
Vars: Atr(0),Eb(0),LStop(0),Mp(0),HStop(0);
Atr=Average(TrueRange,ATRLen);
Mp=MarketPosition;
If
Mp<>1 and c[1]<o[1] and c[2]<o[2] and c[3]<o[3] and
H<Highest(H[1],3){ and
O>L[1] }{and Atr>Lvl} then begin
buy
this bar on close;
Eb=currentbar;
LStop=0;
end;
If
Mp<>1 and c[1]>o[1] and c[2]>o[2] and c[3]>o[3] and
L>Lowest(L[1],3) {and
O<H[1]}{ and Atr>Lvl} then begin
Sell
this bar on close;
Eb=currentbar;
HStop=99999;
end;
If
MP=1 and currentbar<>eb then begin
LStop=Maxlist(LStop,high-EntryPrice*Pct/100);
ExitLong next bar LStop stop;
end;
If
MP=-1 and currentbar<>eb then begin
HStop=Minlist(HStop,Low+EntryPrice*Pct/100);
ExitShort next bar HStop stop;
end;
*ps: TS2000i與MC的語法只差在吧Exitlong改成Sell、ExitShort改成Buytocover就差不多了。
回測結果:
0 留言:
張貼留言
如果有私人問題想請教,請透過網站右方『與站長聯絡』之表單,謝謝!