Discussion of article "Applying network functions, or MySQL without DLL: Part II - Program for monitoring changes in signal properties"
This is a cool and practical application!
It's a pity that MQ don't collect (or give access to?) this data for all signals. It would be a useful database.
A cool and practical application turned out in the end!
It's a pity that MQ don't collect (or give access to?) this data for all signals. It would be a useful database.
What do you mean "don't collect" if the database is generated from their API? Not only do they not collect it, they give it away.
I'm more "pleased" that now you can do without dependence on MySQL and adapt the project to the built-in SQLite.

- www.mql5.com
What do you mean "don't collect" if the database is generated from their API? Not only do they not collect, they give it away.
They don't collect history. They only give out the current state.
And it is interesting to see, for example, the change of position in the rating or the number of subscribers over time.
Related article: SQLite: native work with SQL databases in MQL5
Now you can work with databases and operate large volumes natively in MQL5 dozens of times faster than with external SQL servers. This is achieved through seamless integration of the fast SQLite engine into the MQL5 subsystem and complete elimination of network operations.
New article MySQL without applying network functions or using DLLs: part II - Programs to monitor changes in signal properties has been published:.
Author: Serhii Shevchuk
That's all well and good, but there's one BUT!
When testing in Testor via socket is switched off, as I understand, and data will not be reset. And it is very important to use data when testing products.

- www.mql5.com
I implemented it in my EA without any problems, it compiles perfectly, but sometimes an error occurs and the EA closes.
array out of range in 'MySQLTransaction.mqh' (365,36)
//+------------------------------------------------------------------+
//| Parse received data |
//+------------------------------------------------------------------+
ENUM_TRANSACTION_STATE CMySQLTransaction::Incoming(uchar &data[], uint len)
{
int ptr=0; // index of the current byte in the 'data' buffer
ENUM_TRANSACTION_STATE result=MYSQL_TRANSACTION_IN_PROGRESS; // result of handling accepted data
while(len>0)
{
if(m_packet.total_length==0)
{
//--- If the amount of data in the packet is unknown
while(m_rcv_len<4 && len>0)
{
m_hdr[m_rcv_len] = data[ptr];
m_rcv_len++;
ptr++;
len--;
}
//--- Received the amount of data in the packet
if(m_rcv_len==4)
{
//--- Reset error codes etc.
m_packet.Reset();
m_packet.total_length = reader.TotalLength(m_hdr);
m_packet.number = m_hdr[3];
//--- Length received, reset the counter of length bytes
m_rcv_len = 0;
//--- Highlight the buffer of a specified size
if(ArrayResize(m_packet.data,m_packet.total_length)!=m_packet.total_length)
return MYSQL_TRANSACTION_ERROR; // internal error
}
else // if the amount of data is still not accepted
return MYSQL_TRANSACTION_IN_PROGRESS;
}
//--- Collect packet data
while(len>0 && m_rcv_len<m_packet.total_length)
{
m_packet.data[m_rcv_len] = data[ptr];
m_rcv_len++;
ptr++;
len--;
}
//--- Make sure the package has been collected already
if(m_rcv_len<m_packet.total_length)
return MYSQL_TRANSACTION_IN_PROGRESS;
//--- Handle received MySQL packet
m_packet.index = 0;
m_packet.type = MYSQL_PACKET_NONE;
if(m_packet.total_length>0)
{
if(m_packet.data[0]==0)
{
//--- Ok packet
m_packet.type = MYSQL_PACKET_OK;
m_packet.index++;
m_packet.affected_rows = reader.GetDataFieldLen(&m_packet);
m_packet.last_id = reader.GetDataFieldLen(&m_packet);
m_packet.server_status = reader.Uint16(&m_packet);
m_packet.warnings = reader.Uint16(&m_packet);
if(m_packet.index<m_packet.total_length)
m_packet.message = reader.DfString(&m_packet);
if((result = PacketOkHandler(&m_packet))==MYSQL_TRANSACTION_ERROR)
break;
}
else
if(m_packet.data[0]==0xfe)
{
//--- End Of File packet
m_packet.type = MYSQL_PACKET_EOF;
m_packet.index++;
m_packet.warnings = reader.Uint16(&m_packet);
m_packet.server_status = reader.Uint16(&m_packet);
if((result = PacketEOFHandler(&m_packet))==MYSQL_TRANSACTION_ERROR)
break;
}
else
if(m_packet.data[0]==0xff)
{
//--- Error packet
m_packet.type = MYSQL_PACKET_ERROR;
m_packet.index++;
m_packet.error.code = reader.Uint16(&m_packet);
if((result = PacketErrorHandler(&m_packet))==MYSQL_TRANSACTION_ERROR)
break;
}
else
if(!m_packet.number && m_packet.data[0]==0x0a)
{
//--- Greeting packet
m_packet.type = MYSQL_PACKET_GREETING;
if((result = PacketGreetingHandler(&m_packet))==MYSQL_TRANSACTION_ERROR)
break;
}
else
{
//--- Data packet
m_packet.type = MYSQL_PACKET_DATA;
if((result = PacketDataHandler(&m_packet))==MYSQL_TRANSACTION_ERROR)
break;
}
}
m_rcv_len = 0;
m_packet.total_length = 0;
}
return result;
}
This error happens even when Algotrading is disabled.
I implemented it in my EA without any problems, it compiles perfectly, but sometimes an error occurs and the EA closes.
array out of range in 'MySQLTransaction.mqh' (365,36)
This error happens even when Algotrading is disabled.
I am just trying to use the MySQL part of the system, but I keep getting a "No database selected" error - even if I issue a "use `mytable`" command.
Do you have any thoughts on why that is happening?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article Applying network functions, or MySQL without DLL: Part II - Program for monitoring changes in signal properties has been published:
In the previous part, we considered the implementation of the MySQL connector. In this article, we will consider its application by implementing the service for collecting signal properties and the program for viewing their changes over time. The implemented example has practical sense if users need to observe changes in properties that are not displayed on the signal's web page.
The application in action is displayed in Fig. 6.
Fig. 6. The program for viewing signal property dynamics in action
Author: Serhii Shevchuk