*

スローな TII にしてくれ

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

TII をさらに使いやすくする方法を考えました。

下のチャートのサブウィンドウに3種類の TII すなわち、

  1. オリジナルの TII
  2. TII にシグナルを付加したもの(自作)
  3. TII のシグナルをさらに平滑化したシグナルのシグナルを付加したもの(自作)

を表示してみました。

 

スローストキャステクスっぽくなってしまいましたネ。

*

この手の指標は 0からの上離れと 100からの下離れを売買指標にするわけ(一番下のサブウィンドウでの↑↓の部位)ですが、それはこの3種類のどれでも簡単に判定できます。

問題は 50付近での絡み合いの部分です(○で囲った部分)。

ここで S字カーブを描いたり、場合によっては元来た方へ戻る場合があり、それぞれの処理が必要となります。

S字カーブを描いたりする場合、右の○のように TII が連峰状(六ヶ岳?)になるとシグナルがない場合はドテン売買がその都度発生し、ロスがふくらみます。

シグナルとのクロスで 2回までに減らせますし、シグナルと「シグナルのシグナル」とのクロスではパラメーター次第ですがさらに回数を減らせます。

*

裁量の方にはたいした違いはないのですが、EA化するのには重要な処置になります。

関連記事

*

プログラムソース(オリジナルの TII_RLH を改変)

//+--------------------------------------------------------------------+
//|                                                   TII_RLH_S2       |
//|                                    Copyright ゥ 2006, Robert Hill   |
//|                                       http://www.metaquotes.net/   |
//+--------------------------------------------------------------------+                                                                   |

#property  copyright "Copyright 2006, Robert Hill "
#property  link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 3
#property  indicator_color1  Red
#property  indicator_color2  Aqua
#property  indicator_color3  Green

#property  indicator_width1  2
#property  indicator_width2  1
#property  indicator_width3  1

//----
extern int Major_Period=60;
extern 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
extern int Minor_Period=30;
extern color LevelColor=Silver;
extern int BuyLevel=20;
extern int MidLevel=50;
extern int SellLevel=80;

extern int SigPeriod1 = 8;
extern int SigPeriod2 = 10;

//---- buffers
double ma[];
double ma_dev[];
double tii[];

double tiis[];
double tiis2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   IndicatorBuffers(5);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexDrawBegin(0,Major_Period);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2);
//---- 3 indicator buffers mapping
   SetIndexBuffer(0,tii);
   SetIndexBuffer(1,tiis);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,Major_Period);

   SetIndexBuffer(2,tiis2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexDrawBegin(2,Major_Period);

   SetIndexBuffer(3,ma_dev);
   SetIndexBuffer(4,ma);

//---- name for DataWindow and indicator subwindow label
   IndicatorShortName(" TII  ,  Major_Period ( "+Major_Period+" )  ,  Minor_Period  ( "+Minor_Period+" ), ");
   SetLevelStyle(STYLE_DASH,1,LevelColor);
   SetLevelValue(0,BuyLevel);
   SetLevelValue(1,MidLevel);
   SetLevelValue(2,SellLevel);
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| LSMA with PriceMode                                              |
//| PrMode  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  |
//+------------------------------------------------------------------+
double LSMA(int Rperiod,int prMode,int shift)
  {
   int i;
   double sum,pr;
   int length;
   double lengthvar;
   double tmp;
   double wt;
//----
   length=Rperiod;
   sum=0;
   for(i=length; i>=1;i--)
     {
      lengthvar=length+1;
      lengthvar/=3;
      tmp=0;
      switch(prMode)
        {
         case 0: pr=Close[length-i+shift];break;
         case 1: pr=Open[length-i+shift];break;
         case 2: pr=High[length-i+shift];break;
         case 3: pr=Low[length-i+shift];break;
         case 4: pr=(High[length-i+shift] + Low[length-i+shift])/2;break;
         case 5: pr=(High[length-i+shift] + Low[length-i+shift] + Close[length-i+shift])/3;break;
         case 6: pr=(High[length-i+shift] + Low[length-i+shift] + Close[length-i+shift] + Close[length-i+shift])/4;break;
        }
      tmp =(i - lengthvar)*pr;
      sum+=tmp;
     }
   wt=sum*6/(length*(length+1));
//----
   return(wt);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int i,j,limit;
   double sdPos,sdNeg;

   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   if(counted_bars==0) limit-=1+MathMax(Major_Period,Minor_Period);

//----
   for(i=limit; i>=0; i--)
     {
      if(Major_MaMode==4)
        {
         ma[i]=LSMA(Major_Period,Major_PriceMode,i);
        }
      else
        {
         ma[i]=iMA(NULL,0,Major_Period,0,Major_MaMode,Major_PriceMode,i);
        }
      ma_dev[i]=Close[i]-ma[i];
     }
//========== COLOR CODING ===========================================               
   for(i=0; i<=limit; i++)
     {
      sdPos=0;
      sdNeg=0;

      for(j=i;j<i+Minor_Period;j++)
        {
         if(ma_dev[j]>=0) sdPos=sdPos+ma_dev[j];
         if(ma_dev[j]<0) sdNeg=sdNeg+ma_dev[j];
        }
      tii[i]=100*sdPos/(sdPos-sdNeg);
     } 
   for(i=0; i<=limit; i++)
     {
      tiis[i] = iMAOnArray(tii,0,SigPeriod1,0,MODE_EMA,i); 
     }
   for(i=0; i<=limit; i++)
     {
      tiis2[i] = iMAOnArray(tiis,0,SigPeriod2,0,MODE_EMA,i); 
     }

//----
   return(0);
  }

//+------------------------------------------------------------------+

###

関連記事

【FX】2本の EMA と 1本の CCI を使う EA

昨日の記事「2本の CCI をフィルタに使う EA」では、短期と中期の CCI を0より上か下かとい

記事を読む

【FX】Hippo Trader という EA

Hippo Trader という EA 1ヶ月ほど前に Hippo Trader という EAが紹

記事を読む

【FX】TrendScalp という EA

昨夜は 夕食に食べすぎたのと 昼間の疲れで そのまま寝てしまい、ブログが書けませんでした。 本

記事を読む

曜日特性(2)

前回の記事「曜日特性」のモデルですけど、実際に運用するとどんなことになるのか検証してみました。

記事を読む

超シンプルな自動売買プログラム(11) 前週の平均値と逆張り(2) 曜日属性

以前の記事「超シンプルな自動売買プログラム(11) 前週の平均値と逆張り」ですが、月曜日に買って

記事を読む

ようやく米国株下落の終焉?

昨夜 2023/11/3 の米雇用統計の発表で、今年中の利上げはまずなくなりそうだという見込みが強く

記事を読む

【FX】Fintokei チャレンジ開始

昨日の記事「【FX】プロップファームの Fintokei について」の続きです。 今朝、Fin

記事を読む

コワ~い不動産の話 / 宝島社編集部

コワ~い不動産の話 (宝島SUGOI文庫 A た 5-1) 宝島社編集部 宝

記事を読む

アメリカ高配当株投資で初の配当金

アメリカ株投資を先月始めたところです。 個別株は危険なので、ファンド(投資信託)と ETF(上

記事を読む

【FX】IS White という EA

昨日は「【FX】IS Black という EA」を紹介したので、同じ作者による「IS White」を

記事を読む

Message

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

MetaのAI

Meta も AI を提供していて Meta AI と言います(そのま

吉田博作 日本の木版画 132枚セット

吉田博の木版画132枚セットを844円でゲット Etsyで「

祭りと生殖行動

星野之宣や諸星大二郎のマンガにもよく取り上げられていますが、文化人類学

iiyama WQHD モニター ディスプレイ 31.5インチ ProLite XB3270QSU-B1 注文

壊れたモニタの代わりにアマゾンで、「iiyama WQHD モニター

Acer製 ディスプレイ EB321HQUBbmidphx 31.5インチ WQHD(2560 x 1440)/IPS 逝く

2019年1月に買った Acer製 ディスプレイ EB321HQUBb

→もっと見る

  • 2026年10月
    月 火 水 木 金 土 日
     1234
    567891011
    12131415161718
    19202122232425
    262728293031  
  • アクセスカウンター
PAGE TOP ↑