TF 변경이 문제 - 페이지 5

 

지표는 다음과 같습니다.

 //+------------------------------------------------------------------+
//|                                                    Shabl_ind.mq4 |
//|                                      Copyright 2012, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
#property copyright "eevviill"
#property link        "http://alievtm.blogspot.com"
#property version    "1.42"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 clrLightBlue
#property indicator_color2 clrRed
#property indicator_width1 2
#property indicator_width2 2

input string    arr_set= "Arrow settings" ;
input int       arrow_indent= 22 ;
input int       up_arrow_code= 233 ;
input int       down_arrow_code= 234 ;

double          up_arr[];
double          down_arr[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
   SetIndexBuffer ( 0 ,up_arr);
   SetIndexStyle( 0 , DRAW_ARROW );
   SetIndexArrow( 0 ,up_arrow_code);
   SetIndexLabel( 0 , "UP arrow" );

   SetIndexBuffer ( 1 ,down_arr);
   SetIndexStyle( 1 , DRAW_ARROW );
   SetIndexArrow( 1 ,down_arrow_code);
   SetIndexLabel( 1 , "DOWN arrow" );

   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Shabl_ind                                                        |
//+------------------------------------------------------------------+
int OnCalculate ( const int rates_total,
                 const int prev_calculated,
                 const datetime &time[],
                 const double &open[],
                 const double &high[],
                 const double &low[],
                 const double &close[],
                 const long &tick_volume[],
                 const long &volume[],
                 const int &spread[])
  {
   int i,limit= 0 ;
//---
   if (rates_total<= 20 )
       return ( 0 );
//--- last counted bar will be recounted
   if (prev_calculated== 0 )
      limit=rates_total- 1 ;
   if (prev_calculated> 0 )
      limit=rates_total-prev_calculated+ 1 ;
   Comment ( "rates_total=" ,rates_total, "; prev_calculated=" ,prev_calculated, "; limit=" ,limit);
//--- Shabl_ind counted in the 1-st buffer
   datetime temp;
   for (i= 0 ; i<limit; i++)
     {
      temp=time[i];
       if (close[i]>close[i+ 1 ])
         up_arr[i]=low[i]-arrow_indent* Point ; //up arrow
       if (close[i]<close[i+ 1 ])
         down_arr[i]=high[i]+arrow_indent* Point ; //down arrow
     }
   return (rates_total);
  }
//+------------------------------------------------------------------+

조건에 따라 표시기가 0 막대에 두 버퍼를 모두 그릴 수 있음을 명심하십시오.

파일:
 
Karputov Vladimir :

지표는 다음과 같습니다.

조건에 따라 표시기 가 0 막대에 두 버퍼를 모두 그릴 수 있음을 명심하십시오.

두 개의 버퍼가 그리지 않도록 하나의 버퍼를 채울 때 다른 하나를 재설정해야합니다

       if (close[i]>close[i+ 1 ])
       {
        down_arr[i] = EMPTY_VALUE ;
        up_arr[i]=low[i]-arrow_indent* Point ; //up arrow
       }
       if (close[i]<close[i+ 1 ])
       {
        up_arr[i] = EMPTY_VALUE ;
        down_arr[i]=high[i]+arrow_indent* Point ; //down arrow
       }
 
Vasyl Nosal :
솔루션 코드가 있습니까?

다른 많은 사람들과 마찬가지로 귀하의 질문에 대한 해결책이 하나 이상 있습니다. 지표는 뉘앙스가 다를 수 있기 때문에(일반적으로 많은 요인에 대해 수행하는 작업/코드화/계산 간격).

[삭제]  
Karputov Vladimir :

지표는 다음과 같습니다.

조건에 따라 표시기가 0 막대에 두 버퍼를 모두 그릴 수 있음을 명심하십시오.

다들 저를 쫓는 건가요, 아니면 정말 문제가 무엇인지 파악하지 못하는 건가요?

다음은 언로드된 기록에서 TF를 변경할 때의 표시입니다.

:))))))))))))))))))))))))))))))))))))))))))))

[삭제]  
Dina Paches :

다른 많은 사람들과 마찬가지로 귀하의 질문에 대한 해결책이 하나 이상 있습니다. 지표는 뉘앙스가 다를 수 있기 때문에(일반적으로 많은 요인에 대해 수행하는 작업/코드화/계산 간격).

ㅋ ㅋ ㅋ ㅋ ㅋ ㅋ...
 
Vasyl Nosal :

다들 저를 쫓는 건가요, 아니면 정말 문제가 무엇인지 파악하지 못하는 건가요?

다음은 언로드된 기록에서 TF를 변경할 때의 표시입니다.

:))))))))))))))))))))))))))))))))))))))))))))

그러한 흥미로운 그림을 얻기 위해 어떤 조작을 사용하는지 공유할 수 있습니까? 그리고, 앞으로는 표현에 좀 더 유보되기를 바랍니다.

추가: 히스토리를 교환할 때 표시기 버퍼의 내용에 대해 스스로 생각해야 한다고 위에서 이미 말했습니다.

로딩 이벤트와 동일시하는 것입니다. 표시기 .

그러나 어떤 이유로 당신은 무시하고 변경하기를 원하지 않았습니다.

일반적으로 버전 1.43이 있습니다(여기에 Alexey Viktorov 의 수정 사항 및 수정 사항이 있습니다).

거래, 자동 거래 시스템 및 거래 전략 테스트에 관한 포럼

TF 변경이 문제

알렉세이 빅토로프 , 2015.12.07 12:52

두 개의 버퍼가 그리지 않도록 하나의 버퍼를 채울 때 다른 하나를 재설정해야합니다

       if (close[i]>close[i+ 1 ])
       {
        down_arr[i] = EMPTY_VALUE ;
        up_arr[i]=low[i]-arrow_indent* Point ; //up arrow
       }
       if (close[i]<close[i+ 1 ])
       {
        up_arr[i] = EMPTY_VALUE ;
        down_arr[i]=high[i]+arrow_indent* Point ; //down arrow
       }

:

 //+------------------------------------------------------------------+
//|                                                    Shabl_ind.mq4 |
//|                                      Copyright 2012, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
#property copyright "eevviill"
#property link        "http://alievtm.blogspot.com"
#property version    "1.43"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 clrLightBlue
#property indicator_color2 clrRed
#property indicator_width1 2
#property indicator_width2 2

input string    arr_set= "Arrow settings" ;
input int       arrow_indent= 22 ;
input int       up_arrow_code= 233 ;
input int       down_arrow_code= 234 ;

double          up_arr[];
double          down_arr[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
   SetIndexBuffer ( 0 ,up_arr);
   SetIndexStyle( 0 , DRAW_ARROW );
   SetIndexArrow( 0 ,up_arrow_code);
   SetIndexLabel( 0 , "UP arrow" );

   SetIndexBuffer ( 1 ,down_arr);
   SetIndexStyle( 1 , DRAW_ARROW );
   SetIndexArrow( 1 ,down_arrow_code);
   SetIndexLabel( 1 , "DOWN arrow" );

   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Shabl_ind                                                        |
//+------------------------------------------------------------------+
int OnCalculate ( const int rates_total,
                 const int prev_calculated,
                 const datetime &time[],
                 const double &open[],
                 const double &high[],
                 const double &low[],
                 const double &close[],
                 const long &tick_volume[],
                 const long &volume[],
                 const int &spread[])
  {
   int i,limit= 0 ;
//---
   if (rates_total<= 20 )
       return ( 0 );
//--- last counted bar will be recounted
   if (prev_calculated== 0 )
     {
      limit=rates_total- 1 ;
       ArrayInitialize (up_arr, EMPTY_VALUE );
       ArrayInitialize (down_arr, EMPTY_VALUE );
     }
   if (prev_calculated> 0 )
      limit=rates_total-prev_calculated+ 1 ;
   Comment ( "rates_total=" ,rates_total, "; prev_calculated=" ,prev_calculated, "; limit=" ,limit);
//--- Shabl_ind counted in the 1-st buffer
   for (i= 0 ; i<limit; i++)
     {
       if (close[i]>close[i+ 1 ])
        {
         down_arr[i]= EMPTY_VALUE ;
         up_arr[i]=low[i]-arrow_indent* Point ; //up arrow
        }
       if (close[i]<close[i+ 1 ])
        {
         up_arr[i]= EMPTY_VALUE ;
         down_arr[i]=high[i]+arrow_indent* Point ; //down arrow
        }
     }
   return (rates_total);
  }
//+------------------------------------------------------------------+
파일:
[삭제]  
Karputov Vladimir :

그러한 흥미로운 그림을 얻기 위해 어떤 조작을 사용하는지 공유할 수 있습니까? 그리고, 앞으로는 표현에 좀 더 유보되기를 바랍니다.

한 번도 열어본 적이 없는 통화 쌍의 차트를 엽니다. 예를 들어 M1. 귀하의 지표를 첨부합니다. M5로 전환합니다.

내 말은, 내 말이 맞았나요? 화살표 버퍼를 재설정해야 합니까?

 
Vasyl Nosal :

mql4

아니요. 여기에 역사가 없었던 한 쌍의 디자인이 있습니다.

이게 뭔가요?

 if (i> Bars - 20 ) i= Bars - 20 ;

예상대로 내부의 사이클이 요동치고 있습니다. 또한 루프 본문에서 이전 막대([i+1])를 참조하므로 히스토리의 두 번째 막대(왼쪽부터 계산)보다 빠르지 않게 계산을 시작해야 합니다. 그리고 각 막대의 버퍼 중 하나만이 아니라 모든 버퍼를 채워야 합니다. 음, 또는 OnInit()에서 먼저 초기화하십시오.

 int OnCalculate ( const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[],
                 const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[])
{
   int nStartBar = rates_total - MathMax (prev_calculated, 2 );

   for ( int i = nStartBar; i >= 0 ; i--)
   {
       if (Close[i] > Close[i+ 1 ])
      {
         up_arr[i] = Low[i] - arrow_indent * _Point ; //up arrow
         down_arr[i] = 0 ;
      }
         
       if (Close[i] < Close[i+ 1 ])
      {
         up_arr[i] = 0 ;
         down_arr[i] = High[i] + arrow_indent * _Point ; //down arrow
      }
   }

   return (rates_total);
}
 
Karputov Vladimir :

일반적으로 버전 1.43이 있습니다(여기에 Alexey Viktorov 의 수정 사항 및 수정 사항이 있습니다).


:

Vladimir, 왜 OnCalculate() 내부에서 이것을 하고 있습니까? 배열의 재초기화인 마지막 두 줄을 의미합니다. 각 막대에 대해 두 버퍼가 모두 계산되어 있으므로 이는 불필요한 작업입니다.

 if (prev_calculated== 0 )
{
   limit=rates_total- 1 ;
   ArrayInitialize (up_arr, EMPTY_VALUE );
   ArrayInitialize (down_arr, EMPTY_VALUE );
}
[삭제]  
Sergei Vladimirov :

이게 뭔가요?

예상대로 내부의 사이클이 요동치고 있습니다. 또한 루프 본문에서 이전 막대([i+1])를 참조하므로 히스토리의 두 번째 막대(왼쪽부터 계산)보다 빠르지 않게 계산을 시작해야 합니다. 그리고 하나가 아닌 각 막대의 모든 버퍼를 채워야 합니다. 음, 또는 OnInit()에서 먼저 초기화하십시오.

모든 것? 고장이 나지 않을 까요?