가장 낮은 함수와 가장 높은 함수가 반환하는 것 - 페이지 4

 
나는 첫 페이지에 composter 에 의해 주어진 코드로 실험을 시도할 것이다. 아마도 뭔가 효과가 있을 것입니다.
 
nen :
맞습니다. 중요합니다. 휴대폰 번호 가 있습니다. 이 셀(시계열)에서 막대의 최대값 또는 최소값을 가져옵니다. 예를 들어 이 막대에서 최대값이 발견된 것으로 믿어집니다. 그런 다음 이 값은 발견된 숫자 와 함께 표시기 버퍼에 배치됩니다. 표시기의 최대값은 막대의 최대값과 일치해야 합니다. 그리고 내 코드에서 최대값은 동일한 발견 번호를 가진 배열(시계열)에서 가져와서 값 val 과 비교합니다. 이 숫자가 있는 버퍼에 숫자 val을 넣어 올바른 일을 하고 있는지 확인합니다. 또한 막대의 최대값과 같아야 합니다. 같은 장소에서 가져온 숫자를 비교하는 것은 매우 정확합니다.

...==val 비교는 틱에서 틱으로 바뀔 수 있는 셀 번호이기 때문에 위험한 것 같습니다. 특히 낮은 값과 높은 값이 밀접 하게 일치하는 작은 기간의 경우 . 그러나 우리는 생각해야 합니다. 아마도 우리는 다른 점을 염두에 두고 있을 것입니다.
 
nen , 이 지그재그로 테스트하시겠습니까? 사실 이것은 지그재그를 사용해 본 경험이 있고 지그재그에서 무엇을 원하는지 알고 있는 모든 사람에게 하는 부탁입니다. 아마도 이 프로토타입에서 가치 있는 것을 만드는 것이 가능할 것입니까?
//+------------------------------------------------------------------+
//|                                                      CZigZag.mq4 |
//|                                         Copyright © 2006, Candid |
//|                                                   likh@yandex.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Candid"
#property link      "likh@yandex.ru"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Blue

//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
//extern int ExtBackstep=3;

int    shift;
double res;
int i;
int fBar;
double CurMax,CurMin;
int CurMaxPos,CurMinPos;
int CurMaxBar,CurMinBar;
double hPoint;
double mhPoint;
double EDev;
int MaxDist,MinDist;
bool FirstRun;
bool AfterMax,AfterMin;

//---- indicator buffers
double ZigZag[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
//---- indicators
   SetIndexStyle(0,DRAW_SECTION);
//---- indicator buffers mapping
   SetIndexBuffer(0,ZigZag);
   SetIndexEmptyValue(0,0.0);
//---- indicator short name
   IndicatorShortName("CZigZag("+ExtDepth+","+ExtDeviation+")");
   
   FirstRun = true;
//----
  return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit() {
//----
   
//----
  return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
  int counted_bars=IndicatorCounted();
  
  if (FirstRun) {
    hPoint = 0.5*Point;
    mhPoint = -hPoint;
//    EDev = ExtDeviation*Point;
    EDev = (ExtDeviation+0.5)*Point;
    AfterMax = true;
    AfterMin = true;
    fBar = Bars-1;
    CurMax = High[fBar];
    CurMaxBar = 1;
    CurMin = Low[fBar];
    CurMinBar = 1;
    MaxDist = 0;
    MinDist = 0;
    FirstRun = false;
  }
//----
  fBar = Bars-counted_bars-1;
  if (fBar > Bars-2) fBar = Bars-2;
  for(shift=fBar; shift>=0; shift--) {
    if (AfterMax) {
//      res = Low[shift]-CurMin-hPoint;
      res = Low[shift]-CurMin;
//      if (res < 0) {
      if (res < mhPoint) {
        ZigZag[Bars-CurMinBar] = 0;
        CurMin = Low[shift];
        CurMinBar = Bars-shift; 
        ZigZag[Bars-CurMinBar] = CurMin;
      } else {  //  if (res < 0)
//        if (res > 0 ) {
        if (res > hPoint ) {
          MaxDist = Bars-CurMaxBar-shift+1;
          MinDist = Bars-CurMinBar-shift+1;
          if ((MaxDist>ExtDepth && MinDist>ExtDepth) || res > EDev) {
            AfterMax = false;
            AfterMin = true;
            CurMaxBar = CurMinBar+1;
            CurMaxPos = Bars-CurMaxBar;
            CurMax = High[CurMaxPos];
            for (i=CurMaxPos-1;i>=shift;i--) {
              if (High[i] > CurMax+hPoint) {
                CurMaxBar = Bars-i;
                CurMax = High[i];
              }
            }  //  for (i=CurMaxPos-1;i>=shift;i--)
            ZigZag[Bars-CurMaxBar] = CurMax;
          }  //  if ((MaxDist>ExtDepth && MinDist>ExtDepth) || res > EDev)
        }  //  if (res > 0 )
      }  // else if (res < 0)
    }  //  if (AfterMax) 
    if (AfterMin) {
//      res = CurMax-High[shift]-hPoint;
      res = CurMax-High[shift];
//      if (res < 0) {
      if (res < mhPoint) {
        ZigZag[Bars-CurMaxBar] = 0;
        CurMax = High[shift];
        CurMaxBar = Bars-shift; 
        ZigZag[Bars-CurMaxBar] = CurMax;
      } else {  //  if (res < 0)
//        if (res > 0 ) {
        if (res > hPoint ) {
          MaxDist = Bars-CurMaxBar-shift+1;
          MinDist = Bars-CurMinBar-shift+1;
          if ((MaxDist>ExtDepth && MinDist>ExtDepth) || res > EDev) {
            AfterMin = false;
            AfterMax = true;
            CurMinBar = CurMaxBar+1;
            CurMinPos = Bars-CurMinBar;
            CurMin = Low[CurMinPos];
            for (i=CurMinPos-1;i>=shift;i--) {
              if (Low[i] < CurMin-hPoint) {
                CurMinBar = Bars-i;
                CurMin = Low[i];
              }
            }  //  for (i=CurMinPos-1;i>=shift;i--)
            ZigZag[Bars-CurMinBar] = CurMin;
          }  //  if ((MaxDist>ExtDepth && MinDist>ExtDepth) || res > EDev)
        }  //  if (res > 0 )
      }  // else if (res < 0)
    }  //  if (AfterMin) 
  }  //  for(shift=fBar; shift>=0; shift--)
//----
  return(0);
}
//+------------------------------------------------------------------+


매개변수의 이름은 저장되지만 다르게 작동한다는 점에 유의하십시오.


 
여기도 내 지그재그를 보면 진실의 바닥에 도달하는 데 도움이 될 수 있습니다 ....

//+------------------------------------------------------------------+
//|                                                        DT_ZZ.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, klot."
#property link      "klot@mail.ru"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Aqua
#property indicator_color2 Blue
#property indicator_color3 Red
//---- indicator parameters
extern int ExtDepth=12;
//---- indicator buffers
double zzL[];
double zzH[];
double zz[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
 //  IndicatorBuffers(3);
//---- drawing settings
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexStyle(0,DRAW_SECTION);
   SetIndexArrow(2,159);
   SetIndexArrow(1,159);
//---- indicator buffers mapping
   SetIndexBuffer(0,zz);
   SetIndexBuffer(1,zzH);
   SetIndexBuffer(2,zzL);
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
   SetIndexEmptyValue(2,0.0);
     
//---- indicator short name
   IndicatorShortName("DT_ZZ("+ExtDepth+")");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int    i,shift,pos,lasthighpos,lastlowpos,curhighpos,curlowpos;
   double curlow,curhigh,lasthigh,lastlow;
   double min, max;
   ArrayInitialize(zz,0.0);
   ArrayInitialize(zzL,0.0);
   ArrayInitialize(zzH,0.0);
   
   lasthighpos=Bars; lastlowpos=Bars;
   lastlow=Low[Bars];lasthigh=High[Bars];
  for(shift=Bars-ExtDepth; shift>=0; shift--)
    {
      curlowpos=Lowest(NULL,0,MODE_LOW,ExtDepth,shift);
      curlow=Low[curlowpos];
      curhighpos=Highest(NULL,0,MODE_HIGH,ExtDepth,shift);
      curhigh=High[curhighpos];
      //------------------------------------------------
      if( curlow>=lastlow ) { lastlow=curlow; }
      else
         { 
            //идем вниз
            if( lasthighpos>curlowpos  ) 
            { 
            zzL[curlowpos]=curlow;
              ///*
              min=100000; pos=lasthighpos;
               for(i=lasthighpos; i>=curlowpos; i--)
                  { 
                    if (zzL[i]==0.0) continue;
                    if (zzL[i]<min) { min=zzL[i]; pos=i; }
                    zz[i]=0.0;
                  } 
               zz[pos]=min;
               //*/
            } 
          lastlowpos=curlowpos;
          lastlow=curlow; 
         }
      //--- high
      if( curhigh<=lasthigh )  { lasthigh=curhigh;}
      else
         {  
            // идем вверх
            if( lastlowpos>curhighpos ) 
            {  
            zzH[curhighpos]=curhigh;
           ///*
               max=-100000; pos=lastlowpos;
               for(i=lastlowpos; i>=curhighpos; i--)
                  { 
                    if (zzH[i]==0.0) continue;
                    if (zzH[i]>max) { max=zzH[i]; pos=i; }
                    zz[i]=0.0;
                  } 
               zz[pos]=max;
           //*/     
            }  
         lasthighpos=curhighpos;
         lasthigh=curhigh;    
         }       
    //----------------------------------------------------------------------
    }
 return(0);
}
//+------------------------------------------------------------------+
 
nen , 이 지그재그로 테스트하시겠습니까? 사실 이것은 지그재그를 사용해 본 경험이 있고 지그재그에서 무엇을 원하는지 알고 있는 모든 사람에게 하는 부탁입니다. 아마도 이 프로토타입에서 가치 있는 것을 만드는 것이 가능할 것입니까?
매개변수의 이름은 저장되지만 다르게 작동한다는 점에 유의하십시오.


칸디다 . 확실히 살펴보겠습니다. 첫 설치시 바로 다음과 같은 말이 떠올랐다.
동일한 최고점을 가진 여러 막대가 연속으로 있습니다. 귀하의 ZigZag 버전은 마지막 막대에 중단점(상단)을 그립니다. 그것은 제로에 가깝습니다. 참고로 첫 번째 막대(0에서 가장 먼 막대)에 나누기가 그려지도록 해야 합니다. 표시되는 첫 번째 정점은 중요합니다. 또한 mtnimums와 함께. 그렇게 하는 것이 필요한 여러 출처(문헌에서)를 인용할 수 있습니다.
 
클로트 , 감사합니다. 당신의 생각에 따르면, DT-ZigZag는 이제 지표에서 더 높은 기간의 데이터로 작업을 완료했습니다. 그러나 아이디어만 남겼습니다. 그리고 알고리즘은 스스로 만들었습니다. 어제는 지그재그로 좀 더 수정했습니다. 이제 집단 테스트를 위해 게시했습니다. 나는 확실히 당신의 버전을 시도합니다. 다음은 모든 소란을 일으키는 표시기에 대한 설명입니다. http://onix-trade.net/forum/index.php?showtopic=373 DT-ZigZag 모드는 표시기와 함께 제공되는 지그재그를 사용한다는 점에 유의하십시오. . 그리고 이 외부 지그재그는 때때로 첫 번째 광선에서 실패합니다. 외부 지그재그의 새 버전이 테스트 중입니다.
 
klot , 감사합니다. 당신의 생각에 따르면, DT-ZigZag는 이제 지표에서 더 높은 기간의 데이터로 작업을 완료했습니다. 그러나 아이디어만 남겼습니다. 그리고 알고리즘은 스스로 만들었습니다. 어제는 지그재그로 좀 더 수정했습니다. 이제 집단 테스트를 위해 게시했습니다. 나는 확실히 당신의 버전을 시도합니다. 다음은 모든 소란을 일으키는 표시기에 대한 설명입니다. http://onix-trade.net/forum/index.php?showtopic=373 DT-ZigZag 모드는 표시기와 함께 제공되는 지그재그를 사용한다는 점에 유의하십시오. . 그리고 이 외부 지그재그는 때때로 첫 번째 광선에서 실패합니다. 외부 지그재그의 새 버전이 테스트 중입니다.

네, 알아차렸습니다 :) 아이디어만 남았습니다 :) . 이제 저는 여기저기서 제 3Z를 사용하고 있습니다(위 게시물의 코드). 다른 TF의 데이터와 더 안정적으로 작동합니다.
 
nen :
첫 설치시 바로 다음과 같은 말이 떠올랐다.
동일한 최고점을 가진 여러 막대가 연속으로 있습니다. 귀하의 ZigZag 버전은 마지막 막대에 중단점(상단)을 그립니다.
예, 그래서 잘못된 "옵션"을 선택했습니다. 이제 소스와 함께 게시물의 코드를 편집하겠습니다. 변경의 표시는 잘못된 "옵션"의 주석 처리된 줄입니다.
 
솔직한 지금은 괜찮아.
Klot , 흥미로운 옵션입니다.

지그재그 변형이 흥미로운 결과를 나타내면 개발에 사용할 수 있습니까?
 
지그재그 변형이 흥미로운 결과를 나타내면 개발에 사용할 수 있습니까?
그렇지. 테스트 결과가 긍정적이면 Code Base에도 추가하려고 합니다.