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

 
vladeimirami to fill an array from the keyboard?

Google "C++ key codes" and process presses in OnChartEvent eventCHARTEVENT_KEYDOWN according to key codes.

 
Mihail Matkovskij #:

Google "C++ key codes" and process presses in OnChartEvent eventCHARTEVENT_KEYDOWN according to key codes.

If you can, suggest a small example.

 
Mihail Matkovskij #:

Unfortunately, I don't have the time to write the code for you right now. Maybe someone with a lot of free time could do it... Or you can find examples on the Internet...

"Do this - I won't tell you how"

 
makssub #:
It would probably work. Can you give me an example of how to implement it on a couple of orders?

https://www.mql5.com/ru/code/34210

I don't know how feng shui the script is, but it works flawlessly. You can take the closing function from it.

Close positions Delete orders Delete trade objects
Close positions Delete orders Delete trade objects
  • www.mql5.com
Закрывает позиции по символу, удаляет ордера по символу, удаляет на окне объекты созданные при торговых операциях (с # в имени).
 
Andrey Sokolov #:

"Do this - I won't tell you how"

Andrey Sokolov, thank you for your feedback. Thanks a lot for that too. At least I got some direction in which to dig. The rest will come with a head on my shoulders.
 
vladeimirami fill an array from the keyboard?

How do you do it, and what exactly is not working?

 
Andrey Sokolov #:

How do you do it, and what exactly is not working?

I'm still learning MQL5 programming. I am a beginner. I am self-taught. I am trying to solve some problems. I'm trying to solve them. So, I've thought that there should be a function for entering an array from the keyboard, and I haven't entered the array by one digit at a time. Well, the problem is from the problem book C++.

143. Write a program that inputs from the keyboard a one-dimensional array of 5 integers.

array of 5 integers, then prints the number of

of non-zero elements. Before each element is entered, a prompt

and then displays a tooltip with the number of the element.

Enter an array of integers.

After you have entered each number, press <Enter>.

а[1] -> 12

а[2] -> 0

а[3] -> 3

а[4] -> -1

а[5] -> 0


There are 3 non-zero elements in the array

 
vladeimirami #:

I'm still learning MQL5 programming. I am a beginner. Self-taught. I am trying to solve problems. I thought that there should be a function for entering an array by one digit. Well, the problem is from the problem book C++.

143. Write a program that inputs from the keyboard a one-dimensional array of 5 integers.

array of 5 integers, then prints the number of

of non-zero elements. Before each element is entered, a prompt

and then displays a tooltip with the number of the element.

Enter an array of integers.

After you have entered each number, press <Enter>.

а[1] -> 12

а[2] -> 0

а[3] -> 3

а[4] -> -1

а[5] -> 0


There are 3 non-zero elements in the array

int a[] = {12, 0, 3, -1, 0};

But, this turns the array into a dynamic one, so it cannot be resized using the ArrayResize() function.

 
Alexey Viktorov #:

But, this makes the array dynamic, and you can't change its size with ArrayResize().

Alexey, I'm not that stupid. I'm sorry, I can fill an array that way too. I just need to fill it in from the keyboard. That's what I'm trying to figure out.
 
vladeimirami #:

Well, the problem is from the C++ problem book.

In mql you can also fill the array from the keyboard, but you don't need to)))

Reason: