Store state of EA only accessible to Symbol

 

I want to run an EA on multiple Symbols simultaneously. A given Symbol will never have more than 1 EA running. The EA should act independently for each Symbol, i.e. not share state between Symbols.

For each Symbol, I need to store some state to dynamically set T/P based on some past decisions of the EA. For each Symbol, this state should not be accessible to instances of the EA running on other symbols.

I've tried global variables but these seem to be shared across all Symbols if an EA is running on multiple Symbols simultaneously. How can I store a state in a variable that is only accessible by the Symbol?

 
metatrader00001:

I want to run an EA on multiple Symbols simultaneously. A given Symbol will never have more than 1 EA running. The EA should act independently for each Symbol, i.e. not share state between Symbols.

For each Symbol, I need to store some state to dynamically set T/P based on some past decisions of the EA. For each Symbol, this state should not be accessible to instances of the EA running on other symbols.

I've tried global variables but these seem to be shared across all Symbols if an EA is running on multiple Symbols simultaneously. How can I store a state in a variable that is only accessible by the Symbol?

Without any code we will stay on the realm of "guessing". Terminal Global Variables work pretty well.

What do you mean by ""Global Variables"?

 
Please ignore my post, I found out after some testing that the issue was somewhere else. Variables declared outside of functions are not shared between instances of the same EA attached to multiple symbols.