오류, 버그, 질문 - 페이지 269

 
AndrNuda :
당신은 어떤 종류의 브레이크입니까? Fals는 false가 아니지만 모든 것이 작동합니다. 거기 보지 마세요. :)))) 올바른 기능이 있습니다.
영리한?
 
BoraBo :

비틀어 비틀어 ArrayIsSeries(High)가 항상 false인 이유를 알고 싶습니다.

이 기능에 대한 도움말은 ( https://www.mql5.com/en/docs/array/arrayisseries )

반환 값

검사 중인 배열이 시계열 배열 이면 true를 반환하고, 그렇지 않으면 false를 반환합니다. OnCalculate() 함수에 매개변수로 전달된 배열은 ArrayGetAsSeries() 함수 에서 배열 요소에 대한 액세스 순서를 확인해야 합니다.

귀하가 선언한 배열은 시계열이 아니며 어떤 경우에도 하나가 될 수 없습니다. 시계열은 예를 들어 OnCalculate() 함수에서 런타임 시스템에 의해 사전 정의된 배열입니다.

 int OnCalculate ( const int rates_total,       // размер входных таймсерий
                 const int prev_calculated,   // обработано баров на предыдущем вызове
                 const datetime & time[],     // Time
                 const double & open[],       // Open
                 const double & high[],       // High
                 const double & low[],         // Low
                 const double & close[],       // Close
                 const long & tick_volume[],   // Tick Volume
                 const long & volume[],       // Real Volume
                 const int & spread[]         // Spread
   )
Документация по MQL5: Операции с массивами / ArrayIsSeries
Документация по MQL5: Операции с массивами / ArrayIsSeries
  • www.mql5.com
Операции с массивами / ArrayIsSeries - Документация по MQL5
 
Rosh :

이 기능에 대한 도움말은 ( https://www.mql5.com/en/docs/array/arrayisseries )

귀하가 선언한 배열은 시계열이 아니며 어떤 경우에도 하나가 될 수 없습니다. 시계열은 예를 들어 OnCalculate() 함수에서 런타임 시스템에 의해 사전 정의된 배열입니다.

ArrayGetAsSeries가 제대로 작동하지 않습니다.
 
AlexSTAL :
ArrayGetAsSeries가 제대로 작동하지 않습니다.
ArrayGetAsSeries 함수는 인덱싱 방향만 변경하지만 배열을 시계열로 바꾸지는 않습니다. 이 기능으로 무엇을 얻으려고 합니까?
 
Rosh :
시계열은 예를 들어 OnCalculate() 함수에서 런타임 시스템에 의해 사전 정의된 배열입니다.
 int OnCalculate ( const int rates_total,       // размер входных таймсерий
                 const int prev_calculated,   // обработано баров на предыдущем вызове
                 const datetime & time[],     // Time
                 const double & open[],       // Open
                 const double & high[],       // High
                 const double & low[],         // Low
                 const double & close[],       // Close
                 const long & tick_volume[],   // Tick Volume
                 const long & volume[],       // Real Volume
                 const int & spread[]         // Spread
   )


그러나 이것에 대해서는 도움말에 다음과 같이 기록되어 있습니다.

Примечание

Для проверки массива на принадлежность к таймсерии следует применять функцию ArrayIsSeries(). Массивы ценовых данных, переданных в качестве входных параметров в функцию OnCalculate(), не обязательно имеют направление индексации как у таймсерий. Нужное направление индексации можно установить функцией ArraySetAsSeries().

 
joo :

그러나 이것에 대해서는 도움말에 다음과 같이 기록되어 있습니다.


이 표시기를 실행하면 모든 것을 직접 볼 수 있습니다.

 //+------------------------------------------------------------------+
//|                                           CheckArrayIsSeries.mq5 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link       "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
//---- plot Label1
#property indicator_label1   "Label1"
#property indicator_type1   DRAW_LINE
#property indicator_color1  Red
#property indicator_style1  STYLE_SOLID
#property indicator_width1   1
//--- indicator buffers
double          Label1Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- indicator buffers mapping
   SetIndexBuffer ( 0 ,Label1Buffer, INDICATOR_DATA );
//---
   return ( 0 );
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void checkArray( const double & array[])
  {
   if ( ArrayGetAsSeries (array))
     {
       Print ( "array can use as timeseria" );
     }
     else
     {
       Print ( "array can not use as timeseria!!!" );
     }
     
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
//---
   if ( ArrayIsSeries (open))
     {
       Print ( "open[] is timeseria" );
      checkArray(open);
     }
   else
     {
        {
         Print ( "open[] is timeseria!!!" );
        }
     }
//--- return value of prev_calculated for next call
   return (rates_total);
  }
//+------------------------------------------------------------------+
 
Rosh :
ArrayGetAsSeries 함수는 인덱싱 방향만 변경하지만 배열을 시계열로 바꾸지는 않습니다. 이 기능으로 무엇을 얻으려고 합니까?

이 기능은 방향을 확인하는 것이지 반대로 하는 것이 아닙니다.

1) 초기화 없이

 double Buf[];
void OnStart ()
  {
   ArrayResize (Buf, 3 );

   Print ( "ArrayGetAsSeries(Buf): " , ArrayGetAsSeries (Buf));             // ArrayGetAsSeries(Buf): false
   
   // Меняем направление на обратный порядок
   Print ( "Установка в true прошла: " , ArraySetAsSeries (Buf, true));     // Установка в true прошла: true
   Print ( "ArrayGetAsSeries(Buf): " , ArrayGetAsSeries (Buf));             // ArrayGetAsSeries(Buf): false
   
   // Меняем направление на прямой порядок
   Print ( "Установка в false прошла: " , ArraySetAsSeries (Buf, false));   // Установка в false прошла: true
   Print ( "ArrayGetAsSeries(Buf): " , ArrayGetAsSeries (Buf));             // ArrayGetAsSeries(Buf): false
  }

2) 초기화와 함께

 double Buf[];
void OnStart ()
  {
   ArrayResize (Buf, 3 );
   Buf[ 0 ] = 0 ; Buf[ 1 ] = 1 ; Buf[ 2 ] = 2 ;

   Print ( "ArrayGetAsSeries(Buf): " , ArrayGetAsSeries (Buf));             // ArrayGetAsSeries(Buf): false
   
   // Меняем направление на обратный порядок
   Print ( "Установка в true прошла: " , ArraySetAsSeries (Buf, true));     // Установка в true прошла: true
   Print ( "ArrayGetAsSeries(Buf): " , ArrayGetAsSeries (Buf), " [" , Buf[ 0 ], "," , Buf[ 1 ], "," , Buf[ 2 ], "]" ); // ArrayGetAsSeries(Buf): true [2,1,0]
   
   // Меняем направление на прямой порядок
   Print ( "Установка в false прошла: " , ArraySetAsSeries (Buf, false));   // Установка в false прошла: true
   Print ( "ArrayGetAsSeries(Buf): " , ArrayGetAsSeries (Buf), " [" , Buf[ 0 ], "," , Buf[ 1 ], "," , Buf[ 2 ], "]" ); // ArrayGetAsSeries(Buf): false [0,1,2]
  }

3) 위의 코드는 ArrayGetAsSeries 배열의 인덱싱 방향을 가져오는 기능으로만

 double High[];
#include <Indicators\TimeSeries.mqh>
void OnStart ()
  {
   Print ( "ArrayGetAsSeries(High) " , ArrayGetAsSeries (High));                   // ArrayGetAsSeries(High) false

   CiHigh z;

   int count= 3 ;
   if (z.Create( _Symbol , _Period )==true)
     {
       if (z.GetData( 0 ,count,High)==count)
        {
         for ( int i= 0 ; i<count; i++) Print (i, "=" ,High[i]);
         Print ( "ArraySetAsSeries(High,true) " , ArraySetAsSeries (High,true));   // ArraySetAsSeries(High,true) true
         Print ( "ArrayGetAsSeries(High) true = " , ArrayGetAsSeries (High));       // ArrayGetAsSeries(High) true = false
         for ( int i= 0 ; i<count; i++) Print (i, "=" ,High[i]);
         Print ( "ArraySetAsSeries(High,false) " , ArraySetAsSeries (High,false)); // ArraySetAsSeries(High,false) true
         Print ( "ArrayGetAsSeries(High) false = " , ArrayGetAsSeries (High));     // ArrayGetAsSeries(High) false = false
         for ( int i= 0 ; i<count; i++) Print (i, "=" ,High[i]);
        }
       else
         Print ( "Не удалось получить " ,count, " данных таймсерии." );
     }
   else Print ( "Ошибка создания таймсерии." );
   Print ( "ArrayGetAsSeries(High) " , ArrayGetAsSeries (High));                   // ArrayGetAsSeries(High) false
   Print ( "GetLastError() " , GetLastError ());
  }
서비스데스크에서 함수명을 잘못 적어서 그냥


 
Rosh :

이 표시기를 실행하면 모든 것을 직접 볼 수 있습니다.

이것은 분명합니다. 그리고 내 질문은 오류로 인한 것이 아니며 모든 것이 도움말에 작성된 대로 작동합니다.

Примечание

Для проверки массива на принадлежность к таймсерии следует применять функцию ArrayIsSeries(). Массивы ценовых данных, переданных в качестве входных параметров в функцию OnCalculate(), не обязательно имеют направление индексации как у таймсерий . Нужное направление индексации можно установить функцией ArraySetAsSeries().


도움말 텍스트의 색상과 볼드체와 귀하가 말한 내용이 일치하지 않아 질문이 발생했습니다.

로쉬 :
시계열은 예를 들어 OnCalculate() 함수에서 런타임 시스템에 의해 사전 정의된 배열입니다.

따라서 OnCalculate()에서 다음을 수행합니다.

     //--------------------------------------
     if (ArrayGetAsSeries(time)!= true )
      ArraySetAsSeries(time, true );
     if (ArrayGetAsSeries(open)!= true )
      ArraySetAsSeries(open, true );
     if (ArrayGetAsSeries(high)!= true )
      ArraySetAsSeries(high, true );
     if (ArrayGetAsSeries(low)!= true )
      ArraySetAsSeries(low, true );
     if (ArrayGetAsSeries(close)!= true )
      ArraySetAsSeries(close, true );
     //--------------------------------------
 
Rosh :

이 기능에 대한 도움말은 ( https://www.mql5.com/en/docs/array/arrayisseries )

귀하가 선언한 배열은 시계열이 아니며 어떤 경우에도 하나가 될 수 없습니다. 시계열은 예를 들어 OnCalculate() 함수에서 런타임 시스템에 의해 사전 정의된 배열입니다.

표시기에서도 확인이 작동하지 않습니다.

 //+------------------------------------------------------------------+
//|                                                    ind_proba.mq5 |
//|                        Copyright 2010, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010, MetaQuotes Software Corp."
#property link       "https://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- indicator buffers mapping

//---
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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 count= 3 ;
   int i= 0 ;
   int limit;
//   bool printCom;

   if (prev_calculated> 0 )
     {
      limit= 1 ;
     }
   else
     {
       Print ( "rates_total  " ,rates_total, "  prev_calculated  " ,prev_calculated);
       for (i= 0 ; i<count; i++) Print (i, "=" ,open[i]);
       Print ( "ArraySetAsSeries(open,true) " , ArraySetAsSeries (open,true));
       Print ( "ArrayIsSeries(open) true = " , ArrayIsSeries (open));
       Print ( "ArrayGetAsSeries(open) true = " , ArrayGetAsSeries (open));
       for (i= 0 ; i<count; i++) Print (i, "=" ,open[i]);
       Print ( "ArraySetAsSeries(open,false) " , ArraySetAsSeries (open,false));
       Print ( "ArrayIsSeries(open) false = " , ArrayIsSeries (open));
       Print ( "ArrayGetAsSeries(open) false = " , ArrayGetAsSeries (open));
       for (i= 0 ; i<count; i++) Print (i, "=" ,open[i]);
     }
   Print ( "GetLastError() " , GetLastError ());
//--- return value of prev_calculated for next call

   return (rates_total);
  }
//+------------------------------------------------------------------+

그럼에도 불구하고 무언가가 prev_calculated, 지속적으로 0 작동을 멈췄습니다.

 

예, 이러한 기능을 통해 스스로 해결할 수 있다고 생각합니다.


단, 잊지 않기를 바라는 마음에서 - 에디터에서 3글자 또는 몇글자 입력 후 프롬프트가 떴을 때 목록의 첫 줄에 서서 위로 눌렀을 때 목록이 삭제되지 않습니다. 그냥 스튜디오에서 하는 게 습관처럼, 스튜디오에서 똑같이 하지 않으면 많은 분들이 '화나실 것'이라고 생각해요. 임호.