This is part of my code
Everything works fine in the inputs, the drop down lists work perfectly
The problem I have is when setting the text to the labels
If the Ma_Timeframe is PERIOD_CURRENT it will just print as 0
PERIOD_CURRENT is 0 . . . from here: https://docs.mql4.com/constants/chartconstants/enum_timeframes
I'm not experienced with these ENUMs yet . . but shouldn't this . . .
case Current_Chart: MA_Timeframe = PERIOD_CURRENT; break;
. . . be this instead ?
case Current_Chart: MA_Timeframe = Period(); break;
GumRai:
Or if Ma_Timeframe ==PERIOD_H1, to print as "H1" instead of 60
Is there a simple way to do this?
no because PERIOD_H1 is a int & "H1" is a string
u cant convert int PERIOD_H1 to be a string "H1"
of cource u can do it but not like u do it
if (Period() == 60) string H1 = "H1";
It wont return the name of the identifier, it is the same thing as calling a variable, it just returns its value. You know you can give the drop down list "friendly" names too like
enum veg
{
Car, //carrots
tom, //tomatoes
cab, //cabbage
cal, //cauliflour
pot //potatoes
};
input veg vegatable = carrots
Or if Ma_Timeframe ==PERIOD_H1, to print as "H1" instead of 60. Is there a simple way to do this?
How about EnumToString() ..
StringReplace(EnumToString(Ma_Timeframe),"PERIOD_","")
EnumToString() !! i didnt know that existed
EnumToString() !! i didnt know that existed
Thankyou so much ydrol
I guess that when I was looking down the index in the documentation, my eyes were conditioned by all the Enums being in capital letters, so I totally missed that.
GumRai: so I totally missed that.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
This is part of my code
Everything works fine in the inputs, the drop down lists work perfectly
The problem I have is when setting the text to the labels
If the Ma_Timeframe is PERIOD_CURRENT it will just print as 0
If MA_applied_price is close, it will print as 0
Although I am happy enough if I could get MA_applied_price to print as "Close"
I would like Ma_Timeframe to print as Current_Chart
Or if Ma_Timeframe ==PERIOD_H1, to print as "H1" instead of 60
Is there a simple way to do this?