インディケータ: LinearRegSlope_V1

 

LinearRegSlope_V1:

線形回帰アルゴリズムに基づいた正規化されていないオシレータ。

LinearRegSlope V1

作者: Nikolay Kositsin

 

このLinearRegSlope_V1というインディケータを使ってEAを作ろうとしたのですが、 EAが出力するデータが同じ日時のインディケータのデータと異なって しまいます:

これが入力パラメータです。


enum Applied_price_      // Type of constant

  {

   PRICE_CLOSE_ = 1,     // Close

   PRICE_OPEN_,          // Open

   PRICE_HIGH_,          // High

   PRICE_LOW_,           // Low

   PRICE_MEDIAN_,        // Median Price (HL/2)

   PRICE_TYPICAL_,       // Typical Price (HLC/3)

   PRICE_WEIGHTED_,      // Weighted Close (HLCC/4)

   PRICE_SIMPLE,         // Simple Price (OC/2)

   PRICE_QUARTER_,       // Quarted Price (HLOC/4) 

   PRICE_TRENDFOLLOW0_,  // TrendFollow_1 Price 

   PRICE_TRENDFOLLOW1_   // TrendFollow_2 Price 

  };

//----indicator parameter

input Smooth_Method SlMethod=MODE_SMA; // Smoothing method

input int SlLength=12;                 // Smoothing depth

input int SlPhase=15;                  // Smoothing parameter

input Applied_price_ IPC=PRICE_CLOSE;  // Price constant

input int Shift=0;                     // Horizontal shift of the indicator in bars

input uint TriggerShift=1;             // Bar shift for the trigger 

これはiCustomの呼び出しです。パラメータのシーケンスとタイプは入力パラメータと同じです。

 ExtHandle=iCustom(_Symbol,_Period,"Examples\\Test_LinearRegSlope_V1",

                        SlMethod,

                        SlLength,

                        SlPhase,

                        IPC,

                        Shift,

                        TriggerShift

                        );

CopyBuffer関数を呼び出して インジケータのデータを取得します。

double RegSlopeBuffer[],TriggerBuffer[];

      ArraySetAsSeries(RegSlopeBuffer,true);

      ArraySetAsSeries(TriggerBuffer,true);

     if(CopyBuffer(ExtHandle,0,0,3,RegSlopeBuffer)!=3)

     {

      Print("CopyBuffer from iMA failed, no data");

      return;

     }

     printf("Open  RegSlopeBuffer [0] is %f", RegSlopeBuffer [0]);//for test

 

問題は インジケータの表示するデータとEAが表示するデータが異なることです。例えば、EAが表示するデータは以下の通りです。

2012.03.19 17:18:02 Core 1 2012.03.01 08:00:00 Open TriggerBuffer[0] は 0.160695 です。

ですが、インジケータのデータは-0.051651です。

ありがとうございます。