Is there a way to for loop through a CArrayObj?

 

I'm curious if there is a way to for-loop through a CArrayObj or CList?

Also, is there a way to get the number of objects within a CArrayObj or CList?

I've thought of work arounds like having a counter that I increments every time I add to the list, but just curious if there's a standard way.

 

Why don't read the docs? for CArrayObj:

https://www.mql5.com/en/docs/standardlibrary/datastructures/carray/carraytotal

For list:

https://www.mql5.com/en/docs/standardlibrary/datastructures/clist/clisttotal https://www.mql5.com/en/docs/standardlibrary/datastructures/clist/clistgetnodeatindex

or

https://www.mql5.com/en/docs/standardlibrary/datastructures/clist/clistgetfirstnode https://www.mql5.com/en/docs/standardlibrary/datastructures/clist/clistgetnextnode

Documentation on MQL5: Standard Library / Data Collections / CArray / Total
Documentation on MQL5: Standard Library / Data Collections / CArray / Total
  • www.mql5.com
Standard Library / Data Collections / CArray / Total - Reference on algorithmic/automated trading language for MetaTrader 5
 
Drew Clayman:

I'm curious if there is a way to for-loop through a CArrayObj or CList?

You may find this of interest:

https://www.mql5.com/en/forum/304122#comment_10707687

Reason: