0
(0)
이름:
HVR [ | CN ]
작가: 작가 (2008.02.11 10:02)
다운로드됨: 1206
다운로드:
HVR 1
HVR.mq4 (2.9 kb) 보다
작가: 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
#property 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[];
//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
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 >= Bars)
         계속하다;
      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

현재까지 투표가 없습니다! 이 게시물을 가장 먼저 평가해 보세요..

이 게시물이 귀하에게 도움이 되지 못했다니 죄송합니다!

이 게시물을 개선해 보겠습니다.!

이 게시물을 개선할 수 있는 방법을 알려주세요.?



작가: 외환 위키 팀
우리는 경험이 풍부한 Forex 트레이더 팀입니다. [2000-2023] 우리 자신의 조건에 따라 삶을 살기 위해 헌신하는 사람들. 우리의 주요 목표는 재정적 독립과 자유를 얻는 것입니다., 우리는 자기 교육을 추구하고 Forex 시장에서 자립 가능한 라이프 스타일을 달성하기 위한 수단으로 광범위한 경험을 얻었습니다..