초보자의 질문 MQL5 MT5 MetaTrader 5 - 페이지 1467

 
Alexey Viktorov #:

무슨 뜻인가요? 한 배열에서 다른 배열로 몇 개의 요소를 복사하기 위해 일부 temp[]를 복사하기 전에 배열 크기를 설정해야 한다고 생각하십니까? ArrayResize(temp, new_size; ?????

물론 배열 크기는 항상 알려져 있거나 알 수 있다는 뜻이 아닙니다. 그리고 인덱스 오버런에 대해 제어할 수 있고 제어해야 합니다.

 
Valeriy Yastremskiy #:

물론 배열 크기는 항상 알려져 있거나 알 수 있다는 뜻이 아닙니다. 그리고 인덱스 오버런에 대해 제어할 수 있고 제어해야 합니다.

제어할 수는 있지만 항상 필요한 것은 아닙니다...

 
Alexey Viktorov #:

제어는 가능하지만 항상 필요한 것은 아닙니다....

그럼 한계를 넘어선 후에 시작하세요))))
 
Valeriy Yastremskiy #:
헤헤, 그럼 넘어가서 시작하세요)))))

여기 보세요...

트레이딩, 자동매매 시스템, 트레이딩 전략 테스트에 관한 포럼.

초보자의 질문 MQL5 MT5 메타트레이더 5

알렉세이 빅토로프, 2023.06.27 21:19

무엇이 문제인가요? 배열 temp[] 를 선언하고 30개의 요소를 복사한 후 최소/최대 값의 인덱스를 찾습니다. 그리고 마지막에 30 개 미만이면 남은 수를 복사합니다. 이 경우에는 차라리 while() 루프를 사용하고 싶습니다.


temp[] 배열의 크기를 제어해야 하는 이유는 무엇인가요?

temp[]로 복사하는 배열의 크기를 제어해야 한다는 데는 이견이 없습니다... 하지만 최대값\최소값을 찾는 배열의 크기를 제어해야 하는 이유는 무엇일까요?

 
EA에서 호출하는 DLL에서 웹 소켓 연결 호출이 있는 경우 터미널 설정에서 호스트 주소를 허용해야 하나요?
 
leonerd 터미널 설정에서 호스트 주소를 허용해야 하나요?

예, 터미널은 허용된 것만 명시적으로 호출합니다.

 
Valeriy Yastremskiy #:

네, 단말기는 승인된 단말기만 탐색하고 있습니다.

따라서 터미널이 아니라 DLL이 문제입니다.

 
leonerd #:

따라서 문제가 되는 것은 터미널이 아니라 DLL입니다.

터미널에서 인증된 호스트가 필요하지 않습니다. 터미널에서 dll을 사용할 수 있도록 허용하는 것만으로도 충분하며, dll 자체는 무엇이든 할 수 있습니다.

 
dll 가져오기를 통해 ShellExecuteW를 제외한 파일을 여는 방법을 알려주실 수 있나요? winapi.mqh에도 비슷한 기능이 있나요?
 

이 코드가 어디에서 제대로 작동하지 않는지 알려주시겠어요? 원하는 대로 무작위로 레코드를 읽고 모든 것을 찾지 못하며 새로 시작할 때 새로운 결과를 제공합니다.

//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2020, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
input int                  RULE1  = 0;
input int                  RULE2  = 0;
input int                  RULE3  = 0;
input int                  RULE4  = 0;
input bool                 FastComb  = 1;
input int                  FileLine= 20000;
input string               InpFileName="Report.csv";
//+------------------------------------------------------------------+
//| Structure Positions                                              |
//+------------------------------------------------------------------+
struct STRUCT_POSITION
  {
   ENUM_POSITION_TYPE pos_type;              // position type
   bool              waiting_transaction;    // waiting transaction, "true" -> it's forbidden to trade, we expect a transaction
   ulong             waiting_order_ticket;   // waiting order ticket, ticket of the expected order
   bool              transaction_confirmed;  // transaction confirmed, "true" -> transaction confirmed
   //--- Constructor
   STRUCT_POSITION()
     {
      pos_type                   = WRONG_VALUE;
      waiting_transaction        = false;
      waiting_order_ticket       = 0;
      transaction_confirmed      = false;
     }
  };
STRUCT_POSITION SPosition[];
///////////////////////////
struct Report
  {
   long              Pass;
   double            Result;
   double            Profit;
   double            Payoff;
   double            ProfitFactor;
   double            RecoveryFactor;
   double            SharpeRatio;
   long              Custom;
   double            EquityDD;
   long              Trades;
   long               Field1;
   long               Field2;
   long               Field3;
   long               Field4;
   long               Field5;
   long               Field6;
   long               Field7;
   long               Field8;
   long               Field9;
  };
long ProfitComb[20001][10];
///////////////////////////
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
   if(FastComb)
     {
      ArrayInitialize(ProfitComb,-1);
      ReportListComb();
      int FindComb=0;
      for(int i=0; i<=FileLine; i++)
        {
         if(RULE1==ProfitComb[i][1] && RULE2==ProfitComb[i][2] && RULE3==ProfitComb[i][3] && RULE4==ProfitComb[i][4])
           {
            FindComb=1;
            break;
           }
        }
      if(FindComb==0 && RULE1!=0)
         return(INIT_PARAMETERS_INCORRECT);
     }
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
void ReportListComb()
  {
   Report ReportStr[];
   ResetLastError();
   ArrayResize(ReportStr,FileLine);
   string subfolder="Data";
   int file_handle=FileOpen(subfolder+"\\Report.csv",FILE_READ|FILE_WRITE|FILE_CSV|FILE_ANSI|FILE_COMMON,';');
   if(file_handle!=INVALID_HANDLE)
     {
      int i=0;
      while(!FileIsEnding(file_handle))
        {
         i++;
         ReportStr[i].Pass=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));
         ReportStr[i].Result=StringToDouble(FileReadString(file_handle));
         ReportStr[i].Profit=FileReadNumber(file_handle);
         ReportStr[i].Payoff=FileReadNumber(file_handle);
         ReportStr[i].ProfitFactor=FileReadNumber(file_handle);
         ReportStr[i].RecoveryFactor=FileReadNumber(file_handle);
         ReportStr[i].SharpeRatio=FileReadNumber(file_handle);
         ReportStr[i].Custom=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));
         ReportStr[i].EquityDD=FileReadNumber(file_handle);
         ReportStr[i].Trades=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));
         ReportStr[i].Field1=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));
         ReportStr[i].Field2=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));
         ReportStr[i].Field3=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));
         ReportStr[i].Field4=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));
         ReportStr[i].Field5=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));
         ReportStr[i].Field6=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));
         ReportStr[i].Field7=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));
         ReportStr[i].Field8=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));
         ReportStr[i].Field9=StringToInteger(DoubleToString(FileReadNumber(file_handle),0));

         ProfitComb[i][1]=ReportStr[i].Field1;
         ProfitComb[i][2]=ReportStr[i].Field2;
         ProfitComb[i][3]=ReportStr[i].Field3;
         ProfitComb[i][4]=ReportStr[i].Field4;
         ProfitComb[i][5]=ReportStr[i].Field5;
         ProfitComb[i][6]=ReportStr[i].Field6;
         ProfitComb[i][7]=ReportStr[i].Field7;
         ProfitComb[i][8]=ReportStr[i].Field8;
         ProfitComb[i][9]=ReportStr[i].Field9;
        }
      FileClose(file_handle);
     }
   else
      PrintFormat("Не удалось открыть файл %s, Код ошибки = %d",InpFileName,GetLastError());
  }
//+------------------------------------------------------------------+
사유: