ろうそく方向の統計的回帰研究

Игорь | 22 4月, 2016

はじめに

こんにちは。

私は以下の考えにみなさんの注意を引きたいと思います。やってくる短い時間間隔に対して、ろうそく足インディケータの定期的な傾向を基に、1日の特定時刻の市場動向を予想することは可能なのでしょうか?まず第一にそのような発生が検出されるなら、可能です。

基本的に、過去数日の間、特定の時刻にろうそくがつねに同方向であることが発見できるなら、それ自体が興味深いことでしょう。結局、どんなテクニカル分析も基本的には統計的に有意な関係を見つけ出すことに集約されるのです。


ろうそく足インディケータの反復的方向変更はトレンド変化を示すものです。

まずはいくつかの語に対して見解を統一します。こういった語は一般的に使用されているにもかかわらず、誤解を避けるために今一度すべてを見ていきます。ろうそくの始値が終値より低ければ、それはブル傾向のろうそくと呼ばれます(提供されている図では、それらは白で塗られています)。逆の場合は価格はベア価格です(黒で塗られています)。始値が終値に等しければ、これらのろうそくはイコールと呼ばれます(私独自の語です)。クオート価格が期間をとおして下がれば、この期間に対してはベア トレンドです。逆であればブル トレンドです。

グラフを見ます。

図1  USDJPY についてタイムフレーム4時間足のろうそく足チャート(20.11.2009~08.12.2008)

図1にあるように、トレンドがベアであれば、このトレンドを作り上げるろうそく足は主に弱気で、強気であれば、ろうそくもブルです。ラテラルであれば、ろうそくもつねに方向を変えます。

実際、われわれの問題は、ろうそくに回帰があるか、トレンド変化に関してそれがどのように変化するか判断することです

もちろん、これはすべてマニュアルで行うことができます。たとえば、時間ごとのグラフやその他あらゆるタイプのグラフを取り入れ、ろうそくの方向を紙に書き出し、しばらくの間それらを比較するのです。これはたいへんな作業ですが、行うことは可能です。しかし、われわれには MQL4 プログラム言語というすばらしいツールがあります。それを使って簡単に Expert Advisor を作成することができます。それはすべてを計算し、計算結果をくまなく知らせてくれるのです。

それには何が必要でしょうか。

  • 第1に、興味を引かれる期間を指定することができるはずです。100%の確率で各数年間毎日 7:15 にベアである15分足のろうそくはありそうにありません。ですが、このわずかなチャンスはまだあるため、少なくとも過去6か月のついてこれを検証する能力があります。
  • 第2に、考察対象期間にいくのつろうそくが強気でいくつが弱気だったか知ることは良いことでしょう。これまでの10日間に 18:00 にオープンする時間ごとのろうそくが6回強気で、6回弱気であった場合、この情報はなにか重大なことがらを提示しているであろうことは、みなさん同意されるはずです。ここで、10回のうち9回が弱気であったら、この情報は考慮すう必要があります。たとえば、どの方向に向けて本日18:00 にオープンするか判断するためです。
  • 第3に、ろうそくの始値と終値の間の距離や所定の期間の間のろうそくの平均高さを知ることも良いでしょう。
  • 4番目に、異なるタイムフレームで計算を行うことができるはずです。

これはすべて提供されているスクリプト- script_Statistics_candles 、の外部変数で定義されます。

以下の画像を見ます。

図2 スクリプトの入力パラメータ

図2 はスクリプトで変更可能な入力パラメータを示しています。

Open_session -学習セッションの開始時刻

Close_session - 学習セッションの終了時刻

Period_time -スクリプトがろうそくの回帰確率を考慮するタイムフレーム以下の値のうちの一つを取ります- 5, 15, 30, 60, 240。他でもなくこれらは許容値であることを覚えておいてください。従って、こういった値はグラフの期間-5、15、30分、1時間、4時間に対応します。

以下はこのスクリプトのコードです。コードにはできる限りのコメントを追加しています。というのも、私自身、MQL4 に関する教本で学習しているところで、このサイトにある Expert Advisor に、とりわけ細かくコメントのあるものに繰り返し戻っているからです。その他のものは除いて、本サイトにある記事は MQL4 を使用する最初の一歩を踏み出そうとしている方に対して教育的価値があるのは周知のことです。

