Errors, bugs, questions - page 1026

 
avoitenko:

Bild 842/64 bit. When declaring a canva:

an error appears:

Unresolved static variable 'CCanvas::m_default_colors'

Am I the only one who has this bug?

Everyone seems to have one.

MetaDriver:

Try initializing explicitly:

Although this seems to be a bug, according to the documentation. https://www.mql5.com/ru/docs/basis/oop/staticmembers

.....Static class members do not need to be initialized explicitly globally, they will be initialized automatically when the program is loaded. ......

No changes were made in the class code, and the error wasn't there before.

//+------------------------------------------------------------------+
//| Class CCanvas                                                    |
//| Usage: class for working with a dynamic resource                 |
//+------------------------------------------------------------------+
class CCanvas
  {
private:
   uint              m_style;                  // line style template
   uint              m_style_idx;              // variable - current index of bit in line style template
   static uint       m_default_colors[9];      // default colors

protected:
 
tol64:

It seems to be the same for everyone.

No changes have been made to the class code, and there was no such error before.

This is how it compiles:

#include <Canvas\Canvas.mqh>

static uint  CCanvas::m_default_colors[9] = 
  {0x444444, 0x444444, 0x444444, 0x444444, 0x444444, 0x444444, 0x444444, 0x444444, 0x444444 };

CCanvas bmp;
 

Hello! Help me solve a problem.

I've started to transfer my developments from mt4 to mt5. For the first time I have faced a problem with loading DLL. It compiles well but when I start the indicator. Error "cannot open dll". No more error messages. I've read all the articles and placed it all the way: Library in directory ...\Terminals\MetaTrader 5\MQL5\Libraries

//+------------------------------------------------------------------+
//|                                                   Test MySQL.mq5 |
//|                                                               me |
//|                                                               no |
//+------------------------------------------------------------------+
#property copyright "me"
#property link      "no"
#property version   "1.00"
#property indicator_separate_window

#import "libmysql.dll"
int mysql_init(int db);
int mysql_errno(int TMYSQL);
int mysql_real_connect( int TMYSQL,string host,string user,string password, string DB,int port,int socket,int clientflag);
int mysql_real_query(int TMSQL,string query,int length);
void mysql_close(int TMSQL);
#import 


int i = 0;
int mysql;
string query;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   Print(GetLastError());
   mysql = mysql_init(mysql);
   if (mysql!=0) Print("allocated");
   string host="localhost";
   string user="root";
   string password="1111";
   string DB="fxdb";
   int clientflag =0;
   int port = 3306;
   string socket="";
   int res = mysql_real_connect(mysql,host,user,password,DB,port,socket,clientflag);
   int err = GetLastError();
   if (res == mysql) Print("connected");
   else Print("error = ",mysql," ",mysql_errno(mysql)," ");
   //До этой строки все правильно работает.
   i++;   
   StringConcatenate(query, "INSERT INTO ",
                                    //CharToStr(039),
                                    "test", 
                                    //CharToStr(039), 
                                    " (", 
                                    //CharToStr(039), 
                                    "ID", 
                                    //CharToStr(039), 
                                    ", ",
                                    //CharToStr(039), 
                                    "text",
                                    //CharToStr(039), 
                                    ") VALUES (", 
                                    CharToString(039),
                                    DoubleToString(i,0),
                                    CharToString(039),
                                    ", ",
                                    CharToString(039), 
                                    "testtext",
                                    CharToString(039),
                                    ")"
                                    );
   Print("i = ", i);                                    
   Print(query);
   
 
   int length = StringLen(query);
   mysql_real_query(mysql,query,length);
   int myerr=mysql_errno(mysql);
   if (myerr>0)Print("error=",myerr); else Print(i, "good"); 
   return(0);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| 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[])
  {
//---
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
  {
//---
   
  }
//+------------------------------------------------------------------+
 
MetaDriver:

this is how it compiles:

Yes, but what's all this for?

In the class constructor, this array is also initialized with new values, overwriting the ones you suggested.

Anyway, like this:

#include <Canvas\Canvas.mqh>
uint CCanvas::m_default_colors[9]={0};
CCanvas bmp;
Compiles without errors. And let developers tell the sense of entering m_default_colors in the help.
 
avoitenko:

Yes, but what for?

In the class constructor this array is also initialized with new values, wiping out the ones you suggest.

Anyway, that's it:

Compiles without errors. And let developers can tell the meaning of m_default_colors in the help.

I told you it was a bug, so go to servicedesk with it.

Although, judging by the documentation, this is a bug. https://www.mql5.com/ru/docs/basis/oop/staticmembers

.....Static class members don't need to be initialized explicitly globally, they will be initialized automatically at program startup. ......

The rest of my suggestions are devoted to running the program in the presence of this bug. The intermediate initialization performs this function, so you can work without waiting for the bug fixing.

This is a typical scheme of my actions in such situations.

 

MetaDriver:

Intermediate initialization performs this function, so you can work without waiting for the bug to be fixed.

This is a typical scheme of my actions in such situations.

And my actions too. Thank you.

And Service Desk reads and re-reads this thread, so they will fix it.

 

Al_key:

Error "cannot open dll". No further messages.

The terminal does not find your DLL.

The path to copying can be seen through MetaEditor, taking the properties of the MQL5 folder in the navigator, the path is written in the "Location" field. And then copy your DLL in the folder [path]\MQL5\Libraries\.

 
Vladon:

Dear administration, something is wrong with the metaQuotes-DEMO server

Says in the log : 2013.08.01 11:58:35 Network '1449777': connection to MetaQuotes-Demo lost

The account has been banned by the trading server for excessive trading activity. The trading platform is protecting itself and disabling those accounts that mindlessly send trade requests on every tick.
Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура торгового запроса
Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура торгового запроса
  • www.mql5.com
Стандартные константы, перечисления и структуры / Структуры данных / Структура торгового запроса - Документация по MQL5
 
avoitenko:

The terminal does not find your DLL.

You can see the copying path in MetaEditor, taking the properties of the MQL5 folder in the navigator, the path is written in the location column. And then copy your DLL in the folder [path]\MQL5\Libraries\

Yes, but as I wrote, I already copied libmysql [path]\MQL5\Libraries\
 
Al_key:
Yeah, but like I wrote, I already copied libmysql [path]\MQL5\Libraries\.

I go to the meta editor and open the properties of MQL5 folder, but there is some path that is not associated with my terminal folder. Will it always be like this from now on, or can I adjust it? By the way, I did so and copied everything. Still the same error.


Ok, new edit to the post. Everything seems to be working, a bunch of other errors, I'll look into it now. And still how to make a standard folder for indices and EAs and other data. Will the /portable switch help?

Reason: