Errors, bugs, questions - page 1027

 
Rosh:
The account was banned by the trading server for excessive trading activity. The trading platform protects itself and disables those accounts that mindlessly send trade requests on every tick.

Trade queries understandably, there was a modification there. That's how the strategy was designed. I don't know how the Expert Advisor will work now, but I disabled the modification on every tick. I am asking you a big favor - turn the account back on. it's 3 months old, good stats.

 

Al_key:

Will the /portable switch help?

Either permanently disable /portable or disable UAC and run the terminal without /portable after a reboot.

 
avoitenko:

Bild 842/64 bit. When declaring canva:

An error appears:

unresolved static variable 'CCanvas::m_default_colors'

Am I the only one with this problem?
The requirements to static variables have changed.

The error occurred because you use an object with static variables at the global level and in this case the compiler requires a static array to be placed explicitly.
This is necessary for the programmer to explicitly specify the order of initialization of static class/structure members.

The problem here is that the static array 'CCanvas::m_default_colors' can be used in the CCanvas constructor for reading and then if it is placed and initialized by the programmer after the CCanvas class object is placed, its values in the CCanvas::CCanvas constructor will not be what is expected. Therefore, the compiler is checking to ensure that the static class/structure members are placed and initialized before using the class/structure object.

We'll think it over, maybe we'll change something.

Документация по MQL5: Основы языка / Переменные / Создание и уничтожение объектов
Документация по MQL5: Основы языка / Переменные / Создание и уничтожение объектов
  • www.mql5.com
Основы языка / Переменные / Создание и уничтожение объектов - Документация по MQL5
 

Continuing to switch to mcuel 5. In mt4 this code was working fine. Now I have a problem connecting to mkuell.

#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;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
   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)," ");
   
 
   
   //mysql_real_query(mysql,query,length);
   //int myerr=mysql_errno(mysql);
   //if (myerr>0)Print("error=",myerr); else Print(i, "good"); 

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
      mysql_close(mysql);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---
   
  }
//+------------------------------------------------------------------+

It gives an error:

2013.08.03 12:41:41 testMySql (AUDCAD,H1) error=313111904 2005

There's a warning about a socket variable type mismatch, putting NULL instead of a variable doesn't help. I also heard that МТ5 transfers string to DLL in a special way. Is it like that? Please advise how to handle it.

 
mql5:
The requirements for placing static variables have changed.
Therefore, the compiler checks that static class/structure members are placed and initialised before the class/structure object is used.
Thank you. It all makes sense now.
 
Al_key:
I've also heard that MT5 sends strings to the DLL in a special way. Is it that kind of thing? How to cope with it, please advise.
There is a live example of connecting to MySQL database in this article.
 
Another question: Installed MT5 standard for the first time, demo account is metaquotes. I see only 4 pairs of majors, no USDCAD. After a while, a lot of different pairs were added, including CFD and Knaadec. Then I have switched to /portable. Of course, minimum pairs are again set by default, but this time other pairs are not loaded for some reason and it is very important to have USDCAD demo in the fifth MT.
 

I memorise the TF, switch to M1, go back to the current one.

Problem: I cannot remember to assign the current TF

int current_period_tf;
   string n;
   if(_Period==PERIOD_M1)  {current_period_tf=0x00000001;};
   if(_Period==PERIOD_M2)  {current_period_tf=0x00000002;};
   if(_Period==PERIOD_M3)  {current_period_tf=0x00000004;};
   if(_Period==PERIOD_M4)  {current_period_tf=0x00000008;};
   if(_Period==PERIOD_M5)  {current_period_tf=0x00000010;};
   if(_Period==PERIOD_M6)  {current_period_tf=0x00000020;};
   if(_Period==PERIOD_M10) {current_period_tf=0x00000040;};
   if(_Period==PERIOD_M12) {current_period_tf=0x00000080;};
   if(_Period==PERIOD_M15) {current_period_tf=0x00000100;};
   if(_Period==PERIOD_M20) {current_period_tf=0x00000200;};
   if(_Period==PERIOD_M30) {current_period_tf=0x00000400;};
   if(_Period==PERIOD_H1)  {current_period_tf=0x00000800;};
   if(_Period==PERIOD_H2)  {current_period_tf=0x00001000;};
   if(_Period==PERIOD_H3)  {current_period_tf=0x00002000;};
   if(_Period==PERIOD_H4)  {current_period_tf=0x00004000;};
   if(_Period==PERIOD_H6)  {current_period_tf=0x00008000;};
   if(_Period==PERIOD_H8)  {current_period_tf=0x00010000;};
   if(_Period==PERIOD_H12) {current_period_tf=0x00020000;};
   if(_Period==PERIOD_D1)  {current_period_tf=0x00040000;};
   if(_Period==PERIOD_W1)  {current_period_tf=0x00080000;};
   if(_Period==PERIOD_MN1) {current_period_tf=0x00100000;};
   ChartSetSymbolPeriod(ChartID(),_Symbol,PERIOD_M1);
   ObjectSetInteger(0,n,OBJPROP_TIMEFRAMES,current_period_tf);
   ChartSetSymbolPeriod(ChartID(),_Symbol,current_period_tf);

I can switch to M1

ChartSetSymbolPeriod(ChartID(),_Symbol,PERIOD_M1);

For an object

ObjectSetInteger(0,n,OBJPROP_TIMEFRAMES,current_period_tf);

it works. For a chart

ChartSetSymbolPeriod(ChartID(),_Symbol,current_period_tf);

the compiler gives out

'current_period_tf' - can't convert enum

What's the mystery?

I tried upd converting via string and changing types, but it doesn't work.

 
Al_key:
Another question: Installed MT5 standard for the first time, demo account is metaquotes. I see only 4 pairs of majors, no USDCAD. After a while, a lot of different pairs were added, including CFD and Knaadec. Then I have switched to /portable. Of course, again minimum pairs are by default, but this time for some reason other pairs are not loaded and I want to have USDCAD demo in MT5 very much.
Save the configured profile by default File - Profiles - Default
 
Silent:

...

What's the mystery?

I tried to convert via string and change types, but it doesn't work.

int current_period_tf;
ENUM_TIMEFRAMES current_period_tf;
Reason: