Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1869

 
Andrey Sokolov #:

Your pointless trolling is clearly unnecessary here. And the answers that aren't trolling are either wrong, or they're all lies.

(chuckles): Okay. Don't read my answers. Read the other ones.

 
Mihail Matkovskij #:

Why didn't you figure it out yourself? And tell the uservladeimirami how to do it. It's all in the documentation:

https://www.mql5.com/ru/docs/event_handlers/onchartevent

Extend the list of constants to the required ones:

Where to get values for the constants:. Google "C++ key codes" (as I said before). And process it:

Instead of string with Print, insert function which adds value to array depending on key pressed. What is so hard?

Brothers. Thank you very much. Much obliged. Your humble disciple Vladimir. And life is more beautiful. It's easier to breathe.
 
vladeimirami #:
Aleksey, I'm not that stupid. I'm sorry, I can fill the array that way too. I just need to fill it from the keyboard. That's what I'm trying to figure out.

Unfortunately there are all kinds of people on this forum. I don't know your abilities, no offence...

And another question, do you mean input through an input form? Like InputLable or something like that?

The first thing that comes to mind is to create OBJ_EDIT and fill it out at CHARTEVENT_OBJECT_ENDEDIT event in OnChartEvent(). After entering some character, delete the object. That's it, the array is filled.

 
Hello, could you please tell me if I need insurance to withdraw money? Can you tell me all about it?
 
54031252 Махмуд #:
Hello, could you please tell me if I need insurance to withdraw money? Tell me all about it.
You have to earn it first.
 
Alexey Viktorov #:
You have to earn them first.
 

I've been struggling for a couple of hours trying to read data from the database and can't do it.

Here's the code for the tests.

Briefly. A database is created with one table (if the database exists, the table is deleted and re-created). One single row is added to the table.

Then the database is closed and opened again. Simple selection of this record is done, but command returns error that query result is empty.

Checked through IDE - everything is selected by the same query. Can't figure out if this is a bug or a fix?

int OnInit()
{
//---
   int db_handle = DatabaseOpen("test3", DATABASE_OPEN_COMMON | DATABASE_OPEN_CREATE | DATABASE_OPEN_READWRITE);
   if (db_handle != INVALID_HANDLE)
      {
         // Структура таблицы
         if (DatabaseTableExists(db_handle, "ea_dsc"))
            if(!DatabaseExecute(db_handle, "DROP TABLE IF EXISTS ea_dsc"))
               Print("Failed to drop table with code ", GetLastError());

         string t_create = "CREATE TABLE ea_dsc (dsc_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "
                           " ea_symb TEXT NOT NULL, dt_from TEXT NOT NULL, dt_to TEXT, magic_buy INTEGER NOT NULL, "
                           " magic_sell INTEGER NOT NULL, version TEXT NOT NULL, ea_method TEXT NOT NULL)";
         if(!DatabaseExecute(db_handle, t_create))
            Print("Failed to create table with code ", GetLastError());

         string t_add = "INSERT INTO ea_dsc (ea_symb, dt_from, dt_to, magic_buy, magic_sell, version, ea_method)"
                        "VALUES ('EURUSD', 'dt_from', NULL, '123', '456', 'version', 'ea_method')";

         if(!DatabaseExecute(db_handle, t_add))
            Print("Failed to add table data  with code ", GetLastError());

         DatabaseClose(db_handle);
      }

   db_handle = DatabaseOpen("test3", DATABASE_OPEN_COMMON | DATABASE_OPEN_READWRITE);
   if (db_handle != INVALID_HANDLE)
      {
         // Запрос
         string s_quer = "SELECT dsc_id, ea_symb, dt_from, dt_to, magic_buy,"
                         "magic_sell, version, ea_method FROM ea_dsc WHERE ea_symb = ?1";
         int c_request = DatabasePrepare(db_handle, s_quer);
         if (c_request != INVALID_HANDLE)
            {
               if (DatabaseBind(c_request, 0, "EURUSD"))
                  if (DatabaseRead(c_request))
                     {
                        Print("Found!");
                     }
                  else
                     PrintFormat("Error=%d", GetLastError());
               DatabaseFinalize(c_request);
            }
         DatabaseClose(db_handle);
      }

//---
   return(INIT_SUCCEEDED);
}

Result of the work:

 PrintFormat("Error=%d", GetLastError());

Also, full code attached

Files:
testDB_NW.mq5  8 kb
 
Why can't we loop through the input parametres? Why are you punishing us like this?
 
x572intraday #:
Why can't you go through the input-parameters in a loop? Why are you punishing us like this?

What's the point of doing this? Share the secret...

 
How do I install EAs from the Market? I have several terminals.
I press download in the market, the wrong terminal opens by default. I deleted it. Now nothing happens after pressing "download" button
Reason: