Errori, bug, domande - pagina 2457

 
Qualcuno nel mercato pratica, quando aggiorna il suo prodotto, di allegare (tramite risorse) l'EX5 della versione precedente, in modo che l'utente abbia sempre la possibilità di tornare indietro in caso di errore?
 
fxsaber:
C'è qualcuno nel Mercato che pratica, quando aggiorna il suo prodotto, di mettere (tramite risorse) l'EX5 della versione precedente, in modo che l'utente abbia sempre la possibilità di rollback in caso di errore?

Questo può essere fatto senza risorse...

Il problema è che le nuove versioni possono avere impostazioni diverse...

Portare fuori altre impostazioni è già un problema...

 
Vladimir Pastushak:

Questo può essere fatto senza risorse...

Il problema è che le nuove versioni possono avere impostazioni diverse...

Portare fuori altre impostazioni è già un problema...

Non vedo alcun problema in questo.

 

Quando si richiedono i log da un VPS attivo, viene visualizzato l'errore "Failed to get terminal logs

Chi sa quale può essere il problema? Allo stesso tempo, gli EAs sul VPS funzionano (aprendo/chiudendo trade), ma non posso caricare i logs.

 
fxsaber:

Non vedo alcun problema in questo.

Solo ora ho capito che EX5 della versione precedente deve essere con un meccanismo di protezione.

E attraverso le risorse della versione precedente EX5 sarà in grado di trasferire senza protezione, che non è adatto.

 

Sto scrivendo un indicatore su 5.

Non riesco a fargli aggiornare il periodo della media dal campo di input sul grafico. Su 4, questo disegno funziona.

Cosa c'è che non va? Il campo nell'inite viene aggiornato tramiteOnChartEvent, ma il periodo no. Non posso cambiarlo in nessun modo.

Allego un semplice esempio funzionante.

//+------------------------------------------------------------------+
//|                                                      Probe_2.mq5 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                                 https://mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://mql5.com"
#property description "The MA "
#property version   "1.00"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
//--- plot MA1
#property indicator_label1  "MA 1"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrDarkOrange
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1

//--- input parameters
 extern int PBB=10;  //  период МА
//--- indicator buffers
double         BufferMA1[];
//--- global variables
int            period_ma1;
int            period_max;

int            handle_ma1;
string sn,sPBB;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
  

   sPBB=IntegerToString(PBB);
   if(ObjectFind(0,"P2edit")!=0)
    {
       ObjectCreate(0,"P2edit",OBJ_EDIT,0,0,0);
       ObjectSetInteger(0,"P2edit",OBJPROP_XDISTANCE,300);
       ObjectSetInteger(0,"P2edit",OBJPROP_YDISTANCE,1);
       ObjectSetInteger(0,"P2edit",OBJPROP_XSIZE,70);
       ObjectSetInteger(0,"P2edit",OBJPROP_YSIZE,40);
       ObjectSetInteger(0,"P2edit",OBJPROP_SELECTABLE,false);
       ObjectSetInteger(0,"P2edit",OBJPROP_BGCOLOR,clrBlack);
       ObjectSetString (0,"P2edit",OBJPROP_TEXT,sPBB);
       ObjectSetInteger(0,"P2edit",OBJPROP_FONTSIZE,16);
       ObjectSetInteger(0,"P2edit",OBJPROP_COLOR,clrGray);
       ObjectSetInteger(0,"P2edit",OBJPROP_ALIGN,ALIGN_CENTER);
       ObjectSetInteger(0,"P2edit",OBJPROP_READONLY,false);
    }


//--- set global variables
   period_ma1=int(PBB<1 ? 1 : PBB);
//--- indicator buffers mapping
   SetIndexBuffer(0,BufferMA1,INDICATOR_DATA);
   ArraySetAsSeries(BufferMA1,true);
   IndicatorSetInteger(INDICATOR_DIGITS,Digits());
//--- create handle
   ResetLastError();

   Comment("Должна соответствовать зеленой, а равна= ",PBB);
   
   handle_ma1=iMA(NULL,PERIOD_CURRENT,period_ma1,0,1,PRICE_CLOSE);
   if(handle_ma1==INVALID_HANDLE)
     {
      Print("The iMA(",(string)period_ma1,") object was not created: Error ",GetLastError());
      return INIT_FAILED;
     }
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam)
 {
  if(id==CHARTEVENT_OBJECT_ENDEDIT)
   {
    string obj_name=sparam;
    if(!StringCompare(obj_name,"P2edit"))
     {
     string novPBB=NULL;
     if(ObjectGetString(0,obj_name,OBJPROP_TEXT,0,novPBB))
      {
       if(StringCompare(novPBB,sPBB,false))
        {
         PBB= (int)StringToInteger(novPBB);
         ObjectSetInteger(0,"P2edit",OBJPROP_BGCOLOR,clrBlack);
         ObjectSetInteger(0,"P2edit",OBJPROP_COLOR,clrLime);
        }
       }
Print("B OnChartEvent PBB=",PBB);
      ChartSetSymbolPeriod(0,_Symbol,_Period);
      }
    }
    return;
 }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
//    Пробовал от сюда запускать.
//   sPBB=IntegerToString(PBB);
//   if(ObjectFind(0,"P2edit")!=0)
//    {
//       ObjectCreate(0,"P2edit",OBJ_EDIT,0,0,0);
//       ObjectSetInteger(0,"P2edit",OBJPROP_XDISTANCE,300);
//       ObjectSetInteger(0,"P2edit",OBJPROP_YDISTANCE,1);
//       ObjectSetInteger(0,"P2edit",OBJPROP_XSIZE,70);
//       ObjectSetInteger(0,"P2edit",OBJPROP_YSIZE,40);
//       ObjectSetInteger(0,"P2edit",OBJPROP_SELECTABLE,false);
//       ObjectSetInteger(0,"P2edit",OBJPROP_BGCOLOR,clrBlack);
//       ObjectSetString (0,"P2edit",OBJPROP_TEXT,sPBB);
//       ObjectSetInteger(0,"P2edit",OBJPROP_FONTSIZE,16);
//       ObjectSetInteger(0,"P2edit",OBJPROP_COLOR,clrGray);
//       ObjectSetInteger(0,"P2edit",OBJPROP_ALIGN,ALIGN_CENTER);
//       ObjectSetInteger(0,"P2edit",OBJPROP_READONLY,false);
//    } 
//   
//   if(PBB==0) PBB=(int)StringToInteger(sPBB);
// 
//   if(PBB<5) period_ma1=5; else  period_ma1=PBB;
//   if(PBB>300) period_ma1=300; else  period_ma1=PBB;
   
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

   ArraySetAsSeries(close,true);//--- Установка массивов буферов как таймсерий
//--- Проверка количества доступных баров
   if(rates_total<fmax(period_max,4)) return 0;
//--- Проверка и расчёт количества просчитываемых баров
   int limit=rates_total-prev_calculated;
   if(limit>1)
     {
      limit=rates_total-2;
      ArrayInitialize(BufferMA1,EMPTY_VALUE);
     }

//--- Подготовка данных
   int count=(limit>0 ? rates_total : 1),copied=0;
   copied=CopyBuffer(handle_ma1,0,0,count,BufferMA1);
   if(copied!=count) return 0;

 //Comment("ошибка = ");
 
//--- возвращаемое значение prev_calculated для следующего вызова
   return(rates_total);
  }

//+------------------------------------------------------------------+
//|            deinit                                                |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   int i;
   int obj_total=ObjectsTotal(0,0,-1);
   for(i=obj_total-1;i>=0;i--)
     {
      sn=ObjectName(0,i,0,-1);
      if(ObjectFind(0,sn)==0) 
        {
         if (StringFind(sn,"P2edit",0)==0) ObjectDelete(0,sn);
        }
     }
  
   Comment("");
   return;
  }
 
Zakhar Chumak:

Quando si richiedono i log da un VPS attivo, viene visualizzato l'errore "Failed to get terminal logs

Chi sa quale può essere il problema? Allo stesso tempo gli EAs sul VPS funzionano (aprendo/chiudendo trade), ma non posso caricare i logs.

Sembra che il percorso della cartella temp sia troppo lungo.

I log archiviati vengono prima letti in un file temporaneo (con estensione tmp) nella cartella temporanea del sistema. Si è verificato un errore di formazione del nome del file temporaneo

 

Ho ragione nel supporre che dopo un passaggio, gli agenti dormono e aspettano che gli altri agenti occupati finiscano il loro lavoro?


 

Cosa?

Nessuno può rispondere alla mia domanda?

Cosa c'è di interessante. Con questa varianteOnCalculate funziona. Ma questa variante non funziona.

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
 
Uladzimir Izerski:

Cosa?

Nessuno può rispondere alla mia domanda?

Cosa c'è di interessante. Con questa varianteOnCalculate funziona. Ma questa variante non funziona.

Quando cambi il programma / periodo, PBB ottiene un valore di 10, non importa quale valore hai specificato nel campo di input.

Al momento della reinizializzazione, avviene come se fosse la prima esecuzione.

Ci sono due modi per risolvere il tuo problema

1 - Memorizzare il valore PBB nelle variabili globali e ottenere il periodo da lì.

2 - Quando OnChartEvent si innesca, reinizializza l'indicatore MA e ottiene un nuovo handle...

Motivazione: