iCustom call to indicator with dropdown input

Back to topics list To post a new topic, please log in or register
avatar
22
gostahulden 2016.02.16 12: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?

 

avatar
Moderator
3418
GumRai 2016.02.16 12: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.

avatar
22
gostahulden 2016.02.16 13: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. 
avatar
13004
WHRoeder 2016.02.16 14:38 #
 
gostahulden: Ouch, is this really the only way?
  1. You look at the indicator code.
  2. Detailed explanation of iCustom - MQL4 forum
avatar
Moderator
3418
GumRai 2016.02.16 14: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.

avatar
22
gostahulden 2016.02.16 16: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. 

Back to topics list  

To add comments, please log in or register