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

 
Artem Mordvinkin :


네, 러시아어로 흰색으로 작성되어 테스트 중에 자동으로 문자가 연결됩니다.

그들에게 연락할 때.
 
Artem Mordvinkin :


네, 러시아어로 흰색으로 작성되어 테스트 중에 자동으로 문자가 연결됩니다.

지표를 만들려면 먼저 기호를 Market Watch(귀하의 경우 테스터의 Market Watch)에 연결해야 합니다.

 
Artyom Trishkin :
원하는 각 캐릭터의 데이터를 요청하세요.

SymbolSelect() 에 의해 부재 - 선택되지 않음

친애하는 각하 저를 출판물에 보내기 전에 (감사합니다) 테스터에서 다중 통화 시스템이 작동하는지 확인하고 작동한다면 의미가 있습니다.

 
Artem Mordvinkin :

SymbolSelect()에 의해 부재 - 선택되지 않음

친애하는 각하 저를 출판물에 보내기 전에 (감사합니다) 테스터에서 다중 통화 시스템이 작동하는지 확인하고 작동한다면 의미가 있습니다.

그들은 일한다. 마지막 빌드에서. 아무 문제 없습니다.
 
Artyom Trishkin :
그들은 일한다. 마지막 빌드에서. 아무 문제 없습니다.

그것들(기호)을 어떻게 연결했습니까? 기능이 무엇인지 알려주세요.

 
Artem Mordvinkin :

그것들(기호)을 어떻게 연결했습니까? 기능이 무엇인지 알려주세요.

SymbolSelect( 기호 이름 , true);

 
Vladimir Karputov :

SymbolSelect( 기호 이름 , true);

저도 그렇게 해요

 SymbolSelect (EURUSD_inst, true );
   SymbolSelect (GBPUSD_inst, true );
   SymbolSelect (USDJPY_inst, true );
   SymbolSelect (AUDUSD_inst, true );


나는 이렇게 얻는다

2020.03.09 19:19:45.766 기호 EURUSDrfd가 존재하지 않습니다

2020.03.09 19:19:45.766 기호 USDJPYrfd가 존재하지 않습니다

2020.03.09 19:19:45.766 기호 AUDUSDrfd가 존재하지 않습니다


케이블은 테스터 자체에서 선택하기 때문에 오류가 발생하지 않습니다.

기호 이름이 정확합니다.


UPD는 터미널 자체의 설정에서 무언가를 수행해야 한다고 생각합니다. 모든 것이 마지막 빌드 전에 작동했다면 코드에 없는 것입니다. 테스터는 기호를 볼 수 없습니다.

 
Artem Mordvinkin :


2020.03.09 19:19:45.766 기호 EURUSDrfd가 존재하지 않습니다

2020.03.09 19:19:45.766 기호 USDJPYrfd가 존재하지 않습니다

2020.03.09 19:19:45.766 기호 AUDUSDrfd가 존재하지 않습니다


케이블은 테스터 자체에서 선택하기 때문에 오류가 발생하지 않습니다.

그것은 무엇입니까? 코드는 어디에 있습니까? 어떻게 얻나요? 더 많은 완벽한 다른 기호를 선택합니다.

 
Vladimir Karputov :

그것은 무엇입니까? 코드는 어디에 있습니까? 어떻게 얻나요? 더 많은 완벽한 다른 기호를 선택합니다.

알았어, 하자

주어진 (캐릭터 이름)


코드(스니펫)

 //----------------------------название инструмента
string EURUSD_inst = "EURUSDrfd" ;
string GBPUSD_inst = "GBPUSDrfd" ;
string AUDUSD_inst = "AUDUSDrfd" ;
string USDJPY_inst = "USDJPYrfd" ;


 void OnTick ()
  {
   SymbolSelect (EURUSD_inst, true );
   SymbolSelect (GBPUSD_inst, true );
   SymbolSelect (USDJPY_inst, true );
   SymbolSelect (AUDUSD_inst, true );
}

예를 들어 테스터에서 케이블을 선택하십시오.


우리는 시작하고

2020.03.09 19:19:45.766 기호 EURUSDrfd가 존재하지 않습니다

2020.03.09 19:19:45.766 기호 USDJPYrfd가 존재하지 않습니다

2020.03.09 19:19:45.766 기호 AUDUSDrfd가 존재하지 않습니다

케이블에 오류가 없습니다. 테스터에서도 강제로 선택됩니다.

그리고 만일을 대비하여 그러한 문제는 테스터에만 있다고 말할 것입니다. 그리고 올빼미는 이미 몇 년이 지났고 오류는 2일이 지났으며 모든 다중 통화 올빼미의 경우입니다.
 

테스터가 'EURUSD'에서 시작되는 동안 'USDJPY' 기호에 iMA 표시기를 만드는 예입니다.

 //+------------------------------------------------------------------+
//|                                        iMA Values on a Chart.mq5 |
//|                              Copyright © 2019, Vladimir Karputov |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2019, Vladimir Karputov"
#property version    "1.001"
//--- input parameters
input    string               Inp_MA_symbol        = "USDJPY" ;     // MA: symbol name
input ENUM_TIMEFRAMES       Inp_MA_period        = PERIOD_D1 ;   // MA: timeframe
input int                   Inp_MA_ma_period     = 12 ;           // MA: averaging period
input int                   Inp_MA_ma_shift      = 5 ;           // MA: horizontal shift
input ENUM_MA_METHOD        Inp_MA_ma_method     = MODE_SMA ;     // MA: smoothing type
input ENUM_APPLIED_PRICE    Inp_MA_applied_price = PRICE_CLOSE ; // MA: type of price
//---
int     handle_iMA;                           // variable for storing the handle of the iMA indicator
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ()
  {
   if (! SymbolSelect (Inp_MA_symbol, true ))
     {
       PrintFormat ( "Failed select symbol %s" ,
                  Inp_MA_symbol);
       return ( INIT_FAILED );
     }
//--- create handle of the indicator iMA
   handle_iMA= iMA (Inp_MA_symbol,Inp_MA_period,Inp_MA_ma_period,Inp_MA_ma_shift,
                  Inp_MA_ma_method,Inp_MA_applied_price);
//--- if the handle is not created
   if (handle_iMA== INVALID_HANDLE )
     {
       //--- tell about the failure and output the error code
       PrintFormat ( "Failed to create handle of the iMA indicator for the symbol %s/%s, error code %d" ,
                  Inp_MA_symbol,
                   EnumToString (Inp_MA_period),
                   GetLastError ());
       //--- the indicator is stopped early
       return ( INIT_FAILED );
     }
//---
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick ()
  {
//---
   double array_ma[];
   ArraySetAsSeries (array_ma, true );
   int start_pos= 0 ,count= 3 ;
   if (!iGetArray(handle_iMA, 0 ,start_pos,count,array_ma))
       return ;

   string text= "" ;
   for ( int i= 0 ; i<count; i++)
      text=text+ IntegerToString (i)+ ": " + DoubleToString (array_ma[i], Digits ()+ 1 )+ "\n" ;
//---
   Comment (text);
  }
//+------------------------------------------------------------------+
//| Get value of buffers                                             |
//+------------------------------------------------------------------+
bool iGetArray( const int handle, const int buffer, const int start_pos,
               const int count, double &arr_buffer[])
  {
   bool result= true ;
   if (! ArrayIsDynamic (arr_buffer))
     {
       //if(InpPrintLog)
       PrintFormat ( "ERROR! EA: %s, FUNCTION: %s, this a no dynamic array!" , __FILE__ , __FUNCTION__ );
       return ( false );
     }
   ArrayFree (arr_buffer);
//--- reset error code
   ResetLastError ();
//--- fill a part of the iBands array with values from the indicator buffer
   int copied= CopyBuffer (handle,buffer,start_pos,count,arr_buffer);
   if (copied!=count)
     {
       //--- if the copying fails, tell the error code
       //if(InpPrintLog)
       PrintFormat ( "ERROR! EA: %s, FUNCTION: %s, amount to copy: %d, copied: %d, error code %d" ,
                   __FILE__ , __FUNCTION__ ,count,copied, GetLastError ());
       //--- quit with zero result - it means that the indicator is considered as not calculated
       return ( false );
     }
   return (result);
  }
//+------------------------------------------------------------------+

결과가 올바르게 생성됩니다. 먼저 심볼을 선택하고 이를 기반으로 지표를 생성합니다.


파일:
사유: