If those objects do not contain large arrays, then they take up very little RAM and there is no point in bothering with it. In In this case, write in a way that is convenient for you.
You can create an instance of a class in a script and deliberately not delete it to find out how much memory it takes up (as a lazy way).
#property strict class Foo { long a; long b; long c; double d[50]; }; void OnStart() { Foo* foo = new Foo(); }
As for performance, accessing an object through a dynamic pointer will always be a little slower, since the terminal will check the validity of the pointer every time the object is accessed.
From this point of view, objects with an automatic pointer are a little better.
But the overhead associated with the dynamic pointer can also be neglected, since it still works quite fast (+1-2 nanoseconds for each pointer check by the terminal, if I'm not mistaken).

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
My EA has the potential of having a large number of classes and I don’t want to use their functionality if they have not been selected from the user inputs. So to reduce used resources I thought of instantiating a class only if needed.
So, my question is, do you think that the following coding will use less resources?
Than this