The string type variable does not retain its string value in the Tester. I encountered this when I coded time filter string type input variables. My solution was to break down the hours and minutes, separately, into int type variables for processing.
Use the numerical values (StringToInteger - Conversion Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5).

- www.mql5.com
You're both right, and these are two common issues developers run into with MetaEditor and the Strategy Tester.
First, regarding the enum display in the debugger: the code is correct, and the value UP is properly assigned. The issue with the debugger showing strange values like 65714 is just a visual bug. The enum works as expected, and if you print the value and its string representation, you’ll see that everything is fine. So that warning can safely be ignored.
Second, about string variables in the Strategy Tester: this is also a known limitation. Input strings often don’t retain their values properly during testing or optimization, and can behave unpredictably. That’s why it’s safer to use numeric types instead. For example, instead of using a string like "09:00-17:00", it’s better to separate hours and minutes into integers. This ensures the values are handled consistently by the Tester.
Thanks for sharing both observations; they’re helpful and very relevant.
I tested in debug mode(see attached figure).
Results:
1. current_trend "unknow enum value 65714::1----> numerical value is corrected but don't recognize the "label"
2. joe is a EnumToString(current_trend)----------> display correct value of ENUM.
I managed to reproduce this and wrote about it in a thread that developers sometimes read (they will most likely see it).
Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
Vladislav Boyko, 2025.06.07 21:00
There is an issue with displaying custom enum values in the debugger. The script code is attached. The issue was found by the original poster of this thread.
Thank you very much, Vladislav. That's right, I'm sure something like this won't go unnoticed.
Between us, new release announcement (where bugs, suggestions, etc. are usually reported), usually get more attention from the developers and the administration.
So yes, definitely (and even more so if you posted it on the Russian forum), it will be an excellent contribution.
Благодарю ещё раз. (Thanks again.)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I tested in debug mode(see attached figure).
Results:
1. current_trend "unknow enum value 65714::1----> numerical value is corrected but don't recognize the "label"
2. joe is a EnumToString(current_trend)----------> display correct value of ENUM.