Fragen von Anfängern MQL5 MT5 MetaTrader 5 - Seite 1192

 
Artem Mordvinkin:


Es steht im Klartext geschrieben, dass die Symbole automatisch mit dem Test verbunden sind

Wenn Sie auf sie zugreifen.
 
Artem Mordvinkin:


Ja, auf Russisch steht, dass die Symbole während der Prüfung automatisch verbunden werden.

Um einen Indikator zu erstellen, müssen Sie zunächst ein Symbol in Market Watch (in Ihrem Fall in Market Watch des Testers) verbinden.

 
Artyom Trishkin:
Fordern Sie alle Daten von jedem gewünschten Symbol an.

Sie von SymbolSelect() fehlen - nicht ausgewählt

Sehr geehrte Damen und Herren, bevor Sie mich auf Veröffentlichungen verweisen (wofür ich Ihnen danke), prüfen Sie, ob Ihre Mehrfachwährungen im Tester funktionieren. Und wenn sie das tun, ist es sinnvoll

 
Artem Mordvinkin:

Sie von SymbolSelect() fehlen - nicht ausgewählt

Sehr geehrte Damen und Herren, bevor Sie mich auf Veröffentlichungen verweisen (wofür ich Ihnen danke), prüfen Sie, ob Ihre Mehrfachwährungen im Tester funktionieren. Und wenn sie das tun, ist es sinnvoll

Sie funktionieren. Auf dem neuesten Build. Überhaupt keine Probleme.
 
Artyom Trishkin:
Es funktioniert. Auf dem neuesten Build. Überhaupt keine Probleme.

Wie haben Sie sie verbunden (Symbole) - können Sie mir sagen, welche Funktion?

 
Artem Mordvinkin:

Wie haben Sie sie verbunden (Symbole) - können Sie mir sagen, welche Funktion?

SymbolSelect(Zeichenname,true);

 
Vladimir Karputov:

SymbolSelect(Zeichenname,true);

Ich tue dasselbe.

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


Ich verstehe das so

2020.03.09 19:19:45.766 Symbol EURUSDrfd existiert nicht

2020.03.09 19:19:45.766 Symbol USDJPYrfd existiert nicht

2020.03.09 19:19:45.766 Symbol AUDUSDrfd existiert nicht


Das Kabel gibt keine Fehlermeldung aus, da es im Prüfgerät ausgewählt ist.

Die Symbolnamen sind korrekt.


UPD scheint mir, dass es etwas in den Terminaleinstellungen selbst tun muss. Wenn vor dem letzten Build alles funktionierte, hat es nichts mit dem Code zu tun. Der Tester kann die Symbole nicht sehen.

 
Artem Mordvinkin:


2020.03.09 19:19:45.766 Symbol EURUSDrfd existiert nicht

2020.03.09 19:19:45.766 Symbol USDJPYrfd existiert nicht

2020.03.09 19:19:45.766 Symbol AUDUSDrfd existiert nicht


Das Kabel gibt keine Fehlermeldung aus, da es im Prüfgerät ausgewählt ist.

Was ist das? Wo ist der Code? Wie bekommen Sie es? Vor allem, wenn Sie völlig unterschiedliche Charaktere auswählen.

 
Vladimir Karputov:

Was ist das? Wo ist der Code? Wie bekommen Sie es? Vor allem, weil Sie sich für völlig unterschiedliche Charaktere entscheiden.

Verstanden, machen wir es so.

Gegeben (Name der Personen)


Code (Fragmente)

//----------------------------название инструмента
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);
}

Wählen wir als Beispiel das Kabel im Prüfgerät.


Führen Sie es aus und

2020.03.09 19:19:45.766 Symbol EURUSDrfd existiert nicht

2020.03.09 19:19:45.766 Symbol USDJPYrfd existiert nicht

2020.03.09 19:19:45.766 Symbol AUDUSDrfd existiert nicht

Es liegt kein Fehler am Kabel vor - es ist standardmäßig im Prüfgerät ausgewählt

Und nur für den Fall, werde ich sagen, dass dieses Problem nur in der Testversion auftritt. Und dass die Eule mehrere Jahre alt ist und der Fehler 2 Tage alt ist und dass dies bei allen meinen Mehrwährungseulen der Fall ist.
 

Beispiel für die Erstellung eines iMA-Indikators für das Symbol "USDJPY", wobei der Tester auf "EURUSD" läuft.

//+------------------------------------------------------------------+
//|                                        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);
  }
//+------------------------------------------------------------------+

Das Ergebnis ist korrekt. Zuerst wird das Symbol ausgewählt und dann der Indikator mit diesem Symbol erstellt.


Dateien:
Grund der Beschwerde: