No but you can roll your own enum.
Thanks Marco vd Heijden
Nice to see you again after a long time
I'd like to use ENUM_TIMEFRAMES But removing the Period Current.
Is there a way to use defult ENUMs but lock(remove) one or a few of values in input parameters?
I hope you got what I want to say but I give you an example
I want to make Time frames selectable in parameters window.
But I don't want it to show the Current .
I know that I can make my own enum. No problem with that. so that's not a problem, i'm just curious to know.
I just wanted to know if it is possible to use defult ENUM_TIMEFRAMES but removing one or more values.
Regards
You can do so by creating a synthetic ENUM_timeframes as shown below:
enum ENUM_Timeframe { Any_timeframe=-1, M1=1, M5=5, M15=15, M30=30, H1=60, H4=240, D1=1440, W1=10080, MN=43200, };
then for selecting the preferred timeframe you should use the code below:
extern ENUM_Timeframe selected_Timeframe=Any_timeframe;//Selected Timeframe
Be noted that from thereafter you have to use the above mentioned variable as the timeframes in your code.
Hope it helps.
then for selecting the preferred timeframe you should use the code below:
That would work, but you wouldn't have to hard code the numerical values. You can do something like this:
enum EnAcceptableTimeFrames { _PERIOD_H4 = PERIOD_H4, _PERIOD_D1 = PERIOD_D1, _PERIOD_W1 = PERIOD_W1, _PERIOD_MN1 = PERIOD_MN1 };
That would work, but you wouldn't have to hard code the numerical values. You can do something like this:
I admire your advice and confirm that it would be more suitable to code like what you mentioned.
You can do so by creating a synthetic ENUM_timeframes as shown below:
then for selecting the preferred timeframe you should use the code below:
Be noted that from thereafter you have to use the above mentioned variable as the timeframes in your code.
Hope it helps.
Thanks
parham.trader
I appreciate your help,
As I mentioned before, The question was to see if there is a way to not write a new enum.
But Thanks for your time.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is there a way to use defult ENUMs but lock(remove) one or a few of values in input parameters?
I hope you got what I want to say but I give you an example
I want to make Time frames selectable in parameters window.
But I don't want it to show the Current .
I know that I can make my own enum. No problem with that. so that's not a problem, i'm just curious to know.
I just wanted to know if it is possible to use defult ENUM_TIMEFRAMES but removing one or more values.
Regards