About Array Memory

 

hello guys.

I got a situation that when my EA open new order, Order Open Price will sort in Array. However, when order closed, that Open Price still in Array(e.g BuyOrderOpenPrice[0]).

I tried ArrayRemove, ArrayFill, ArrayResize etc, but not work. Does anyone know how to clear array memory after order close? Thanks.

 
Wai Shing Ng :

hello guys.

I got a situation that when my EA open new order, Order Open Price will sort in Array. However, when order closed, that Open Price still in Array(e.g BuyOrderOpenPrice[0]).

I tried ArrayRemove, ArrayFill, ArrayResize etc, but not work. Does anyone know how to clear array memory after order close? Thanks.

To help you, you must show your MQL5 code.

 
Wai Shing Ng:

hello guys.

I got a situation that when my EA open new order, Order Open Price will sort in Array. However, when order closed, that Open Price still in Array(e.g BuyOrderOpenPrice[0]).

I tried ArrayRemove, ArrayFill, ArrayResize etc, but not work. Does anyone know how to clear array memory after order close? Thanks.

Use https://www.mql5.com/en/docs/standardlibrary/datastructures/clist instead of raw arrays.
Documentation on MQL5: Standard Library / Data Collections / CList
Documentation on MQL5: Standard Library / Data Collections / CList
  • www.mql5.com
CList - Data Collections - Standard Library - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5