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

 

안녕하세요! 2020.10.28_05:19 GMT+3. 지표 LeManTrend_Indicator.mq5를 네 번째 버전인 .mq4로 번역했습니다. 표시기가 차트에 나타나지만 GBPUSD, H1 차트를 M5 MetaTrader4 시간 프레임으로 전환하려고 하면 정지되고 프로세서가 로드됩니다. MetaTrader4를 닫았다가 다시 열어야 합니다. 차트에서 LeManTrend_Indicator.ex4를 제거하면 정지가 발생하지 않습니다. 표시기 코드에 무엇이 잘못 쓰여 있는지 이해가 되지 않습니다. 누가 제안할까요? 그것을 고치는 방법?

그리고 LeMan_BrainTrend1Sig.mq5가 네 번째 버전으로 번역되었습니다. 지표 목록에는 있지만 차트에는 아무 것도 표시되지 않습니다. 이 표시기의 코드를 다시 작성하여 제대로 작동하도록 하는 방법을 모르겠습니다. 이전에는 조언자만 작성했습니다. 체크인 방법   전략 테스터   -- 알아요. 그리고 코드에 Print() 변수를 작성합니다. 어디에서 잘못 작성되었는지 명확해집니다. 지표를 확인하는 방법을 모르겠습니다. 코드에 Print()를 작성합니다. 이는 어떤 로그에도 반영되지 않습니다. 표시기가 작동하고 하드 드라이브의 공간을 차지하지 않도록 표시기로 무엇을 해야할지 누가 알려줄까요? 답변을 기다리겠습니다. 05:44 GMT+3.

예, 이제 표시기 코드를 게시하겠습니다. 그리고 더. 지표를 .mq5에서 .mq4로 전송하는 이유는 무엇입니까? 내 중개인은 MetaTrader4에만 루블 계정을 가지고 있기 때문입니다. 그리고 지표는 다섯 번째 버전으로 작성되었습니다. 그리고 MetaTrader4를 위한 수익성 있는 Expert Advisor를 작성하려면 지표가 필요합니다. 그게 다야 05:53 GMT+3.

Тестирование стратегий - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
Тестирование стратегий - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
  • www.metatrader5.com
Тестер стратегий позволяет тестировать и оптимизировать торговые стратегии (советники) перед началом использования их в реальной торговле. При тестировании советника происходит его однократная прогонка с начальными параметрами на исторических данных. При оптимизации торговая стратегия прогоняется несколько раз с различным набором параметров...
 
Николай Никитюк :

안녕하세요! 2020.10.28_05:19 GMT+3. 지표 LeManTrend_Indicator.mq5를 네 번째 버전인 .mq4로 번역했습니다. 표시기가 차트에 나타나지만 GBPUSD, H1 차트를 M5 MetaTrader4 시간 프레임으로 전환하려고 하면 정지되고 프로세서가 로드됩니다. MetaTrader4를 닫았다가 다시 열어야 합니다. 차트에서 LeManTrend_Indicator.ex4를 제거하면 정지가 발생하지 않습니다. 표시기 코드에 무엇이 잘못 쓰여 있는지 이해가 되지 않습니다. 누가 제안할까요? 그것을 고치는 방법?

그리고 LeMan_BrainTrend1Sig.mq5가 네 번째 버전으로 번역되었습니다. 지표 목록에는 있지만 차트에는 아무 것도 표시되지 않습니다. 이 표시기의 코드를 다시 작성하여 제대로 작동하도록 하는 방법을 모르겠습니다. 이전에는 조언자만 작성했습니다. 체크인 방법   전략 테스터   -- 알아요. 그리고 코드에 Print() 변수를 작성합니다. 어디에서 잘못 작성되었는지 명확해집니다. 지표를 확인하는 방법을 모르겠습니다. 코드에 Print()를 작성합니다. 이는 어떤 로그에도 반영되지 않습니다. 표시기가 작동하고 하드 드라이브의 공간을 차지하지 않도록 표시기로 무엇을 해야할지 누가 알려줄까요? 답변을 기다리겠습니다. 05:44 GMT+3.

예, 이제 표시기 코드를 게시하겠습니다. 그리고 더. 지표를 .mq5에서 .mq4로 전송하는 이유는 무엇입니까? 내 중개인은 MetaTrader4에만 루블 계정을 가지고 있기 때문입니다. 그리고 지표는 다섯 번째 버전으로 작성되었습니다. 그리고 MetaTrader4를 위한 수익성 있는 Expert Advisor를 작성하려면 지표가 필요합니다. 그게 다야 05:53 GMT+3.

LeManTrend_Indicator.mq5 - 지표 자체 https://www.mql5.com/ru/code/27570

4중주에서도 작동합니다 - (err_text) 이전에 반복되는(문자열)을 제거하면 됩니다.

       string err_text=( TerminalInfoString ( TERMINAL_LANGUAGE )== "Russian" )?
                       "Параметр \"Midle\" меньше 1!" :
                       "Parameter \"Midle\" is less than 1!" ;

