Download MetaTrader 5
To add comments, please log in or register
Any problems with the code? Find solution in documentation!
Gosta Hulden
77
Gosta Hulden 2016.02.16 11:17 

I am using iCustom to call an indicator that has a dropdown as an input. I don't have the source code to the indicator.

If the dropdown box contains 3 values with comment descriptions I can of course guess that the values behind the scenes are 0, 1 and 2, and for example pass in 2 if I want to use the last value in the dropdown. But how do I know for sure? Maybe the values used are 1, 2 and 3 instead, so 2 would then give me the second value rather than the third.

Here is an example of a dropdown declared in the indicator code:

enum enumTest {

   Option1=0, // This is the first dropdown option

   Option2=1, // This is the second dropdown option

   Option3=2, // This is the third dropdown option 

};

 In this example I should pass in 2 if I want the third option. But since I don't have the source code I don't know for sure what value is used for the third option. Is there a way to find out? Or does it always start with 0 when using iCustom, no matter how it's declared in the code?

Keith Watford
Moderator
7869
Keith Watford 2016.02.16 11:36  

Put the indicator on a chart.

Write your code with the iCustom call. Try various input values for the enum. Check if the output from your indicator is the same as the original indicator. Trial and error.

Gosta Hulden
77
Gosta Hulden 2016.02.16 12:24  
GumRai:

Put the indicator on a chart.

Write your code with the iCustom call. Try various input values for the enum. Check if the output from your indicator is the same as the original indicator. Trial and error.

Ouch, is this really the only way? I have worked with indicators that have drop downs with 30-ish values, and there is no guarantee that those values even forms a sequence, or start with 0 or 1. Theoretically it could be any value in any order, so unless it's well written it could be impossible to find out with trial and error. Not to mention time consuming. 
whroeder1
13593
whroeder1 2016.02.16 13:38  
gostahulden: Ouch, is this really the only way?
  1. You look at the indicator code.
  2. Detailed explanation of iCustom - MQL4 forum
Keith Watford
Moderator
7869
Keith Watford 2016.02.16 13:41  

If it is really that difficult to work out the enum int equivalent, you could run the indicator in the strategy tester (indicator mode).

Look in the journal and you will see the list of inputs and they will include the integer equivalent of whatever enum you have input in the properties.

Gosta Hulden
77
Gosta Hulden 2016.02.16 15:13  
GumRai:

If it is really that difficult to work out the enum int equivalent, you could run the indicator in the strategy tester (indicator mode).

Look in the journal and you will see the list of inputs and they will include the integer equivalent of whatever enum you have input in the properties.

Thank you :-)

This was a very good idea. Sure, if there are many options in the list I have to do it one time for each option, but this is definitely doable. 

/
To add comments, please log in or register