*

Trend Intensity Index を使った EA(2) Damiani filter版

公開日: : 最終更新日:2015/02/24 マネー

以前の記事で紹介した Trend Intensity Index(TII) という指標で作った EA ですが、Damiani フィルタにより ノントレンドのときのエントリをカットしてみました。

バックテスト結果(2014/1/1-2015/1/4)USDJPY 1時間足

プロフィットファクター 1.69、勝率 39.84%、最大ドローダウン 15.37% と若干改善。資金は 2.26倍に。

もう少し効きのいいフィルタがほしいですが。

ちなみに改善前

収益曲線

ちなみに改善前

ドローダウンは見るからに改善しましたね。Damiani、やるじゃん。

関連記事

プログラムソース

//
//    yasciiTII03
//            with Damiani
//   動作には TII_RLH.ex4 が必要

//マジックナンバーの定義
#define MAGIC  42239        

//パラメーターの設定//
extern double Lots = 1.0;     //取引ロット数
extern int Slip = 10;         //許容スリッページ数
extern string Comments =  "TII03"; //コメント

extern int Major_Period=16;
extern int Minor_Period=11;
int Major_MaMode=1; //0=sma, 1=ema, 2=smma, 3=lwma, 4=lsma
extern int Major_PriceMode=0;//0=close, 1=open, 2=high, 3=low, 4=median(high+low)/2, 5=typical(high+low+close)/3, 6=weighted(high+low+close+close)/4
color LevelColor=Silver;
extern int BuyLevel=35;
int MidLevel=50;
extern int SellLevel=77;
extern int R1Level=3;
extern int R2Level=97;
extern int Fast_period = 14 ;
extern double margin = 0.0 ;

extern double ILC = 60.0 ;

//---- input parameters damiani_filter用
extern int       Viscosity=13;
extern int       Sedimentation=50;
extern double    Threshold_level=1.3;
extern bool      lag_supressor=true;

//変数の設定//
int Ticket_L = 0; //買い注文の結果をキャッチする変数
int Ticket_S = 0; //売り注文の結果をキャッチする変数
int Exit_L = 0;   //買いポジションの決済注文の結果をキャッチする変数
int Exit_S = 0;   //売りポジションの決済注文の結果をキャッチする変数
int OS1 ;
int OS2 ;
double   OOPL;
double   OOPS;

//damiani_filter用
double    lag_s_K=0.5;
double   s0 = 0; 
double   s1= 0;
double   s2 = 0;
double   s3 = 0;
double   vol=0;
double t=Threshold_level;

int damiani_f()
{

      double sa=iATR(NULL,0,Viscosity,1);
      double ia = iATR(NULL,0,Sedimentation,1) ;
      if(lag_supressor){
         if (ia == 0) vol = 1.0 ;
         else vol= sa/ia + lag_s_K*(s1-s3);   
      }else{
         if (ia == 0) vol = 1.0 ;
         else vol= sa/ia;   
      }

      double anti_thres=iStdDev(NULL,0,Viscosity,0,MODE_LWMA,PRICE_TYPICAL,1);

      double isd = iStdDev(NULL,0,Sedimentation,0,MODE_LWMA,PRICE_TYPICAL,1) ;
      if (isd == 0) anti_thres = 1.0 ;
      else anti_thres = anti_thres/isd ;

      t=t-anti_thres;

      s3 = s2; s2 = s1; s1= s0; 
      s0 = vol;

      if (vol>t){
      	return(1);
      }else{
      	return(0);
      }
}

int start(){

    //暴落対策(始め)

   double FastHH1 = Close[iHighest(NULL, 0, MODE_CLOSE, Fast_period, 1)];
   double FastLL1 = Close[iLowest(NULL, 0, MODE_CLOSE, Fast_period, 1)];

   //買いポジションのエグジット
   OS1 = OrderSelect(Ticket_L, SELECT_BY_TICKET);  
   if( Bid < FastLL1-margin 
       && ( Ticket_L != 0 && Ticket_L != -1 ))
    {     
      Exit_L = OrderClose(Ticket_L,Lots,Bid,Slip,Red);
      if( Exit_L ==1 ) {Ticket_L = 0;}
    }    

   //売りポジションのエグジット
   OS2 = OrderSelect(Ticket_S, SELECT_BY_TICKET); 
   if( Ask> FastHH1+margin
       && ( Ticket_S != 0 && Ticket_S != -1 ))
    {     
      Exit_S = OrderClose(Ticket_S,Lots,Ask,Slip,Blue);
      if( Exit_S ==1 ) {Ticket_S = 0;} 
    }   

   //暴落対策(終わり)

    if (Volume[0]>1 || IsTradeAllowed() == false) return(0) ;

       double tii1 = iCustom(NULL, 0,"TII_RLH", Major_Period, Major_MaMode, Major_PriceMode, Minor_Period, LevelColor , BuyLevel, MidLevel , SellLevel, 0 , 1);
       double tii2 = iCustom(NULL, 0,"TII_RLH", Major_Period, Major_MaMode, Major_PriceMode, Minor_Period, LevelColor , BuyLevel, MidLevel , SellLevel, 0 , 2);
       double tii3 = iCustom(NULL, 0,"TII_RLH", Major_Period, Major_MaMode, Major_PriceMode, Minor_Period, LevelColor , BuyLevel, MidLevel , SellLevel, 0 , 3);       
       double tii4 = iCustom(NULL, 0,"TII_RLH", Major_Period, Major_MaMode, Major_PriceMode, Minor_Period, LevelColor , BuyLevel, MidLevel , SellLevel, 0 , 4);   
       double tiiSM1 = (tii1+tii2+tii3) / 3.0 ;
       double tiiSM2 = (tii4+tii2+tii3) / 3.0 ;

   double lc = ILC;
   if(( Digits ==3 ) ||(Digits ==5)) lc = lc*10.0 ;

   //買いポジションのエグジット
    OS1 = OrderSelect(Ticket_L, SELECT_BY_TICKET);  
    OOPL = OrderOpenPrice();
    if(    ((tii1 < R2Level && tii2 > R2Level) || (tii1 < tiiSM1 && tii2 > tiiSM2 && tii1 > BuyLevel && tii1 < R2Level) || ( OOPL - lc*Point >= Close[1] ) ) 
            && ( Ticket_L != 0 && Ticket_L != -1 ))
    {     
      Exit_L = OrderClose(Ticket_L,Lots,Bid,Slip,Red);
      if( Exit_L ==1 ) {Ticket_L = 0;}
    }    

   //売りポジションのエグジット
   OS2 = OrderSelect(Ticket_S, SELECT_BY_TICKET); 
   OOPS = OrderOpenPrice();
   if(    ((tii1 > R1Level && tii2 < R1Level )|| (tii1 > tiiSM1 && tii2 < tiiSM2 && tii1 > R1Level && tii1 < SellLevel)||( OOPS + lc*Point <= Close[1] ) ) 
          && ( Ticket_S != 0 && Ticket_S != -1 ))
    {     
      Exit_S = OrderClose(Ticket_S,Lots,Ask,Slip,Blue);
      if( Exit_S ==1 ) {Ticket_S = 0;} 
    }   

   //買いエントリー
   if( ((tii1 > BuyLevel && tii2 < BuyLevel) || (tii1 > tiiSM1 && tii2 < tiiSM2 && tii1 > BuyLevel && tii1 < R2Level) ) && damiani_f() ==1
       && ( Ticket_L == 0 || Ticket_L == -1 ) 
       && ( Ticket_S == 0 || Ticket_S == -1 ))
    {  
      Ticket_L = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip,0,0,Comments,MAGIC,0,Red);
    }

   //売りエントリー
   if(( (tii1 < SellLevel && tii2 > SellLevel) || (tii1 < tiiSM1 && tii2 > tiiSM2 && tii1 > R1Level && tii1 < SellLevel)) && damiani_f() ==1
       && ( Ticket_S == 0 || Ticket_S == -1 )
       && ( Ticket_L == 0 || Ticket_L == -1 ))
    {   
      Ticket_S = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slip,0,0,Comments,MAGIC,0,Blue);     
    } 

   return(0);

  }
// 終わり

###

関連記事

[FX] 千里眼FX というシステム

山崎毅さんの「千里眼FX」というトレーディングシステムがあるようです。 結構高いです。

記事を読む

KOSPI ベアETN が熱い (2)

「KOSPI ベアETN が熱い 」の続きです。 KOSPI ベアETN とは韓国の株

記事を読む

2026/2/5 株式市場そろそろ調整?

現在アメリカの大手企業の業績発表が続いており、個別株では悲喜交々な状況ですが、米株も日本株も

記事を読む

【FX】Connect Safe Forex EA(2)

以前紹介した自動売買ソフト(EA)の「【FX】Connect Safe Forex EA」ですが、デ

記事を読む

幸せな経済自由人の金銭哲学 マネー編 / 本田健(3)

幸せな経済自由人の金銭哲学 マネー編 (ゴマ文庫)本田 健 ゴマブックス 200

記事を読む

一生かかっても知り得ない 年収1億円思考 / 江上 治

一生かかっても知り得ない 年収1億円思考 江上 治 経済界 2011-01-2

記事を読む

[FX] 12月に入って相場急変

11/8 から先週(11/30)まで続いたドル円上昇相場(上図はドル円 15分足 )が今週か

記事を読む

【FX】 Price Action Scalping という EA

またまた面白い自動売買ソフト(EA)を見つけました。Price Action Scalping とい

記事を読む

令和3年分確定申告

令和3年分確定申告 本日、令和3年分確定申告に税務署に行ってきました。 今回は申告書を全部書

記事を読む

【FX】Voorloper という EA(2) 同時トレード数と通貨ペア数の変更

「【FX】Voorloper という EA」の続きです。 含み損が増えたのはマーチンゲール倍数

記事を読む

Message

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

2026-3-9 日経平均も下げ

イラン戦争のおかげで全世界株安のようです。 ハメネイ氏の次男をイラン

凶器・・・なのか

先週、自宅のマンションの共用庭でステンレスの包丁が発見されました。

【FX】half-trend-buy-sell-indicator というインジケーター

half-trend-buy-sell-indicator というイン

イラン戦争どうなる?

制空権を完全に失ったイランですが、海軍もほぼ全滅状態のようですね。

Tracers NASDAQ100ゴールドプラス

Tracers NASDAQ100ゴールドプラス は アモーヴァ・アセ

→もっと見る

  • 2026年3月
     1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031  
  • アクセスカウンター
PAGE TOP ↑