어떻게 될까요

 //+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- check "MA averaging period" parameter
   if (PeriodEMA< 1 )
     {
       string err_text=( TerminalInfoString ( TERMINAL_LANGUAGE )== "Russian" )?
                       "Параметр \"MA averaging period\" меньше 1!" :
                       "Parameter \"MA averaging period\" is less than 1!" ;
       //--- when testing, we will only output to the log about incorrect input parameters
       if ( MQLInfoInteger ( MQL_TESTER ))
        {
         Print ( __FILE__ , " " , __FUNCTION__ , ", ERROR: " ,err_text);
         return ( INIT_FAILED );
        }
       else // if the Expert Advisor is run on the chart, tell the user about the error
        {
         Alert ( __FILE__ , " " , __FUNCTION__ , ", ERROR: " ,err_text);
         return ( INIT_PARAMETERS_INCORRECT );
        }
     }
//--- check "Min" parameter
   if (Min< 1 )
     {
      err_text=( TerminalInfoString ( TERMINAL_LANGUAGE )== "Russian" )?
               "Параметр \"Min\" меньше 1!" :
               "Parameter \"Min\" is less than 1!" ;
       //--- when testing, we will only output to the log about incorrect input parameters
LeManTrend Indicator
LeManTrend Indicator
  • www.mql5.com
Индикатор на основе анализа максимальных и минимальных цен. Сигналы индикатора возникают в месте пересечения линий 'BUY' и 'SELL':
 
SanAlex :

LeManTrend_Indicator.mq5 - 지표 자체 https://www.mql5.com/ru/code/27570

네 번째에서도 작동합니다. (err_text) 이전에 반복되는(문자열)을 제거하면 됩니다.

어떻게 될까요

 
Николай Никитюк :

4용 BrainTrend1Sig 는 여기 - https://www.mql5.com/en/code/8772

여기에 LeManTrend_Indicator.mq4 를 추가해야 하며 이미 4개에 대해 수정되었습니다.

BrainTrend1Sig
BrainTrend1Sig
  • www.mql5.com
Индикатор BrainTrend1Sig.
 
SanAlex :

4용 BrainTrend1Sig 는 여기 - https://www.mql5.com/ru/code/8772

여기에 LeManTrend_Indicator.mq4 를 추가해야 하며 이미 4개에 대해 수정되었습니다.

오류 발생 - 이 줄을 삭제해야 합니다( double const = 0; )

모든 것이 작동할 것입니다

이중 상수 = 0;

이중 상수 = 0; 2.png


 
Nikolai Semko :

글쎄, 당신은 코미디언입니다.

내가 여기서 누구를 십자가에 못박고 있습니까?



왜 그런 상황입니까? 동일한 막대 인덱스. 또한 심볼의 첫 번째 시작에서만 발생하는 것처럼 보입니다. 또는 더 깊은 역사. 위의 코드에서 막대가 있는지 확인하는 것으로 생각했습니다.

 
Николай Никитюк :


여기에 좋은 지표가 있습니다 https://www.mql5.com/en/code/28364

필요한 모든 것을 넣을 수 있습니다!

 //+------------------------------------------------------------------+
//|                                                      Phoenix.mq4 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
//--- setting the indicator name
#property description "Phoenix"
//--- set the strict mode of compilation
#property strict
//--- specify where to draw the indicator
#property indicator_chart_window
//--- specify the number of buffers
#property indicator_buffers 2
//--- setting the color of the indicator rendering
#property indicator_color1 clrGreenYellow
#property indicator_color2 clrRed
//--- we define the input parameters

//--- specify arrays of indicator buffers
double arrow_01[];
double arrow_02[];
//*********************************************//
bool flag_buy   = false ;
bool flag_sell  = false ;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ( void )
  {
   string short_name;
//--- we specify two additional buffers for calculations
   IndicatorBuffers( 2 );
   SetIndexBuffer ( 0 ,arrow_01);
   SetIndexBuffer ( 1 ,arrow_02);
//--- setting the indicator to be drawn as a line
   SetIndexStyle( 0 , DRAW_ARROW ,EMPTY, 2 , clrGreenYellow );
   SetIndexArrow( 0 , 233 );
   SetIndexBuffer ( 0 ,arrow_01);
   SetIndexStyle( 1 , DRAW_ARROW ,EMPTY, 2 , clrRed );
   SetIndexArrow( 1 , 234 );
   SetIndexBuffer ( 1 ,arrow_02);
//--- setting a name in the DataWindow window and a label
   short_name= "Phoenix" ;
   IndicatorShortName(short_name);
   SetIndexLabel( 0 ,short_name);
//--- if there are no errors,initialization is completed successfully
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//|                            Phoenix                               |
//+------------------------------------------------------------------+
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[])
  {
   for ( int shift=rates_total; shift>= 0 ; shift--)
     {
       //--- to simplify the coding and speed up access data are put into internal variables
       double MacdCurrent= iMACD ( NULL , 0 , 12 , 26 , 9 , PRICE_CLOSE ,MODE_MAIN,shift);
       double SignalCurrent= iMACD ( NULL , 0 , 12 , 26 , 9 , PRICE_CLOSE ,MODE_SIGNAL,shift);
        {
         if (flag_buy== false )
             //--- check for long position (BUY) possibility
             if (MacdCurrent>SignalCurrent)
              {
               arrow_01[shift]=Low[shift];
               flag_buy= true ;
               flag_sell= false ;
              }
         if (flag_sell== false )
             //--- check for short position (SELL) possibility
             if (MacdCurrent<SignalCurrent)
              {
               arrow_02[shift]=High[shift];
               flag_buy= false ;
               flag_sell= true ;
              }
        }
     }
   return (rates_total);
  }
//+------------------------------------------------------------------+
Phoenix
Phoenix
  • www.mql5.com
В стрелочном индикаторе Phoenix используется комбинация трех индикаторов: Moving Average, Bolinger Bands и Momentum в сочетании с двумя мощными формулами, основанными на поведении цены текущего графика. В индикаторе Phoenix также реализована система звуковых и текстовых алертов, а также отправка...
파일:
EURUSDM30.png  35 kb
 

안녕하세요!

다음 문제를 해결하도록 도와주세요.

MQL4 Expert Advisor에서 스크립트(Python) 실행이 필요합니다. 다음과 같이 ShellExecuteW()를 사용하여 수행하려고 합니다.

 #import "shell32.dll"
string ShellExecuteW( int hwnd, string Operation, string File, string Parameters, string Directory, int ShowCmd);
#import
#include <WinUser32.mqh>

void OnStart ()
  {
ShellExecuteW( NULL , NULL , "C:\\Users\\yansa\\Desktop\\test_script.py" , NULL , NULL , 1 );
  }

파일에 대한 액세스 오류가 발생했습니다. 스크립트 자체는 실행되지만 코드는 더 이상 진행되지 않습니다.


스크립트를 실행하는 기능을 공유해 주시면 감사하겠습니다.

또 다른 질문: 스크립트 실행을 확인하는 방법은 무엇입니까?

 
Николай Никитюк :

안녕하세요! 2020.10.28_05:19 GMT+3. 나는 지표 LeManTrend_Indicator.mq5를 네 번째 버전인 .mq4로 번역했습니다.

그리고 어울리지 않아

https://www.mql5.com/ru/code/9096

LeManTrend
LeManTrend
  • www.mql5.com
Индикатор определяет положение тренда на основе текущей цены и максимальных и минимальных цен за три периода.
 
MakarFX :

그리고 어울리지 않아

https://www.mql5.com/ru/code/9096

이게 더 나은듯

 //+------------------------------------------------------------------+
//|                                                      Phoenix.mq4 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
//--- setting the indicator name
#property description "Phoenix"
//--- set the strict mode of compilation
#property strict
//--- specify where to draw the indicator
#property indicator_chart_window
//--- specify the number of buffers
#property indicator_buffers 2
//--- setting the color of the indicator rendering
#property indicator_color1 clrGreenYellow
#property indicator_color2 clrRed
//--- we define the input parameters

//--- specify arrays of indicator buffers
double arrow_01[];
double arrow_02[];
//*********************************************//
bool flag_buy   = false ;
bool flag_sell  = false ;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ( void )
  {
   string short_name;
//--- we specify two additional buffers for calculations
   IndicatorBuffers( 2 );
   SetIndexBuffer ( 0 ,arrow_01);
   SetIndexBuffer ( 1 ,arrow_02);
//--- setting the indicator to be drawn as a line
   SetIndexStyle( 0 , DRAW_ARROW ,EMPTY, 2 , clrGreenYellow );
   SetIndexArrow( 0 , 233 );
   SetIndexBuffer ( 0 ,arrow_01);
   SetIndexStyle( 1 , DRAW_ARROW ,EMPTY, 2 , clrRed );
   SetIndexArrow( 1 , 234 );
   SetIndexBuffer ( 1 ,arrow_02);
//--- setting a name in the DataWindow window and a label
   short_name= "Phoenix" ;
   IndicatorShortName(short_name);
   SetIndexLabel( 0 ,short_name);
//--- if there are no errors,initialization is completed successfully
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//|                            Phoenix                               |
//+------------------------------------------------------------------+
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[])
  {
   for ( int shift=rates_total; shift>= 0 ; shift--)
     {
       //--- to simplify the coding and speed up access data are put into internal variables
       double MacdCurrent= iCustom ( NULL , 0 , "LeManTrend" , 13 , 21 , 34 , 3 ,MODE_MAIN,shift);
       double SignalCurrent= iCustom ( NULL , 0 , "LeManTrend" , 13 , 21 , 34 , 3 ,MODE_SIGNAL,shift);
        {
         if (flag_buy== false )
             //--- check for long position (BUY) possibility
             if (MacdCurrent>SignalCurrent)
              {
               arrow_01[shift]=Low[shift];
               flag_buy= true ;
               flag_sell= false ;
              }
         if (flag_sell== false )
             //--- check for short position (SELL) possibility
             if (MacdCurrent<SignalCurrent)
              {
               arrow_02[shift]=High[shift];
               flag_buy= false ;
               flag_sell= true ;
              }
        }
     }
   return (rates_total);
  }
//+------------------------------------------------------------------+
파일: