I was looking for a way to create a combo box for the input variables. I came across the following example:
It works beautifully and I have adapted it for my needs. My question is... What is the value returned from check?
So, if I wanted to do something like
Is that correct? So, if someone selected "value 3" from the dropdown, then the above would result in TRUE?
if(check == 0)//_p1 { blah blah } ------------------------ if(check == 1)//_p2 { blah blah }
So, if I wanted to do something like
if(check == _p3)
{
blah blah
}
Is that correct? So, if someone selected "value 3" from the dropdown, then the above would result in TRUE?
Think of enumerations as #define A 0, #define B 1, etc. with type checking. The second argument of iMA is a ENUM_TIMEFRAMES That means you can't pass one (1) or OP_SELL (also 1) but must use PERIOD_M1 (value 1.)
They can not select value 3. The pull down list will be _p1, _p2, etc. Change the enumerations to something readable.
Your if is correct. Do not start putting int values in the code as Nikolaos Pantzos suggests. That just makes self-documentating code non-docmentating.
Think of enumerations as #define A 0, #define B 1, etc. with type checking. The second argument of iMA is a ENUM_TIMEFRAMES That means you can't pass one (1) or OP_SELL (also 1) but must use PERIOD_M1 (value 1.)
They can not select value 3. The pull down list will be _p1, _p2, etc. Change the enumerations to something readable.
Your if is correct. Do not start putting int values in the code as Nikolaos Pantzos suggests. That just makes self-documentating code non-docmentating.
When I do it, the dropdown list is actually showing the value beside the //.
So:
_p1, // value a
The dropdown list is actually showing "value a", not "_p1".
It seems to be working as I expected.
Thanks for the help. This has been quite useful for creating my own values.
- 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 was looking for a way to create a combo box for the input variables. I came across the following example:
It works beautifully and I have adapted it for my needs. My question is... What is the value returned from check?
So, if I wanted to do something like
if(check == _p3) { blah blah
}
Is that correct? So, if someone selected "value 3" from the dropdown, then the above would result in TRUE?