//+------------------------------------------------------------------+
//|                                 script_Statistics_candles_V2.mq4 |
//|                              Copyright © 2009, Igor Aleksandrov  |
//|                                                sydiya@rambler.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Igor Aleksandrov"
#property link      "sydiya@rambler.ru"
#property show_inputs
//---- Input parameters

extern string  Open_session ="2009.11.20";   //Date of the opening of the studied session 
extern string  Close_session = "2009.11.26"; //Date of the closing of the studied session
extern int     Period_time = 60;             //Period of the graph on which the Expert Advisor will be working,
                                             //can take the value of 5;15;30;60;240
//-----------------------------------------------------------------
int 
    Day_bars_i;                      //Number for i bar in session
double
    Mas_vira_maina[24,60]={0,0 0,0}, //Declare an array for bars with an equal opening-closing price
    Mas_vira[24,60]={0,0 0,0},       //Declare an array for calculating bullish bars
    Mas_maina[24,60]={0,0 0,0},      //Declare an array for calculating bearish bars
    Mas_kol_vo[24,60]={0,0 0,0},     //Declare an array for calculating the number of the counted bars
    Mas_profit[24,60]={0,0 0.0},     //Declare an array of the calculation of profit by open-close
    Mas_H_L[24,60]={0,0 0.0};        //Declare an array of calculating the profit by high-low

string Symb;                         //Name of the financial. instrument on which the script is executed
bool New_day = false;                //Flag of the new day
//--------------------------------------------------------------------

//----------------------------Starting--------------------------------

int start()
  {                                  //-general opening bracket
  
  Print("----------------------------------------------------------------------");
  Print("  Results of the script's work- Statistics_candles- ",TimeToStr(TimeCurrent()) );
  Print("  Calculations completed from ",Open_session," to ",Close_session);

//------------------------Declare the variables ----------------------
  int  
       Hour_open_bars,                  //Number of the hour of opening the i bar in session
       Minute_open_bars,                //Number of the minute of opening  i bar in session
       Shift_open,                      //Number of bar with opening time Open_session               
       Shift_close,                     //Number of bar with opening time Close_session
       Shift_open_close,                //Number of bars in session
       Total_day=0;                     //Counter of counted days     
                    
  double Open_bars_price,               //Price of opening i bar of the session
         Close_bars_price,              //Price of closing the i bar of the session
         Low_bars_price,                //Minimum price of the i bar of the session
         High_bars_price,               //Maximum price of the i bar of the session
         Total_bars=0;                  //Number of studied bars at the start of the script
         
  datetime Time_open_session,           //Opening time of the first bar of the studied session 
                                        //in datatime format          
           Time_close_session,          //Opening time of the last bar of the studying 
                                        //session in datatime format 
           Time_open_bars;              //Opening time of bars in datatime format 
                       
  bool  Session_vira=false,             //Flag of the bullish session
        Session_maina=false;            //Flag of the bearish session 
//-----------------------End of the variables declaration ------------------
                   
  Symb=Symbol();                        //Name of the financial instrument
  
  //Request the starting time of the studied session in datatime format
  Time_open_session= StrToTime(Open_session); 

  //Request the closing time of the studied session in datatime format
  Time_close_session= StrToTime(Close_session); 

  //Request the number of the bar, opening the session
  Shift_open=iBarShift( Symb,Period_time, Time_open_session,false);

  //Request the number of the bar, which closes the session 
  Shift_close=iBarShift( Symb,Period_time, Time_close_session,false);

//---------------------------------------------------------------------  
for(int i = Shift_open; i>=Shift_close; i --)        //Cycle of bar searching in the session
{ //Opening bracket of the search cycle of bars
    Total_bars++;                                    //Counter of the number of studied bars
    static int New_day_shift=0;                      //Number of the day of starting the Expert Advisor

    //Request the opening of the i bar in session
    Time_open_bars=iTime( Symb,Period_time,Shift_open-Total_bars);

    //Request the opening hour of the i bar in session
    Hour_open_bars=TimeHour(Time_open_bars); 

    //Request the opening minute of the i bar in session 
    Minute_open_bars=TimeMinute(Time_open_bars);

    //Request the day number for the i bar in session
    Day_bars_i=TimeDayOfYear( Time_open_bars);
    
    //If the number for the first bar in session is not equal to the i-th bar of the day,then
    if(New_day_shift!=Day_bars_i)  
      {                                    
         New_day = true;               //flag for the new day is true
         New_day_shift=Day_bars_i;     //and assign the number for the number of the i bar
         Total_day++;                  //Increase the day counter by one
      }  
      else                             //otherwise,
      {
      New_day = false;                 //Flag for the new day is false
      }      
       //Request the opening price of the i-th bar
       Open_bars_price= iOpen( Symb, Period_time,i);

       //Request the closing price of the i-th bar
       Close_bars_price=iClose( Symb, Period_time,i);

       //Request the minimum price of the i-th bar
       Low_bars_price=iLow( Symb, Period_time,i);

       //Request the maximum price of the i-th bar
       High_bars_price=iHigh( Symb, Period_time,i);
        
       //If the opening price of the bar is lower than the closing price, then the session is bullish
       if(Open_bars_price<Close_bars_price) 
          {                                      
          //Increase by one the values of the corrsponding element
          Mas_vira[Hour_open_bars,Minute_open_bars]=Mas_vira[Hour_open_bars,Minute_open_bars]+1;

          //Increase by one the values of the corrsponding element
          Mas_kol_vo[Hour_open_bars,Minute_open_bars]=Mas_kol_vo[Hour_open_bars,Minute_open_bars]+1; 

          //Save the difference between the opening and closing price in points
          Mas_profit[Hour_open_bars,Minute_open_bars]=
          Mas_profit[Hour_open_bars,Minute_open_bars]+(Close_bars_price-Open_bars_price)/Point;

          //Save the difference between the maximum and minimum price in points
          Mas_H_L[Hour_open_bars,Minute_open_bars]=
          Mas_H_L[Hour_open_bars,Minute_open_bars]+(High_bars_price-Low_bars_price)/Point;
          }          

       //If the opening price of the bar is higher than the closing price, then the session is bearish
       if(Open_bars_price>Close_bars_price)
          {
           //Increase by one the values of the corrsponding element
           Mas_maina[Hour_open_bars,Minute_open_bars]=Mas_maina[Hour_open_bars,Minute_open_bars]+1;

           //Increase by one the values of the corrsponding element
           Mas_kol_vo[Hour_open_bars,Minute_open_bars]=Mas_kol_vo[Hour_open_bars,Minute_open_bars]+1; 

          //Save the difference between the opening and closing price in points
           Mas_profit[Hour_open_bars,Minute_open_bars]=
           Mas_profit[Hour_open_bars,Minute_open_bars]+(Open_bars_price-Close_bars_price)/Point;

          //Save the difference between the maximum and minimum price in points
           Mas_H_L[Hour_open_bars,Minute_open_bars]=
           Mas_H_L[Hour_open_bars,Minute_open_bars]+(High_bars_price-Low_bars_price)/Point;
          }

        //If the opening price is equal to the closing price, then session is undefined
        if(Open_bars_price==Close_bars_price)
          {
           ///Increase by one the corresponding array elements
           Mas_vira_maina[Hour_open_bars,Minute_open_bars]=Mas_vira_maina[Hour_open_bars,Minute_open_bars]+1;

           //Increase by one the corresponding array elements
           Mas_kol_vo[Hour_open_bars,Minute_open_bars]=Mas_kol_vo[Hour_open_bars,Minute_open_bars]+1; 
           
           //Leave the value of the array as is
           Mas_profit[Hour_open_bars,Minute_open_bars]=
           Mas_profit[Hour_open_bars,Minute_open_bars]+0;

           //Save the difference between maximum and minimum bar prices in points
           Mas_H_L[Hour_open_bars,Minute_open_bars]=
           Mas_H_L[Hour_open_bars,Minute_open_bars]+(High_bars_price-Low_bars_price)/Point;
          }                                                                          
      
} //Closing bracket of the bar search cycle
//--------------------------Print the information to the Expert Advisor Journal-------------------

Print("Processed - ",Total_day," days; ",Total_bars," bars, period ",Period_time," minutes");

for (int h=0; h<=23; h++) //Hours cycle
{
  for (int m=0; m<=60; m++) //Minutes cycle
   {
    if (Mas_kol_vo[h,m]!=0) //If the value of array is not equal to zero, then we continue counting
    {     
  Print("For the period there are ",Mas_kol_vo[h,m],
       " bars with the time of the opening ",h,":",m,
       " .Bullish- ",Mas_vira[h,m],
       ".Bearish- ",Mas_maina[h,m],
       ".Equal - ",Mas_vira_maina[h,m]);
  Print("For the bars with the opening time ",h,":",m,
       " ,average distance between the Open-Close prices - ",Mas_profit[h,m]/Mas_kol_vo[h,m],
       " points. Between the High-Low prices - ",Mas_H_L[h,m]/Mas_kol_vo[h,m]," points.");   
     }
           Mas_vira_maina[h,m]=0;  //set to zero
           Mas_vira[h,m]=0;        //set to zero
           Mas_maina[h,m]=0;       //set to zero
           Mas_kol_vo[h,m]=0;      //set to zero
           Mas_profit[h,m]=0;      //set to zero
           Mas_H_L[h,m]=0;         //set to zero
   } //End of the minute cycle
} //End of the hour cycle
             
Print("-------------- Script completed the work --------------------");

   return(0);    
  }                                        //-general closing bracket

