Download MetaTrader 5

passing extern parameters to iCustom

To add comments, please log in or register
Find out how social trading can improve your profits
Ian Venner
2584
Ian Venner 2013.11.13 15:41 

Is it possible to code an EA that allows the user to enter the name and parameters of a custom indicator so that they can be passed to iCustom() ? I have tried to figure out a way to do this and I have hit the wall, how to get the parameters into iCustom without knowing how many there will be or what type.

Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2013.11.13 15:52  
SDC:

Is it possible to code an EA that allows the user to enter the name and parameters of a custom indicator so that they can be passed to iCustom() ? I have tried to figure out a way to do this and I have hit the wall, how to get the parameters into iCustom without knowing how many there will be or what type.

Off the top of my head . . . get the user to enter a string comma separated of the parameters to pass in the iCustom() call . . . very messy and impossible to verify as correct unless you know about the Indicator up front.
Ian Venner
2584
Ian Venner 2013.11.13 16:06  

yes I think messy is the operative word, I'm suprised this question has not been asked before if it has I couldnt find it. If I could pass the string it wouldnt be that bad, but of course iCustom requires the parameters to be of the correct type..

Alain Verleyen
Moderator
30775
Alain Verleyen 2013.11.13 17:26  
SDC:

Is it possible to code an EA that allows the user to enter the name and parameters of a custom indicator so that they can be passed to iCustom() ? I have tried to figure out a way to do this and I have hit the wall, how to get the parameters into iCustom without knowing how many there will be or what type.

It's possible with mql5, but I don't know if it will be implemented in the new mql4. Currently (beta build 538), it's not.
Ex Ovo Omnia
3156
Ex Ovo Omnia 2013.11.13 17:29  
I faced this problem with my commercial stuff and the only fool-proof solution was - no parameters at all. I hardcode the parameters to indicator and save it with a reasonable name, that lets me guess the hardcoded parameters.
Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2013.11.13 17:31  
Ovo:
I faced this problem with my commercial stuff and the only fool-proof solution was - no parameters at all. I hardcode the parameters to indicator and save it with a reasonable name, that let me guess the hardcoded parameters.
If the default externs are suitable the iCustom() call doesn't need them so then they don't need to specified in the EA . . . that might be another solution.
Ian Venner
2584
Ian Venner 2013.11.13 18:02  
Ovo:
I faced this problem with my commercial stuff and the only fool-proof solution was - no parameters at all. I hardcode the parameters to indicator and save it with a reasonable name, that lets me guess the hardcoded parameters.

Yes but if it is a commercial product and the user's have a custom indicator and not have access to the source code or they might not know how to hard code its parameters even if they did have the source code.

Ian Venner
2584
Ian Venner 2013.11.13 18:26  
angevoyageur:
It's possible with mql5, but I don't know if it will be implemented in the new mql4. Currently (beta build 538), it's not.
Yes that mql5 function would solve the problem nicely. I havent given up on doing this in the current mql4 though, I think it might be possible but it wont be pretty.
whroeder1
14544
whroeder1 2013.11.13 18:27  
SDC: Yes but if it is a commercial product and the user's have a custom indicator
The custom indicator's externals must match your specified count and types.
Ubzen
5394
Ubzen 2013.11.13 18:48  
SDC: Yes that mql5 function would solve the problem nicely. I havent given up on doing this in the current mql4 though, I think it might be possible but it wont be pretty.
I'll grab my pop_corn, this is gonna be very entertaining .
Ex Ovo Omnia
3156
Ex Ovo Omnia 2013.11.13 18:54  
SDC:

Yes but if it is a commercial product and the user's have a custom indicator and not have access to the source code or they might not know how to hard code its parameters even if they did have the source code.


You may create a wrapper indicator which would be a proxy to the 'unfriendly' indicator.
12
To add comments, please log in or register