Yes that seems to be what happens. So when you have trades open, the Equity is constantly changing....
So it's not perfect and it's still pretty ugly, but yes your code does seem to work...
Well sort of, a bool can be used for the value, but the name is a string. a number, a bool, string is a value that can be used as a name, or a value. I think you are making your life hard by using terminal variables...
At a guess that int value is actually an enum value 0-the number of inputs you have in the indicator, if you create an enum in your EA you can use this to select a value.