2015年6月23日 星期二

陰陽線系列__執帶-__TXF

函數名稱  cs2bearbelthold
input: Leeway(numericsimple), GapPrice(numericseries), GapSize(numericsimple), LongBody(numericsimple), ATR(numericsimple),
 TrendPrice(numericseries), TrendFilter(numericseries);
var: body(0);
if c>o then body=c-o else body=o-c;
condition1= c<o and body>=avgtruerange(ATR)*longbody;
condition2= o>=h*((100-leeway)/100);
condition3= o>=gapprice[1]+avgtruerange(ATR)*gapsize;
condition4= trendprice>=trendfilter;
cs2bearbelthold= condition1 and condition2 and condition3 and condition4 ;

策略:
input:pmode_entry(1),pmode_exit(2),pexit(4),sl(130),tar(340),pp1(1),pp2(1),
TradeProfit(0.08),TradeStopLoss(0.017);
var:mp(0),pf(0),pl(0);
input: Leeway(0.1), GapPrice(Close), GapSize(1), LongBody(0.8), ATR(20),
 TrendPrice(Open[1]), TrendFilter(Lowest(open[1],5));

mp=marketposition;
pf = AvgPrice*TradeProfit ;
pl = AvgPrice*TradeStopLoss ;

condition99=cs2bearbelthold(leeway,GapPrice,GapSize,longbody,ATR,TrendPrice,TrendFilter);

if pmode_entry=1 then begin 
 if countif(condition99,4)[2]>=1 and mp=0
  then sellshort("sh1")next bar at market;
end;

if mp=-1 and barssinceentry=pexit then buytocover("ex S") next bar at market;
if mp=-1 then buytocover next bar at highest(h,4) stop;

setstopcontract;
setstoploss(minlist(pl*bigpointvalue));
setprofittarget(maxlist(pf*bigpointvalue));

這個策略次數非常少,績效普通,讀者可以自行測試

沒有留言:

張貼留言