0
(0)
名前:
HVR [ | cn ]
著者: ライター (2008.02.11 10:02)
ダウンロード済み: 1206
ダウンロード:
HVR 1
HVR.mq4 (2.9 キロバイト) 意見
著者: Albert, (idea and code into MQL2 - podval)

HVR indicator.

HVR 2
1 コメント 新しいコメントを投稿するには, お願いします ログイン また 登録

The following code displays both 6 & 10 HVR with 100 (all periods as params). Also for more periods on chart.

//+------------------------------------------------------------------+ 
//|                                                          HVR.mq4 | 
//|      著作権© 2005, Albert,(idea and code into MQL2 - podval) | 
//|      Refactored © 2010, Brewmanz (追加 2 HVR lines)               | 
//|                                                                  | 
//+------------------------------------------------------------------+ 
#property indicator_separate_window
//----
//#property indicator_minimum 0
//#property indicator_maximum 3
#プロパティindicator_buffers 3
//----
#property indicator_color1 Blue
#property indicator_color2 Purple

extern int PeriodLong=100;
extern int PeriodShort=10;
extern int PeriodVeryShort=6;

double
   xVeryShort[],
   xShort[],
   xLong[];

#define kVolfactor 7.211102550927978586238442534941
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//---- buffers 
double HVRSBuffer[];
double HVRVSBuffer[];
//+------------------------------------------------------------------+ 
//| カスタムインジケーター初期化関数                         | 
//+------------------------------------------------------------------+ 
int 初期化()
  {
   ArrayResize(xVeryShort, PeriodVeryShort);
   ArrayResize(xShort, PeriodShort);
   ArrayResize(xLong, PeriodLong);
   SetLevelValue(0, 0.0);
   SetLevelValue(1, 0.5);
   SetLevelValue(2, 1.0);
   SetLevelValue(3, 2.0);
//---- 2 additional buffers are used for counting. 
   IndicatorBuffers(2);
   SetIndexBuffer(0,HVRSBuffer);
   SetIndexBuffer(1,HVRVSBuffer);
//---- indicator line 
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
//---- name for DataWindow and indicator subwindow label 
   IndicatorShortName("HVR( " + PeriodVeryShort +" & " + PeriodShort + " /" + PeriodLong + ")");
   SetIndexLabel(0,"HVR(" + PeriodShort + "/" + PeriodLong + ")");
   SetIndexLabel(1,"HVR(" + PeriodVeryShort + "/" + PeriodLong + ")");
//---- 
//---- 
   戻る(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
整数の開始()
   {
double  hvVeryShort,
   hvShort,
   hvLong,
   meanVeryShort,
   meanShort,
   meanLong;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) 
      counted_bars--;
   int ixLimit=Bars-counted_bars-1;
   ために(int ix=ixLimit; ix>=0; ix--)
   {
      もしも(ix+PeriodLong >= バー)
         continue;
      meanVeryShort=0;
      meanShort=0;
      meanLong=0;
      ために(int i=0; 私<PeriodLong; i++)
      {
         double myLog=MathLog(近い[ix+i]/近い[ix+i+1]);
         xLong[私]=myLog;
         meanLong+=myLog;
         もしも(私<PeriodShort)
         {
            xShort[私]=myLog;
            meanShort+=myLog;
         }
         もしも(私<PeriodVeryShort)
         {
            xVeryShort[私]=myLog;
            meanVeryShort+=myLog;
         }
      }

      meanVeryShort/=PeriodVeryShort;
      meanShort/=PeriodShort;
      meanLong/=PeriodLong;

      hvVeryShort=0;
      ために(i=0; 私<PeriodVeryShort; i++)
         hvVeryShort+=(xVeryShort[私] - meanVeryShort)*(xVeryShort[私] - meanVeryShort);
      hvVeryShort=MathSqrt(hvVeryShort/(PeriodVeryShort-1)) * kVolfactor;

      hvShort=0;
      ために(i=0; 私<PeriodShort; i++)
         hvShort+=(xShort[私] - meanShort)*(xShort[私] - meanShort);
      hvShort=MathSqrt(hvShort/(PeriodShort-1)) * kVolfactor;

      hvLong=0;
      ために(i=0; 私<PeriodLong; i++)
         hvLong+=(xLong[私] - meanLong)*(xLong[私] - meanLong);
      hvLong=MathSqrt(hvLong/(PeriodLong-1)) * kVolfactor;

      HVRVSBuffer[ix]= hvVeryShort/hvLong;
      HVRSBuffer[ix]= hvShort/hvLong;
   }
}
//+------------------------------------------------------------------+

この投稿は役に立ちました?

星をクリックして評価してください!

平均評価 0 / 5. 投票数: 0

これまでのところ投票はありません! この投稿を最初に評価してください.

この投稿が役に立たなかったことをお詫び申し上げます!

この投稿を改善しましょう!

この投稿を改善する方法を教えてください?



著者: 外国為替ウィキチーム
私たちは経験豊富な外国為替トレーダーのチームです [2000-2023] 自分の思いどおりに人生を生きることに専念している人. 私たちの主な目的は、経済的自立と自由を獲得することです, 私たちは自立可能なライフスタイルを実現する手段として、独学で外国為替市場での豊富な経験を積んできました。.