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

 
Al_key :

그리고 컴포스터 라이브러리를 사용하여 barshift도 얻었습니다. 메타트레이더에 내장 도구가 없나요?

불행하게도. 사실 iBarShift() 는 MT4에서 컴포스터 라이브러리와 거의 같은 방식으로 작동합니다. 그러나 내장되어 있으면 더 좋을 것입니다. 더 빨리 작동합니다(C ++부터).
 
MetaDriver :

귀하의 케이스는 작은 슬립으로 처리되고 있습니다.

내가 더 나빠. (그런데 Slip이 없는 케이스가 작동하기 전에 몇 주 전에 중지되었습니다)

다른 (비 현재) 차트에서 끔찍한 미끄러짐 없이 동일한 계획이 작동을 멈췄습니다.

여기에서 코드: https://www.mql5.com/ru/code/224

설치된 올빼미, 참조.

현재에 나는 기준을 던진다. 차트의 AMA, tyk 재계산(Sleep이 0에서 2350까지) - 나는 M1에 빠지고 돌아오지 않습니다. 몇 초 후. AMA가 그려졌습니다. 그게 다야.

슬립은 일반적으로 도움이되지 않습니다. 플래그로 시도합니다 (두 개의 플래그, 현재 tf 및 m1을 기억합니까? 현재 플래그에 이미 (플래그)가 있고 현재 m1 (플래그 2)에 있으면 .. .)

하지만 나는 뭔가 의심스럽습니다 ... 월요일 틱은 더 일찍 올 것이고 현재 TF로 돌아가는 동안 :)

upd 예, 차트에 100개의 개체가 있고 AMA에 더하여 너무 무겁습니다.

 
MetaDriver :

"당신은 Fedya해야합니다, 당신은해야합니다."

(c) 슈리크

--

이러한 오류는 예를 들어 동적 버퍼에 대한 메모리가 할당되지 않은 경우(이 경우 ActualBuffer 아래) 발생합니다. 위의 코드 스니펫에서는 명확하지 않습니다.

여기.

그리고 동적 버퍼에 메모리를 할당하는 방법은 무엇입니까?

아마, 알게 되는 즉시 그 질문은 사라질 것입니다.

전체 코드는 다음과 같습니다.

 #include <TimeSeries.mqh>

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_plots    3
//--- plot Actual
#property indicator_label1   "Actual"
#property indicator_type1   DRAW_LINE
#property indicator_color1   clrLime
#property indicator_style1   STYLE_SOLID
#property indicator_width1   1
//--- plot Consensus
#property indicator_label2   "Consensus"
#property indicator_type2   DRAW_LINE
#property indicator_color2   clrPeachPuff
#property indicator_style2   STYLE_SOLID
#property indicator_width2   1
//--- plot Previous
#property indicator_label3   "Previous"
#property indicator_type3   DRAW_LINE
#property indicator_color3   clrLightCyan
#property indicator_style3   STYLE_SOLID
#property indicator_width3   1
//--- indicator buffers
double          ActualBuffer[];
double          ConsensusBuffer[];
double          PreviousBuffer[];
//--- indicator vars
string sDatetime;
string sActual;
string sConsensus;
string sPrevious;
int file_handle;
int barshift;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- indicator buffers mapping
   SetIndexBuffer ( 0 ,ActualBuffer, INDICATOR_DATA );
   SetIndexBuffer ( 1 ,ConsensusBuffer, INDICATOR_DATA );
   SetIndexBuffer ( 2 ,PreviousBuffer, INDICATOR_DATA );
   file_handle = FileOpen ( "CSV - макроэкономика и госкорпстат/Existing Home Sales Change.csv" , FILE_READ | FILE_CSV | FILE_ANSI , ',' );
   while (! FileIsEnding (file_handle))
        {
         sDatetime  = FileReadString (file_handle);
         sActual    = FileReadString (file_handle);
         sConsensus = FileReadString (file_handle);
         sPrevious  = FileReadString (file_handle);
         
         barshift = iBarShift( Symbol (), Period (), datetime (formatdatetime(sDatetime)), false );
         if ( StringToDouble (formatstring(sActual)) > 0 && StringToDouble (formatstring(sActual)) < 10000 ) ActualBuffer[barshift] = StringToDouble (formatstring(sActual));
         Print (formatdatetime(sDatetime));
         Print ( "iBarShift = " , barshift, " Datetime = " , formatstring(sDatetime), " sActual = " , sActual, " sConsensus = " , sConsensus, " sPrevious = " , sPrevious);
        }
    
//---
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| 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[])
  {
//---
   
//--- return value of prev_calculated for next call
   return (rates_total);
  }
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction ( const MqlTradeTransaction & trans,
                         const MqlTradeRequest & request,
                         const MqlTradeResult & result)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent ( const int id,
                   const long &lparam,
                   const double &dparam,
                   const string &sparam)
  {
//---
   
  }
//+------------------------------------------------------------------+
//--- Функции форматирования
string formatstring( string strparam)
   {
       string result = StringSubstr (strparam, 1 , StringLen (strparam) - 2 );
       return (result);
   }
string formatdatetime( string strparam)
   {
       string result = StringSubstr (strparam, 1 , 4 ) + "." + StringSubstr (strparam, 5 , 2 ) + "." + StringSubstr (strparam, 7 , 11 );
      
       return (result);
   }
 
Al_key :

여기.

그리고 동적 버퍼에 메모리를 할당하는 방법은 무엇입니까?

아마, 알게 되는 즉시 그 질문은 사라질 것입니다.

전체 코드는 다음과 같습니다.

추신.

나는 거기에서 Array Resize에 대해 읽었습니다 ... 여기에 복사 붙여 넣기가 있습니다.

"바인딩 후에 는 연결할 배열의 인덱싱이 timeseries 와 같이 미리 설정되어 있어도 buffer[] 동적 배열 이 일반 배열과 같이 인덱싱됩니다. 표시기의 요소에 대한 액세스 순서를 변경해야 하는 경우 배열의 경우 반드시 SetIndexBuffer 함수()로 배열을 바인딩한 후 ArraySetAsSeries() 함수를 사용해야 합니다. () 함수입니다. 표시기 버퍼의 경우 모든 크기 조정 작업은 터미널의 실행 하위 시스템에서 수행됩니다."

나는 혼미가 있다.

 
Silent :
구성된 기본 프로필 파일 - 프로필 - 기본값을 저장합니다.
기본값과 마찬가지로 모든 동일한 데이터가 로드되지 않습니다. 몇 시간 만에 처음으로 모든 것이 진행되었습니다.
 
Al_key :

여기.

그리고 동적 버퍼에 메모리를 할당하는 방법은 무엇입니까?

아마, 알게 되는 즉시 그 질문은 사라질 것입니다.

전체 코드는 다음과 같습니다.

INDICATOR_DATA는 그릴 데이터 입니다. 이 버퍼(크기)는 터미널에서 모니터링합니다(내가 이해하는대로 Rates_total로).

중간 계산을 위한 버퍼를 추가합니다(INDICATOR_CALCULATIONS). 그들을 위해 크기를 설정하십시오.

추신: #include <TimeSeries.mqh>가 "어떤 이유로 열리지 않습니다. 컴파일되지 않습니다.

업데이트 월요일 당신은 기다려야 합니다. 여기에 뭔가가 없습니다.

 
Silent :

INDICATOR_DATA는 그릴 데이터 입니다. 이 버퍼(크기)는 터미널에서 모니터링합니다(내가 이해하는대로 Rates_total로).

중간 계산을 위한 버퍼를 추가합니다(INDICATOR_CALCULATIONS). 그들을 위해 크기를 설정하십시오.

추신: #include <TimeSeries.mqh>가 "어떤 이유로 열리지 않습니다. 컴파일되지 않습니다.

업데이트 월요일 당신은 기다려야 합니다. 여기에 뭔가가 없습니다.

변경을 시도했지만 여전히 동일한 오류입니다. 나는 최소한 일반 배열에 값을 입력하려고 노력할 것입니다. 아마도 그것이 잘 될 것입니다.
 
Al_key :
변경을 시도했지만 여전히 동일한 오류입니다. 나는 최소한 일반 배열에 값을 입력하려고 노력할 것입니다. 아마도 그것이 잘 될 것입니다.

다음은 작동하는 간단한 것입니다. INDICATOR_DATA에서 INDICATOR_CALCULATIONS에서 씁니다.

 #property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots    1
//--- plot Label1
#property indicator_label1   "Label1"
#property indicator_type1   DRAW_LINE
#property indicator_color1   clrOrangeRed
#property indicator_style1   STYLE_SOLID
#property indicator_width1   1
//--- input parameters
input string    s= "EURUSD" ;
input ENUM_TIMEFRAMES       tf;           // D1
input int       countBars= 100 ;           // count
//--- put parameters
int    copied,i;
//--- indicator buffers
double          Label1Buffer[];
//--- buffers
double          p_Symbol[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
   SetIndexBuffer ( 0 ,Label1Buffer, INDICATOR_DATA );
   SetIndexBuffer ( 1 ,p_Symbol, INDICATOR_CALCULATIONS );
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate ( const int rates_total,
                 const int prev_calculated,
                 const int begin,
                 const double &price[])
  {
//---
   if (prev_calculated== 0 )
     {
       ArrayInitialize (Label1Buffer, EMPTY_VALUE );
       ArrayInitialize (p_Symbol, EMPTY_VALUE );
       ArraySetAsSeries (Label1Buffer, true );
       ArraySetAsSeries (p_Symbol, true );
       ArraySetAsSeries (price, true );
     };
   ArrayCopy (p_Symbol,price, 0 , 0 ,countBars);
   if ( _LastError != 0 ) { Print ( _LastError ); return (prev_calculated);};
   if ( _LastError == 0 )
     {
       for (i=countBars;i> 0 ;i--)
        {
         Label1Buffer[i]=p_Symbol[i];
         Print ( "limitBars i = " + IntegerToString (i));
        };
     };
//--- return value of prev_calculated for next call
   return (rates_total);
  }
 
Silent :

INDICATOR_DATA는 그릴 데이터 입니다. 이 버퍼(크기)는 터미널에서 모니터링합니다(내가 이해하는대로 Rates_total로).

중간 계산을 위한 버퍼를 추가합니다(INDICATOR_CALCULATIONS). 그들을 위해 크기를 설정하십시오.

추신: #include <TimeSeries.mqh>가 "어떤 이유로 열리지 않습니다. 컴파일되지 않습니다.

업데이트 월요일 당신은 기다려야 합니다. 여기에 뭔가가 없습니다.

여기로 가져가세요 : https://www.mql5.com/ru/code/1008

방금 뭔가를 찾았으므로 아직 코드를 건드리지 않았습니다. 그리고 문제가 해결될 때까지 이곳의 대중들이 저를 쇼핑하게 만듭니다.

문제가 있는 코드가 OnInit()에서 OnCalculate()로 이동하면 모든 것이 작동할 것이라고 생각합니다. 5가지의 특성은 오랫동안 알려져 왔습니다. OnInit의 어떤 코드도 정상적으로 작동하지 않습니다. SetIndexBuffer()를 통해 등록된 자동 할당 버퍼의 실제 할당은 OnInit()를 종료한 후에야 종료되도록 보장됩니다. 백그라운드에서 발생해야 하기 때문입니다(자동이죠?).

TimeSeries - Библиотека функций для работы с таймсериями
TimeSeries - Библиотека функций для работы с таймсериями
  • 투표: 12
  • 2012.08.24
  • Andrey Khatimlianskii
  • www.mql5.com
Библиотека функций для работы с таймсериями: iBars, iTime, iOpen, iHigh, iLow, iClose, iVolume, iHighest, iLowest, iBarshift. Для всех функций доступен краткий вариант вызова (с символом и периодом текущего графика).
 

클라우드에서 작업을 받을 때 에이전트 8명 중 3명만 동시에 작업할 수 있다는 것을 알았습니다.
테스트를 병렬로 실행하더라도 나머지 에이전트도 포함됩니다.

그래야만 합니까?