Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 264

 
You can't do an ArrayResize on every tick!!!!!!! Otherwise you will get bogged down in calculations................... And no multi-core processor will save you........
 
The article "ShowCandleSize" published on 11.11.2013 07:54 is not displaying correctly and cannot be edited for some unknown reason.
Contacted support on November 15 with this issue at noreply@metaquotes.net, but did not receive a reply.
Can you please tell me the correct address for such a question.
Regards.
--
Vladislav Shurkin,
On November 20, 2013.
 
artmedia70:
All results of closed trades can be viewed in the account history. By software. Is it necessary to cram an array with them all the time? There may be a lot of them. It is better to limit the necessary depth of history and fill the array, if you really can't live without it.

Thanks for the clarification!

"All the results of closed trades can be viewed in the account history. By software." - How?
 
VladislavVG:


At program termination, dynamically allocated memory must be freed to avoid memory leaks. I don't know if the developers of MKL follow this



They do, that's why arrays are made static, to collect them in one place and free later. ArrayResize(a,0) at the end of the program doesn't make much sense, if only for self-reassurance.
 
Leo59:
Thank you for your clarification!

"All results of closed trades can be viewed in the account history. Programmatically." - How?

OrderSelect(ticket,SELECT_BY_TICKET,MODE_HISTORY)

or

OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)

 
alsu:

OrderSelect(ticket,SELECT_BY_TICKET,MODE_HISTORY)

or

OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)




Thank you!


What is good about the Kovalev's tutorial? I think it's good because you learn how to solve simple problems using simple examples of program code.

Actually, I started to learn programming from Vladislav Goshkov's indicator code. I drew that indicator with De-Mark's support and resistance rays. There were the following lines:
ObjectMove(buff_str, 1, UpBT[0], UpP[0]);
ObjectMove(buff_str, 0, UpBT[1], UpP[1]);
I placed it. Looked at it in the tester and saw how it worked. It draws rays by fractals but it looks into past instead of future... )))). I started to ask questions and it worked out! Respect to Vladislav!!!!
I came across the Kovalev textbook later. I wish more questions were answered in this format.

And one more thing.
"You want to write your own expert and you don't know where to start? With the appearance of Rosh's articles on the Alpari website, the first steps in creating an expert can be made easy and painless.
Rosh explains the steps every EA writer goes through in a simple and accessible way. Many of the nuances of programming, the knowledge of which comes with long experience, are now available to everyone.
Step by step, starting from the very basics, you will learn the intricacies of Forex programming."

Maybe you know at which link this article overview can be read?
 
VladislavVG:


Because it's not an array, to be precise. If you want more details - see descriptions of C. I'm referring to it, because the developers from the beginning said that on everything that is not clear or incompletely presented - see standard C.

When you declare variable double buffer[]; you allocate memory for one variable, which in C terms is called "pointer", has integer type and stores address of memory cell from which the array will start. If you check the dimensionality of the variable in MCL, you get the value 0. This means that the array itself isn't allocated memory and when you try to assign a value, there's nowhere to write it: MKL doesn't have address arithmetic and pointers can't be handled. In C you can write it, but with "unallocated" memory it usually leads to a system crash. When you apply AreiResize(array,N), (N>0), this allocates memory for the array (at least one element) and creates space for writing values. Then, when checked, the array's dimension will be different from 0.

The concept of static array in terms of C has several meanings:

1. a static array (as well as a static variable/type) are such variables/arrays whose dimensionality is known at the compilation stage (precompilation for MKL4) . For example, when double buff[10000]; is described, the compiler is told the size of the variable and can immediately allocate memory. In contrast to this concept, there is the concept of a "dynamic array", that is, such an array whose size is unknown at compile time and becomes known only at run-time; these are all arrays of variable size. When accessing such arrays, memory must be allocated beforehand. Memory is allocated outside the static program memory.

In C/C++, if an array is described in a block, its visibility is limited by the block - be it a static or a dynamic array. Errors in programs such as "memory leaks" are associated with dynamic arrays defined locally, i.e. when a memory pointer is destroyed because it leaves the scope, but the memory allocated to it remains occupied.

2 The concept of "static" array as a variable described with static modifier - such variables are not destroyed when leaving the scope of the block - they are located in a separate memory area - hence the values in them are preserved. The risk of memory leaks is reduced. An array declared as dynamic in the sense of p.1 (i.e. the array size is not known at the compilation stage), can also be static in the sense of p.2, that is, declared with the modifier "static".

When terminating programs, dynamically allocated memory must be released to avoid memory leaks. I don't know if developers of MKL follow this, but in my programs I always free memory - habit from C - ArreyResize(array,0);

In MKL all arrays are static in the sense of point 2.

Now regarding your question: "Whycan't a static array double buffer[]; be assigned values ?". Because no memory is allocated for it (in fact, it's a dynamic array with a static modifier). Before assigning values, memory should be allocated, i.e. ArrayResize with size greater than 0 should be applied to this array. For arrays, you need to control the memory overrun (outside the array).

SZ I hope I've made myself clear. I tried to make it as simple as possible.

"You can't lose your craftsmanship"!
Thank you!!!!!!!!
 
VladislavVG:

Because it's not an array, to be precise. If you want more details, see the descriptions of the C language. I'm referring to it because the developers said from the beginning that for anything that is not clear or incomplete, see the C standard.
........

Thank you very much. Woke up with my eyes stuck but so pleased to have read it all, thanks again.
 
Leo59:


Do you, perhaps, know of a link where this article review can be read?


https://www.mql5.com/ru/articles/mt4


Ah no, it doesn't open anymore(((.

 
there is this link at the bottom of the article - watch out.
Reason: