MQL4 및 MQL5에 대한 초보자 질문, 알고리즘 및 코드에 대한 도움말 및 토론 - 페이지 1755

 
Andrey Sokolov # :

인사말. 말해 주세요. 초기화 또는 틱 중에 MT5에서 테스트를 정의하는 방법은 무엇입니까?

지금까지 OnDeinit() 함수를 호출하기 직전에 호출되는 OnTester() 만 찾았습니다.

MQLInfoInteger(MQL_TESTER)

이 같은.

 
Nerd Trader # :
last_time = iTime ( NULL , 0 , 0 );

   if (last_time > bar.time_open){
    bar.time_open = last_time;
    coint++;//стартовое значение -1
  }

여기서 분명히 잘못된 것이 있습니다!

 

왜요?

 #property indicator_color1 clrIndianRed ;
#property indicator_color2 clrMagenta ;
#property indicator_color3 clrRed ;

extern color Cl1 = clrIndianRed ;
extern color Cl2 = clrMagenta ;
extern color Cl3 = clrRed ;

color sColor[] = { indicator_color1 , indicator_color2 , indicator_color3 }; // Так нормально
color sColor[] = {Cl1,Cl2,Cl3}; // Так ошибки 'Cl1' - constant expression required 

---

입력/외부 문자열에서 배열을 수집하는 방법은 무엇입니까?

 
Vitaly Muzichenko # :

왜요?

---

입력/외부 문자열에서 배열을 수집하는 방법은 무엇입니까?

색상을 입력에서 문자열로 가져온 다음 문자열을 배열로 제거합니다.

지금은 색상 코드를 변경하고 싶지 않습니다. 스스로 알아낼 수 있을 것입니다. 다음과 같은 배열로 전송된 문자 목록이 있습니다.

   string s_arr[]; // В этом массиве будет перечень нужных символов
   if ( StringSplit ( slist , ',' , s_arr) <= 0 )
   {
     Print ( __FUNCTION__ + " Error converting !" );
     return ;
   }

이것은 입력 변수의 목록입니다.

 
Vitaly Muzichenko # :

왜요?

---

입력/외부 문자열에서 배열을 수집하는 방법은 무엇입니까?

Alexey에 동의

 extern string Colors = "clrIndianRed/clrMagenta/clrRed" ;
color sColor[];
//+------------------------------------------------------------------+
int OnInit ()
  {
   ushort sep  = StringGetCharacter ( "/" , 0 );
   string tempLevel[];
   int sz1  = StringSplit (Colors,sep,tempLevel);
   ArrayResize (sColor,sz1);
   for ( int i= 0 ; i<sz1; i++)
   {
    sColor[i] = StringToColor (tempLevel[i]); Print (i, " / " ,sColor[i]);
   }
//---
   return ( INIT_SUCCEEDED );
  }
 
Alexey Viktorov # :

색상을 입력에서 문자열로 가져온 다음 문자열을 배열로 제거합니다.

지금은 색상 코드를 변경하고 싶지 않습니다. 스스로 알아낼 수 있을 것입니다. 다음과 같은 배열로 전송된 문자 목록이 있습니다.

이것은 입력 변수의 목록입니다.

이 방법을 알고 있지만 그렇게 작동하지 않습니다. 목록에서 선택할 방법이 없습니다.


 

지금은 색상이 이렇고 편하지도 않고, 파라미터 변경을 표준으로 적용한 후 색상을 변경할 수 없는 이유를 찾을 수 없습니다.


 
Vitaly Muzichenko # :

지금은 색상이 이렇고 편하지도 않고, 파라미터 변경을 표준으로 적용한 후 색상을 변경할 수 없는 이유를 찾을 수 없습니다.


그럼

 extern color Cl1 = clrIndianRed ;
extern color Cl2 = clrMagenta ;
extern color Cl3 = clrRed ;
string Colors = ColorToString (Cl1)+ "/" + ColorToString (Cl2)+ "/" + ColorToString (Cl3);
color sColor[];
//+------------------------------------------------------------------+
int OnInit ()
  {
   ushort sep  = StringGetCharacter ( "/" , 0 );
   string tempLevel[];
   int sz1  = StringSplit (Colors,sep,tempLevel);
   ArrayResize (sColor,sz1);
   for ( int i= 0 ; i<sz1; i++)
   {
    sColor[i] = StringToColor (tempLevel[i]); Print (i, " / " ,sColor[i]);
   }
//---
   return ( INIT_SUCCEEDED );
  }
 
MakarFX # :

그럼

딱 필요한 것!

고맙습니다!

추신: 매개 변수가 저장되지 않은 이유를 찾았고 끝에 세미콜론이 있었고 입력에서 복사할 때 얻었습니다. 제거하면 모두 작동했습니다. 부주의.