double arr[3];
arr[0] = 300.0;
arr[1] = 254.0;
arr[2] = Bid;
Alert("В массиве arr под индексом 0 значение ", arr[0]); // 300Alert("В массиве arr под индексом 1 значение ", arr[1]); // 254
Alert("В массиве arr под индексом 1 значение ", arr[2]); // Bid всё равно меняется на каждом тике, в чём же прикол этих массивов?, я с таким же успехом могу и так сделать
Alert("В массиве arr под индексом 1 значение ", Bid); я думал что массив запоминает цену с первого тика и держит эту инфо на последующих тиках
Yeah, that's what I thought too, when I wrote it on my own. And when I inserted into void OnStart() of the script and got exit outside the array in the log, I came to such a conclusion. In your example, int start() is an old version of the script without #property strict.
And without #property strict this is what it outputs.
#property version"1.00"//#property strictdouble arr[];
//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
arr[0] = 300.0;
arr[1] = 254.0;
arr[2] = Bid;
Alert("В массиве arr под индексом 0 значение ", arr[0]); // 300Alert("В массиве arr под индексом 1 значение ", arr[1]); // 254Alert("В массиве arr под индексом 2 значение ", arr[2]); // Bid
}
//+------------------------------------------------------------------+
I don't know why. (would like to know) why, but in 634 build, as well as in 711, int start() and without #property strict gives 0 values in the whole array if you declare an array without specifying its size...
I don't know why. (would like to know) why, but in 634 build, as well as in 711, in int start() and without #property strict it gives 0 values in the whole array if you declare an array without specifying its size...
#property strict means normal programming level. " I understand what I'm doing. "
Let's say I run the Expert Advisor, then on the first tick using Bid, the Expert Advisor has to remember this price to a certain point, maybe for a day, maybe for an hour.
With what can I memorize it?
There is no trick. If you want to remember the value and not change it for some time, you should specify the condition
If(event) assign some value to a variable or array item.
In this case, the variable or array must be declared as a global variable, or static.
Thank you all!
What's the big deal?
Yeah, that's what I thought too, when I wrote it on my own. And when I inserted into void OnStart() of the script and got exit outside the array in the log, I came to such a conclusion. In your example, int start() is an old version of the script without #property strict.
And without #property strict this is what it outputs.
And it's best not to go beyond.
Here:
0 error(s), 0 warning(s) 1 1
Let's say I run an EA, then on the first tick using Bid, the EA has to remember this price to a certain point, maybe for a day, maybe for an hour.
What can be used to remember this price?
And in your example int start()
I don't know why. (would like to know) why, but in 634 build, as well as in 711, int start() and without #property strict gives 0 values in the whole array if you declare an array without specifying its size...
And it's best not to go beyond.
Here:
0 error(s), 0 warning(s) 1 1
I don't know why. (would like to know) why, but in 634 build, as well as in 711, in int start() and without #property strict it gives 0 values in the whole array if you declare an array without specifying its size...
Let's say I run the Expert Advisor, then on the first tick using Bid, the Expert Advisor has to remember this price to a certain point, maybe for a day, maybe for an hour.
With what can I memorize it?
There is no trick. If you want to remember the value and not change it for some time, you should specify the condition
If(event) assign some value to a variable or array item.
In this case, the variable or array must be declared as a global variable, or static.