MQL5 不允许动态数组存储值

MQL5 does not allowing the Dynamic Array to store value

我正在尝试使用 MQL 5 数组的存储。当我不使用任何 ArrayResize() 时,出现错误:

double d [];
d[0] = 1;
for (int i = 0; i< ArraySize(d); i++)
   {
   Print(d[i]);

错误如下:

2018.03.26 13:17:25.379 2018.02.02 00:00:00   array out of range in 'testing.mq5' (69,2)

而当我使用 ArrayResize() 时,我得到了输出。

double d [];
ArrayResize(d,2);
d[0] = 1;
for (int i = 0; i< ArraySize(d); i++)
   {
   Print(d[i]);
   }

输出:1

成功了。但是,如果我尝试添加超出数组大小的数组元素,则会出现 out of range 错误。

我要实现的是数组必须在大小方面保持动态。
假设我给定的大小是 2 并且在我的程序中需要添加 3 处的数组元素然后数组必须接受它。

我不能使用 ArrayResize(),因为它会清除其他值,这是我不希望发生的。
请给我一个折衷的建议,这样我就可以在数组中输入任意数量的值,而不管它的大小。

#include <Arrays\ArrayObj.mqh> 适合存储任何 class 的对象,ArrayInt 用于整数列表,ArrayDouble 用于双精度和浮点数列表。随时随地添加所需的数量,您永远不必调整大小或从数组中捕获索引。

CArrayInt *integers;
OnInit(){integers=new CArrayInt();}
OnDeinit(int reason){delete(integers);}
OnTick(){
   integers.Add(0);integers.Add(1);integers.Add(2);
   int firstElem=integers.At(0); firstElem=integers[0];
   int lastElem=integers.At(integers.Total()-1);
   int totalElementsInTheList=integers.Total();
   integers.Delete(2); // delete element with index 2. deleting element that match with the object is not supported in basic API
}