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));

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

2015年6月19日 星期五

陰陽線系列__執帶+__TXF

形態描述:多頭執帶是一根光腳陽線,它是指在下跌趨勢中,股價大幅跳空低開,開盤價與前一天收盤價形成一個較大的跳空缺口,開盤價就是當天的最低價,之後逆勢走高,並以接近最高價的價格收盤。多頭執帶的辨認方法: 1、開盤價就是當天的最低價,因此沒有下影線。2、開盤價與前一天的K縣實體之間有一個較大的跳空缺口。 3、收盤價接近當天最高價,但並不一定是最高價 多頭執帶蘊含的市場心理 股價繼續在下跌趨勢中運行,空方仍舊掌握市場,當股價以低於前一天收盤價的價格開盤。由於之前的連續下跌以及大幅跳空,使空方動能基本上得到釋放,與此同時,多方力量開始積聚,於是價格在買盤的推升下逐步走高,甚至引發了空頭的回補,從而進一步推動價格上漲,最終股價以接近當天最高價收盤。
 注意事項:1、多頭執帶的實體越長,向上反轉的力度越大。2、多頭執帶是否能形成反轉,需要次一交易日市場價格的確認,次一交易日價格繼續上漲,投資者方可介入做多




函數名稱 cs2bullbelthold

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<=l*((100+leeway)/100);
condition3= o<=gapprice[1]-avgtruerange(ATR)*gapsize;
condition4= trendprice<=trendfilter;

cs2bullbelthold= 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.048),TradeStopLoss(0.015);
vars: daycount(0),mp(0),isBalanceDay(false),pf(0),pl(0);
input: Leeway(0.11), GapPrice(Close), GapSize(0.6), LongBody(0.5), ATR(20),
 TrendPrice(Open[1]), TrendFilter(Lowest(open[1],5));  
  
Var:    NShares(1),
        TotalEquity(0),
        TradeRisk(0),beforenetprofit(0);

if DAYofMonth(Date next bar) > 14 and DAYofMonth(Date next bar) < 22 and DAYofWeek(Date next bar)= 3 then isBalanceDay = True else isBalanceDay =False ;
 mp=marketposition;

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

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

 if condition99[1] 
 then buy("b1")NShares contract next bar at market;

if pmode_exit=2 then begin
  if mp=1 then sell("s l") next bar at lowest(l,4) stop; 
  if mp=1 and barssinceentry=pexit  then sell("ex L") next bar at market;
end;

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




後記:交易次數不多,但是賺賠比高.勝率高,接下來測試印度.A50再與讀者分享

2015年6月14日 星期日

陰陽線系列__三星

    今天的主題是三星,這種型態非常罕見,所以出現時先檢查資料看有無錯誤.型態結構內的跳空缺口,假如連影線也沒重疊,反轉意涵更強.
input:pmode_entry(1),pmode_exit(2),pexit(4),sl(130),tar(340),pp1(1),pp2(1),
      TradeProfit(0.069),TradeStopLoss(0.012);
vars: daycount(0),mp(0),isBalanceDay(false),pf(0),pl(0);
input:  Leeway(0.1), GapPrice1(Close), GapPrice2(Close), 
        TrendPrice(Open[1]), TrendFilter(Lowest(open[1],5));  
Var:    NShares(1),
        TotalEquity(0),
        TradeRisk(0),beforenetprofit(0);

if DAYofMonth(Date next bar) > 14 and DAYofMonth(Date next bar) < 22 and DAYofWeek(Date next bar)= 3 then isBalanceDay = True else isBalanceDay =False ;
 mp=marketposition;

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

condition99=csbulltristar(leeway,GapPrice1,gapprice2,trendprice,trendfilter);

 if condition99[1] 
 then buy("b1")NShares contract next bar at market;

if pmode_exit=2 then begin
  if mp=1 then sell("s l") next bar at lowest(l,4) stop; 
  if mp=1 and barssinceentry=pexit  then sell("ex L") next bar at market;
end;

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


函數名稱  csbulltristar

input: Leeway(numericsimple), GapPrice1(numericseries), GapPrice2(numericseries), 
 TrendPrice(numericseries), TrendFilter(numericseries);

var: cs(0), body(0), doji(0);
cs=0;
doji=0;
if c>o then body=c-o else body=o-c;
if c>=o and c<=o*((100+leeway)/100) then doji=1;
if c<=o and c>=o*((100-leeway)/100) then doji=1;

condition1= doji=1 and doji[1]=1 and doji[2]=1;
condition2= gapprice2[1]<gapprice1[2] and gapprice2[1]<gapprice1;
condition3= trendprice<=trendfilter;


csbulltristar= condition1 and condition2 and condition3 ;

後記:
  按照原始的定義在TXF只出現過2次,都是在2013年,EXF.FXF.印度A50都沒出現過,所以書上的定義是嚴謹的,接下來我們要試著把條件放寬,觀察結果..............................待續


2015年6月11日 星期四

陰陽線系列__光腳陰線---台指期續

    我加入了rsi(c,14)[1]>35以及開高開低等濾網始終找不到滿意的,光腳陰線在台指的測試到此為止,之後對A50.日經測試完再與讀者分享

2015年6月10日 星期三

陰陽線系列__光腳陰線---台指期

  繼續上一篇的測試,在TXF的測試報告如下


 
  看起來在台指的表現不好,接下來加入一些濾網看是否可以改善

2015年6月3日 星期三

陰陽線系列__光腳陰線





----------------------圖文引用自MBA智庫


函數: csbearclosemarubo

[LegacyColorValue = TRUE];
input: Leeway(numericsimple), LongBody(numericsimple), ATR(numericsimple);
var: body(0);

if c>o then body=c-o else body=o-c;

condition1= c<o and body>=avgtruerange(ATR)*longbody;
condition2= c<=l*((100+leeway)/100);

csbearclosemarubo= condition1 and condition2 ;

策略

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.09), GapPrice(Close), GapSize(1), LongBody(0.9), ATR(15);

mp=marketposition;

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

condition99=csbearclosemarubo(leeway,longbody,atr);

if pmode_entry=1 then begin
 if countif(condition99,3)[0]>=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));


印度指數 2008---現在 成本: 10美元













感想:

陰陽線是日本人研究出來的 沒想到過了2-300年 到現在還 有效,真令人欽佩, 在此我提供原型,其他的就交由讀者盡情發揮,多方面的測試總是會帶給我們許多意想不到驚喜







陰陽線系列__光頭陽線__印度_追蹤


  出師不利  昨天就停損出了
  昨天提到的  可以用程式碼控制滑價
  但是要小心沒成交到   眼看著行情噴出
  手上卻沒單  內傷  
    
  果然是按下了葫蘆 又浮起了瓢
  有一好無二好啊
  
   另外這次的LOSS  想起在王慶津的書(書名:
   交易訊號與直覺操作) 有提到的豬羊變色
   把這加到策略中  果然可以提升
  

    後記:

      多方面的測試單策略多商品,可以讓我們看到 策略  在各種      情況下的執行狀況,去看一進場就LOSS的情況,思索為何一上 場就和自己的小朋友"掰掰",找到問題後,再對幾個商品下去跑,假如都可以改善, 那麼我們就有較大的信心相信在未來可以 獲利  

2015年6月2日 星期二

陰陽線系列__光頭陽線__印度


 這個陰陽線型態  我把它拿來外期操作  

印度指數       2008---現在         成本:  10美元




  實際交易時  會有滑價等情形發生   像今天早上做印度滑了10點  

  改進方式有2種  11:45---18:15  才交易 
   或是在程式中寫法要修正為  觸發價  stop  觸發價+10 LIMIT
   這樣就算滑價也可以控制在可接受的範圍





2015年6月1日 星期一

陰陽線系列__光頭陽線


光頭陽線若出現在低價位區域,在分時走勢圖上表現為股價探
底後逐浪走高且成交量同時放大,預示為一輪上升行情的開
始。如果出現在上升行情途中,表明後市繼續看好
                                      ----------------------圖文引用自MBA智庫


函數:csbullclosemarubo


input: Leeway(numericsimple), LongBody(numericsimple), ATR(numericsimple);

var: body(0);
if c>o then body=c-o else body=o-c;

condition1= c>o and body>=avgtruerange(ATR)*longbody;
condition2= c>=h*((100-leeway)/100);


csbullclosemarubo= condition1 and condition2 ;


程式

input:pmode_entry(1),pmode_exit(2),pexit(4),sl(130),tar(340),pp1(1),pp2(1),
      TradeProfit(0.069),TradeStopLoss(0.012);
vars: daycount(0),mp(0),isBalanceDay(false),pf(0),pl(0);
  
input: Leeway(0.1), GapPrice(Close), GapSize(1), LongBody(1), ATR(20);
Var:    NShares(1),
        TotalEquity(0),
        TradeRisk(0),beforenetprofit(0);

if DAYofMonth(Date next bar) > 14 and DAYofMonth(Date next bar) < 22 and DAYofWeek(Date next bar)= 3 then isBalanceDay = True else isBalanceDay =False ;
 mp=marketposition;

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

condition99=csbullclosemarubo(leeway,longbody,atr);

 if condition99[1] 
 then buy("b1")NShares contract next bar at market;

if pmode_exit=2 then begin
  if mp=1 then sell("s l") next bar at lowest(l,4) stop; 
  if mp=1 and barssinceentry=pexit  then sell("ex L") next bar at market;
end;

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

商品  TXF  日K  測試期間 2005--2015   成本 1000元 






交易次數不多  但策略原型  就有如此的好表現  
讀者可再深入研究




特殊模式2---- 追蹤

  今天開盤點附近出掉 獲利接近百點  小賺出場
  希望下次可以來個大發的