Please . . .

I figured it out!!!
I was having the same problem at you- I was like, how about that?! I've found a glitch in the matrix! LOL
So case in point:
Say you have the variables:
extern string Badger="I get what I want."; string CopyOfBadger;
Then somewhere in the code:
CopyOfBadger=Badger;
Whenever you change the extern string Badger, it then assigns: string CopyOfBadger - the same thing. As if it were, like you said, an alias instead of just a copy of the text itself.
I am no programmer, and it is possible that this is by design. I wouldn't assume so, but I was glad I ran into this post so I knew I wasn't alone. But none-the-less I NEEDED for this not to happen and a solution around it.
The reason for this is that I needed to be able to compare strings if the user changed a the variable in the EA properties:
If(Badger!=CopyOfBadger) { Print("You changed the string cool guy."); CopyOfBadger=Badger; }
SO, I came up with a very simple solution:
CopyOfBadger=StringSubstr(Badger,0,StringLen(Badger));
This in turn copies the text instead of assigning an alias. Hope this helps you and someone in the future. Sorry if this is common sense, but obviously people run into this. :)
- I'd count this as a bug in the terminal code.
CopyOfBadger=StringConcatenate(Badger);

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, can anyone give me an advice for a very special SW-problem with external input parameters:
We are runnung an EA with external input parameters at the normal input-parameter menue..
This parameters can be changed at any time . The parameter changes are read by the EA and the EA responds to these changes.
This codefragment shows a strange problem with strings.
Normally, changes at the parameter-Input results in a deinit() and a Re-Init() with the Reason "Parameter changed"
This is done by the Init() Function.
Changes are recognised by comparing the old copy with the he new value taken from the external inputs.
This does not work with strings.
At the beginning of the init() function, the Copy of a string has the new value of the external input, but the assignment was never done in the program.
So maybe, there is a stackproblem or any hidden recursion or a threading problem.
Please let me know, if this programming strategy is not legal.
For me, it seems, that under some conditions, a stringcopy doesnt move the content, but the address of the stringvaraiable,in a manner that is used in C++ for references to objects.
Using the construct strA =StringConcatenate(extInputstringB,"") works well.
So I have moved the codefragment to the codesection for better reading.
Thank you, your Rudi Ratlos