おわかりのように、私は計算下のグローバルレベルで配列を6個知らせています。

double    
Mas_vira_maina[24,60]={0,0 0,0}, //Declare the bar array with an equal price of opening-closing
Mas_vira[24,60]={0,0 0,0},       //Declare the array for calculating the bullish bars
Mas_maina[24,60]={0,0 0,0},      //Declare the array for calculating the bearish bars
Mas_kol_vo[24,60]={0,0 0,0},     //Declare the array for calculating the number of counted bars
Mas_profit[24,60]={0,0 0.0},     //Declare the array for calculating the profit for open-close
Mas_H_L[24,60]={0,0 0.0};        //Declare the array for calculating the profit for high-low

Mas_kol_voバッファにはカウントされたバー本数をレコードします。これはなぜ必要なのでしょうか。特にコード- Total_day 、にカウンターがあるため、始値-終値、高値-安値に対するセル配列の値はカウントされた日数で割られるようです。ですが、スクリプトで作業する過程で、履歴上にバーがいくつか欠けていることがありました。それで、結果はひじょうにおもしろそうに見えました。たとえば、バーの一部に対して取得される高さは完全に非現実的なものでした。

残りの配列が何のために必要なのかは、コメントから明らかです。

ここで実際に、トレンドの異なる方向を持つバーの再現性を確認します。それには、図1で表示されている USDJPY についての時間ごとのグラフを取ります。見てわかるように、2009.11.20~2009.11.26 では、グラフはベア方向で、2009.11.20~2009.12.02 では横ばいトレンド、2009.12.02 ~2009.12.08 ではブルトレンドです。

この期間に反復しているろうそくがあるか確認し、もしあればその方向を見つけ出します。

スクリプトを時価単位のグラフに設定します。やり方がわからない方のために、詳細説明をします。スクリプト-script_Statistics_candles_V2.mq4, はフォルダ \Program Files\TerminalName\expert\scripts にダウンロードします。コピーします。スクリプトは『ナビゲータ』ウィンドウの左下角に表示されます。以下がそれです。

図3 ナビゲータ ウィンドウ

スクリプトをマウスでこのウィンドウからターミナルウィンドウにドラッグする場合は、図2 のプロパティ ウィンドウを見ます。計算の開始日付および終了日付を指定します。

われわれのアクションのロジックを理解するために、以下を考察ください。ベッドから出て朝一番にするのは、このスクリプトを実行することだと想像します。次に、その動作結果をテーブルに入力します。その例は以下のNo.1 の下にあります。みなさんの仕事は、スクリプトの結果に基づき翌日または翌々日に市場で何かおこるのか、理解しようとすることです。

よって、今日が2009年11月26日だとします。スクリプトを実行し、たとえば歴日過去6日のろうそくの統計に興味を持ちます。スクリプトのプロパティを次のように設定します。: Open_session - 2009.11.20 (6日前) Close_session - 2009.11.26 (本日)、計算に使用するタイムフレームは任意です。私は時間単位のグラフで行います。すなわち Period_time = 60 です。これを日常的に行い、スクリプトの開始と終了ごとに1日ずつ増やします。

これを履歴データに基づき行うこととします。

Expert Advisor フォルダ、「ログ」ファイルのプロパティで『OK』ボタンをクリックします。以下のエントリを確認します。

15:33:52 script_Statistics_candles_V2 EURUSD,H1: loaded successfully
15:33:53 script_Statistics_candles_V2 EURUSD,H1 inputs: Open_session="2009.11.20"; Close_session="2009.11.26"; Period_time=60;
15:33:53 script_Statistics_candles_V2 EURUSD,H1: ----------------------------------------------------------------------
15:33:53 script_Statistics_candles_V2 EURUSD,H1: Results of the script's work- Statistics_candles- 14:32
15:33:53 script_Statistics_candles_V2 EURUSD,H1: Calculations completed from 2009.11.20 to 2009.11.26
15:33:53 script_Statistics_candles_V2 EURUSD,H1: Processed - 5 days; 95 bars, period 60 minutes
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 3 bars with the time of the opening 0:0 .Bullish- 1.Bearish- 2.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 0:0,average distance between the Open-Close prices - 5.6667 points. Between the High-Low prices - 12 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 5 bars with the time of the opening 1:0 .Bullish- 2.Bearish- 2.Equal - 1
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 1:0,average distance between the Open-Close prices - 4.2 points. Between the High-Low prices - 11.8 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 2:0 .Bullish- 2.Bearish- 2.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 2:0,average distance between the Open-Close prices - 7 points. Between the High-Low prices - 16.25 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 3:0 .Bullish- 2.Bearish- 2.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 3:0,average distance between the Open-Close prices - 11.5 points. Between the High-Low prices - 25.25 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 4:0 .Bullish- 2.Bearish- 2.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 4:0,average distance between the Open-Close prices - 12.25 points. Between the High-Low prices - 21 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 5:0 .Bullish- 3.Bearish- 1.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 5:0,average distance between the Open-Close prices - 9.25 points. Between the High-Low prices - 17.75 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 6:0 .Bullish- 3.Bearish- 1.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 6:0,average distance between the Open-Close prices - 13.5 points. Between the High-Low prices - 22 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 7:0 .Bullish- 4.Bearish- 0.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 7:0,average distance between the Open-Close prices - 5.75 points. Between the High-Low prices - 15.25 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 8:0 .Bullish- 1.Bearish- 3.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 8:0,average distance between the Open-Close prices - 8.25 points. Between the High-Low prices - 22.75 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 9:0 .Bullish- 1.Bearish- 3.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 9:0,average distance between the Open-Close prices - 10.75 points. Between the High-Low prices - 22 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 10:0 .Bullish- 2.Bearish- 2.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 10:0,average distance between the Open-Close prices - 12.75 points. Between the High-Low prices - 34 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 11:0 .Bullish- 3.Bearish- 1.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 11:0,average distance between the Open-Close prices - 11.5 points. Between the High-Low prices - 26.75 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 12:0 .Bullish- 3.Bearish- 1.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 12:0,average distance between the Open-Close prices - 20.75 points. Between the High-Low prices - 24.5 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 13:0 .Bullish- 3.Bearish- 1.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 13:0,average distance between the Open-Close prices - 7 points. Between the High-Low prices - 18.5 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 14:0 .Bullish- 2.Bearish- 2.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 14:0,average distance between the Open-Close prices - 18.25 points. Between the High-Low prices - 31.75 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 15:0 .Bullish- 3.Bearish- 1.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 15:0,average distance between the Open-Close prices - 21.25 points. Between the High-Low prices - 34.25 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 16:0 .Bullish- 2.Bearish- 2.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 16:0,average distance between the Open-Close prices - 7 points. Between the High-Low prices - 23.75 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 17:0 .Bullish- 2.Bearish- 2.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 17:0,average distance between the Open-Close prices - 12.25 points. Between the High-Low prices - 31.75 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 18:0 .Bullish- 0.Bearish- 4.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 18:0,average distance between the Open-Close prices - 6.75 points. Between the High-Low prices - 31.75 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 19:0 .Bullish- 2.Bearish- 2.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 19:0,average distance between the Open-Close prices - 19.25 points. Between the High-Low prices - 28.25 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 20:0 .Bullish- 2.Bearish- 2.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 20:0,average distance between the Open-Close prices - 11.75 points. Between the High-Low prices - 21.75 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 21:0 .Bullish- 3.Bearish- 1.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 21:0,average distance between the Open-Close prices - 14 points. Between the High-Low prices - 20.75 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 4 bars with the time of the opening 22:0 .Bullish- 3.Bearish- 1.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 22:0,average distance between the Open-Close prices - 13.25 points. Between the High-Low prices - 26 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the period there are 3 bars with the time of the opening 23:0 .Bullish- 1.Bearish- 2.Equal - 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: For the bars with the opening time 23:0,average distance between the Open-Close prices - 7.6667 points. Between the High-Low prices - 15.6667 points.
15:33:53 script_Statistics_candles_V2 EURUSD,H1: -------------- Script completed the work --------------------
15:33:53 script_Statistics_candles_V2 EURUSD,H1: uninit reason 0
15:33:53 script_Statistics_candles_V2 EURUSD,H1: removed

動作結果をテーブルに入力します。ブルバー数を "B" 列に、ベアバー数を "M" 列に、バー『なし』の数はテーブルに入力しないこととします。

開始時刻 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
バータイプ
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
M
B
11.20-11.26
3 1 2 1 2 2 2 2 4 0 2 2 2 1 3 1 2 2 3 0 2 2 1 3 3 1 2 2 2 1 2 2 3 0 1 3 2 2 2 2 2 2 3 1 3 1 2 1
11.21-11.27
4 1 2 1 1 3 2 2 3 1 2 2 3 0 3 1 2 2 2 1 3 1 1 3 4 0 2 2 2 1 3 1 4 0 2 2 2 2 2 2 2 2 4 0 3 1 2 1
11.22-11.28
5 1 2 1 2 3 2 3 4 1 3 2 3 1 3 2 3 2 3 1 3 2 1 4 4 1 3 2 2 2 4 1 4 1 2 3 3 2 2 3 2 5 0 3 2 3 1
11.23-11.29
4 1 2 1 2 3 2 3 4 1 3 2 3 1 3 2 3 2 3 1 3 2 1 4 4 1 3 2 2 2 4 1 4 1 2 3 3 2 2 3 3 2 5 0 3 2 3 1
11.24-11.30
3 1 2 1 2 2 2 2 3 1 2 2 2 1 2 2 2 2 3 1 2 2 1 3 3 1 2 2 2 2 4 0 3 1 2 2 3 1 2 2 2 2 4 0 2 2 2 1
11.25-12.01
3 1 2 0 1 3 1 3 3 1 3 1 3 1 2 2 2 2 3 1 2 2 2 2 2 2 3 1 1 3 3 1 2 2 2 2 3 1 3 1 1 3 4 0 2 2 2 2
11.26-12.02
3 0 2 1 2 2 0 4 2 2 3 1 2 2 2 2 3 1 3 1 2 2 2 2 2 2 4 0 0 4 2 2 2 2 2 2 4 0 3 1 2 2 3 0 3 1 3 1
11.27-12.03
3 0 2 2 3 1 0 4 2 2 2 2 1 3 2 2 4 0 3 1 2 2 2 2 1 3 3 1 1 3 1 3 2 2 1 3 3 1 3 1 2 2 2 0 0 4 2 2
11.28-12.04
3 1 1 3 2 2 0 4 1 3 1 3 2 2 3 1 3 1 3 1 2 2 2 2 1 1 3 1 2 2 0 4 2 2 1 3 3 1 3 1 1 2 1 1 1 3 2 2
11.29-12.05
3 2 1 3 3 2 1 4 1 4 1 4 3 2 4 1 3 2 4 1 3 2 2 3 1 4 3 2 2 3 1 4 2 3 1 4 3 2 4 1 1 3 1 2 1 4 3 2
11.30-12.06
2 2 1 3 3 2 1 4 1 4 1 4 3 2 4 1 3 2 4 1 3 2 2 3 4 1 3 2 2 3 1 4 2 3 1 4 3 2 4 1 1 3 1 2 1 4 3 2
12.01-12.07
2 1 4 0 1 3 3 1 4 0 4 0 2 2 3 1 2 2 3 1 2 2 1 3 1 3 2 2 2 2 1 3 2 2 1 3 2 2 3 1 1 2 0 2 1 3 3 1
12.02-12.08
2 2 1 4 3 1 1 3 1 3 1 3 3 1 3 1 1 3 3 1 3 1 0 4 0 4 2 2 2 2 1 3 2 2 1 3 2 2 3 1 1 2 1 2 1 3 3 1

テーブル 1  Expert Advisor の動作結果

それでは結果を見ましょう。まず最初に、バーの一部は同時期に同方向であることが判りました。これは特に興味深いことです。セルは異なる色で塗られていることに注意が必要です。私は過去6日間のベアバーだけを持つセルを黄色で、ブルバーだけのセルをピンクでマークしました。

11月26日、過去6日間、4時、9時、16時の開始時刻でバーはすべてベアであったことがわかります。ベアは本日強く、おそらく明日は市場が弱気になると考えられます。

11月27日。予測は的中しました。スクリプト結果は、過去6日間、6時、12時、16時、21時、ろうそくは弱気のみで、そのため市場は弱気を継続すると考えられます。

11月28日。予測は的中しました。過去6日にわたり、弱気のろうそく本数は減少しました。21イのみ完全に弱気でした。ベアトレンドは終わり、まもなく方向は変更すると予想されます。

11月29日、30日、1月1日、2日は同じ状況です。横ばいトレンドです。興味深いことに、1月2日以降、ブルのろうそくのみ出現し始め、トレンドが移動すると考え、日が経つにつれ、仮説が正しかったことを知るのです。

12月5日と6日についてはおもしろい状況を目撃します。ろうそくが同じ方向に傾く時間の途切れ目は一切ありません。何かが起こるに違いありません。ですが、ターミナルを見るとき、これら奇妙な日は週末であることがわかって安心します。

12月7日、再び多方向のろうそくがあり、再びトレンドの変化を待っています。

12月8日、11時、12時にまぎれないブルのろうそくを得ます。図1では、トレンドは弱気のようでしょうか?ターミナルを見れば、12時ごろにトレンドが横ばいとなり、12月9日、ブルトレンドに変わるのを知って驚きます。

そうです。見てのとおり、この方法は100%保証するものではなく、それができるツールはまだないのです。しかしそれはひじょうに価値あるもので、テクニカル分析の他の方法と併せて、翌日、翌々日の市場動向を予想するのにひじょうに役立ちます。



おわりに

本稿執筆にあたり、私は自分自身に3つの目標を定めました。

  • 第1に、MQL4 言語を学習する必要性を示すことです。それにより、みなさんのトレード分析力は各段に伸びるのです。そして異なる時間間隔や通貨ぺアに対するろうそくの回帰について個別に分析することに興味ある方にそれらを提供することです。
  • 第2に、履歴の異なる間隔で繰り返されるろうそくがあるのかどうか確認することです。数日の間に同一開始時刻を持つろうそくの一部が同じ方向を維持していることは私にとっての発見でした。
  • そして第3に、ろうそくの方向変化はトレンド方向の変化を予想するためのツールとしての役目を果たすかどうか確認する、ということです。

1本の記事では、異なる時間グラフでろうそくの変動をあまり深く分析できなかったのは明らかです。また、そもそもそうするつもりもありませんでした。皆さんは特に興味を引かれるこれらペアとタイムフレームを調査し、分析することができます。スクリプトは添付ファイル内にあります。

最後まで読んでいただきありがとうございました。