Errores, fallos, preguntas - página 2817

 
¿es posible controlar esta cifra a través de MQL? (esta es la caja de la línea del gráfico en MT)
 
TesterMaxProfit.all_symbols.M1.20200727.20200805.42.405 CEC9C4975113F378E5F241968A332.opt

¿Puede decirme qué algoritmo se utiliza para formar el nombre de los archivos opt?

 

en mt4 - me parece que ChartSaveTemplate(...) funciona con errores, build 1280

Aquí está el guión:

//+------------------------------------------------------------------+
//|                                              Test.mq4            |
//|                   Copyright 2006-2015, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright   "2006-2015, MetaQuotes Software Corp."
#property link        "http://www.mql4.com"
#property strict
#property  show_inputs

void OnStart()
{
   string s_Symbol = Symbol();
   string s_EA_Name = "eStomper_02";
   string s_MagicChartIDSuffix = "MagicChart";
   int i_Magic = 1;
   string s_GlobalMagicChartID;
   string s_Period = _Period;
   
   s_GlobalMagicChartID = StringConcatenate(s_EA_Name,"-",s_MagicChartIDSuffix,"-",i_Magic,"-",s_Symbol,"-",s_Period);
   if(ChartSaveTemplate(0,s_GlobalMagicChartID))
   {
      Print("s_GlobalMagicChartID=",s_GlobalMagicChartID);     
   }
   else
   {
      Print(__FUNCTION__," Couldnot Save template : " + s_GlobalMagicChartID + ".tpl" + "Error = " + GetLastError());
      return;
   }
}
//+------------------------------------------------------------------+
для М1 и М5 имя шаблона усекается, _Period - в имени шаблона не присутсвует..

смотрю полный игнор, но вот если сделать так, то все в порядке. явно в компиляторе ошибка, что-то типа неправильного выравнивания.


//+------------------------------------------------------------------+
//|                                              Test.mq4            |
//|                   Copyright 2006-2015, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright   "2006-2015, MetaQuotes Software Corp."
#property link        "http://www.mql4.com"
#property strict
#property  show_inputs

void OnStart()
{
   string s_Symbol = Symbol();
   string s_EA_Name = "eStomper_02";
   string s_MagicChartIDSuffix = "MagicChart";
   int i_Magic = 1;
   string s_GlobalMagicChartID;
   string s_Period = _Period;
   
   if (s_Period == "1" || s_Period == "5")
   {
      s_Period = "0" + s_Period;
   }
   s_GlobalMagicChartID = StringConcatenate(s_EA_Name,"-",s_MagicChartIDSuffix,"-",i_Magic,"-",s_Symbol,"-",s_Period);
   if(ChartSaveTemplate(0,s_GlobalMagicChartID))
   {
      Print("s_GlobalMagicChartID=",s_GlobalMagicChartID);     
   }
   else
   {
      Print(__FUNCTION__," Couldnot Save template : " + s_GlobalMagicChartID + ".tpl" + "Error = " + GetLastError());
      return;
   }
}
//+------------------------------------------------------------------+



 
fxsaber:

¿Puede decirme qué algoritmo se utiliza para formar el nombre de los archivos opt?

Esto es MD5 de los valores de los parámetros de entrada del Asesor Experto (para los optimizados - start-step-stop, para los no optimizados - valor actual)

42 - ticks reales, optimización por símbolos

Торговые советники и собственные индикаторы - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
Торговые советники и собственные индикаторы - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
  • www.metatrader5.com
Среди программ для автоматического трейдинга можно выделить две большие категории: торговые роботы и индикаторы. Первые предназначены для совершения торговых операций на рынках, а вторые — для анализа котировок и выявления закономерностей в их изменении. При этом индикаторы могут использоваться непосредственно в роботах, образуя полноценную...
 
Pavel Verveyko:
¿es posible controlar esta cifra a través de MQL? (esta es la caja de la línea del gráfico en MT)
Uso de esta biblioteca
 
Rorschach:
Con la ayuda de esta biblioteca

muchas gracias

 

Pregunta de aclaración. ¿Cómo puedo saber el símbolo y el marco temporal de un indicador por su mango?

Existe la funciónIndicatorParameters en la API de MQL para leer los parámetros del indicador, pero no es suficiente: ¿de qué sirve conocer, por ejemplo, el periodo, si no se conocen el símbolo y el marco temporal? No estoy seguro de si esto es una omisión o no puedo encontrar cómo hacerlo - por favor, dame el enlace.

 
Stanislav Korotky:

Pregunta de aclaración. ¿Cómo puedo saber de un indicador el símbolo y el marco temporal para el que fue creado?

de ninguna manera

No puedo. El año pasado@fxsaber hizo la misma pregunta, pero con respecto a los archivos - cómo saber el nombre del archivo de un mango, no hay solución

Encontré una sugerencia de contenedor para una manija de archivo de@fxsaber

struct FILE
{
  const int handle;
  
  FILE( const string FileName, const int Flags ) : handle(::FileOpen(FileName, Flags)) {}  
  ~FILE( void ) { if (this.handle != INVALID_HANDLE) ::FileClose(this.handle); }
};
 
Stanislav Korotky:

Pregunta de aclaración. ¿Cómo puedo saber el símbolo y el marco temporal de un indicador por su mango?

Existe la función IndicatorParameters en la API de MQL para leer los parámetros del indicador, pero no es suficiente: ¿de qué sirve conocer, por ejemplo, el periodo, si no se conocen el símbolo y el marco temporal? Si hay un error o no encuentro cómo hacerlo, por favor, dame el enlace.

Igor Makanu:

de ninguna manera

Sí, puedes hacerlo.

bool FindIndicatorByHandle(long handle, string &symbol, ENUM_TIMEFRAMES &timeframe, long &ChartId, int &sub_win, string &Name) {
   long chart_id =ChartFirst();
   while (chart_id!=-1) {
      int total_sub = (int)ChartGetInteger(chart_id,CHART_WINDOWS_TOTAL);
      int total_ind;
      for(int i=0; i<total_sub; i++) {
         total_ind = ChartIndicatorsTotal(chart_id,i);
         for (int j=0; j<total_ind; j++) {
            string name = ChartIndicatorName(chart_id,i,j);
            if (ChartIndicatorGet(chart_id,i,name)== handle) {
               ChartId=chart_id;
               symbol= ChartSymbol(chart_id);
               timeframe=ChartPeriod(chart_id);
               sub_win=i;
               Name=name;
               return true;
            }
         }
      }
      chart_id=ChartNext(chart_id);
   }
   return false;
}

Adjunto el script de prueba.

El resultado del trabajo del guión:

2020.08.07 01:39:43.435 All_Indicators (US30Index,M1)   Market Watch: CADRUB  USDRUB  USDCAD  EURCAD  EURUSD  .BrentCrud  XAUUSD  GBPAUD  BTCUSD  US30Index  USDJPY  Symb001  USD-BTC  EURCHF  USDCHF  
2020.08.07 01:39:43.498 All_Indicators (US30Index,M1)   Chart EURUSD PERIOD_M1 has indicators: TestMinMax(handle=10)   RVI(10)(handle=11)   RSI_154(14)(handle=12)   
2020.08.07 01:39:43.499 All_Indicators (US30Index,M1)   Chart .BrentCrud PERIOD_M1 has indicators: 
2020.08.07 01:39:43.500 All_Indicators (US30Index,M1)   Chart CADRUB PERIOD_M1 has indicators: 
2020.08.07 01:39:43.501 All_Indicators (US30Index,M1)   Chart USDCAD PERIOD_M5 has indicators: 
2020.08.07 01:39:43.502 All_Indicators (US30Index,M1)   Chart US30Index PERIOD_M1 has indicators: MA(100)(handle=13)   TestMinMax(handle=14)   
2020.08.07 01:39:43.505 All_Indicators (US30Index,M1)   Chart .BrentCrud PERIOD_D1 has indicators: DinTF(handle=15)   
2020.08.07 01:39:43.509 All_Indicators (US30Index,M1)   Chart USDRUB PERIOD_M1 has indicators: Bands(200)(handle=16)   Env(10)(handle=17)   MACD(12,26,9)(handle=18)   RSI(14)(handle=19)   
2020.08.07 01:39:43.523 All_Indicators (US30Index,M1)   Chart EURUSD PERIOD_M30 has indicators: MA(15)(handle=20)   TestMinMax(handle=21)   
2020.08.07 01:39:43.527 All_Indicators (US30Index,M1)   Chart .BrentCrud PERIOD_M5 has indicators: 
2020.08.07 01:39:43.527 All_Indicators (US30Index,M1)   Chart USDCAD PERIOD_M15 has indicators: DinTF(handle=22)   
2020.08.07 01:39:43.527 All_Indicators (US30Index,M1)   Chart USDCAD PERIOD_H1 has indicators: pMa(2 - 940)(handle=23)   !Channels_3.05)(handle=24)   
2020.08.07 01:39:43.528 All_Indicators (US30Index,M1)   Chart USDCAD PERIOD_H4 has indicators: 
2020.08.07 01:39:43.528 All_Indicators (US30Index,M1)   Chart XAUUSD PERIOD_M1 has indicators: Tick(handle=25)   
2020.08.07 01:39:43.528 All_Indicators (US30Index,M1)   --------------------------------------------------------------------------------
2020.08.07 01:39:43.528 All_Indicators (US30Index,M1)   Попробуем найти индикатор по хэндлу h = 18
2020.08.07 01:39:43.529 All_Indicators (US30Index,M1)   Нашли: USDRUB  PERIOD_M1, chart_id = 128968168864101623, подокно = 1, короткое имя = MACD(12,26,9)
Archivos adjuntos:
 
Nikolai Semko:

Puedes hacerlo.

Su código probablemente funcionará

Nunca he utilizadoChartIndicatorGet(), sólo lo he encontrado en la referencia

pero de todos modos, es más fácil vincular el mango del indicador directamente al nombre del indicador en su código, aunque puede ser la tarea de averiguar lo que el usuario ha lanzado


gracias! interesante

Razón de la queja: