Can't control indicator from the EA

Post Reply
User avatar
traderduke
Trader
Posts: 306
Joined: Mon Nov 28, 2011 7:30 pm
Location: East Coast USA

Can't control indicator from the EA

Post by traderduke »

Help!
I can't control the indicator from the EA. See attached line 287 EA problem.
I originally had all the inputs to the Indicator but no luck.
Thanks

Ray
You do not have the required permissions to view the files attached to this post.
fxprotrader
Trader
Posts: 26
Joined: Sat Jun 16, 2012 11:26 pm

Re: Can't control indicator from the EA

Post by fxprotrader »

traderduke wrote:Help!
I can't control the indicator from the EA. See attached line 287 EA problem.
I originally had all the inputs to the Indicator but no luck.
Thanks

Ray
Ray-

You must enter all the parameters into the iCustom and must be defined as the correct type. You can exclude string comments but other than that you will need to enter them all.
dietcoke
Trader
Posts: 162
Joined: Tue Nov 15, 2011 9:59 pm

Re: Can't control indicator from the EA

Post by dietcoke »

fxprotrader wrote:
traderduke wrote:Help!
I can't control the indicator from the EA. See attached line 287 EA problem.
I originally had all the inputs to the Indicator but no luck.
Thanks

Ray
Ray-

You must enter all the parameters into the iCustom and must be defined as the correct type. You can exclude string comments but other than that you will need to enter them all.
Take a look at the indicator. All the externals have a default value. This means you could run

Code: Select all

trend   = iCustom(NULL,0,"RK-Sidus_V11");
which would work with the default values for the indi.

However, when you do this:

Code: Select all

trend   = iCustom(NULL,0,"RK-Sidus_V11",analogytype,5,0);
it doesn't work and this is because Empty4 doesn't know which of the many external variables you want to set.

Think of the indicator as a function call where the function has been declared with a lot of default values

eg

Code: Select all

void somefunction(string symbol, int tf=PERIOD_D1, int length=3, bool cmd=true)


if you want to call this function with cmd=false then you MUST also provide a value for length and tf even though you want to use the defaults.

eg,..

Code: Select all

//This is fine.
somefunction(SYMBOL(),PERIOD_D1,3,false)

// This won't work
somefunction(SYMBOL(),false)
It's the same with iCustom. if there are 10 externals with default values and you want to change the 6th, you must provide a value in your function call for the 6th,7th, 8th,9th and 10th items.

Persnally, I would customise the indicator so that the parameters you want to vary are right at the top of the list.
Image
User avatar
traderduke
Trader
Posts: 306
Joined: Mon Nov 28, 2011 7:30 pm
Location: East Coast USA

Re: Can't control indicator from the EA

Post by traderduke »

Fella's
FP thank you very much for your help.

DC thanks for providing an in depth solution. I streamlined my indicator & tried to mimic the inputs but for some reason I am missing an input or have the order or list wrong. I have added an option for the short & working indicator control, versus the long & non-working EA control. Any chance you can get the EA control to work?

Thanks again for your help

Ray
You do not have the required permissions to view the files attached to this post.
dietcoke
Trader
Posts: 162
Joined: Tue Nov 15, 2011 9:59 pm

Re: Can't control indicator from the EA

Post by dietcoke »

traderduke wrote:Fella's
FP thank you very much for your help.

DC thanks for providing an in depth solution. I streamlined my indicator & tried to mimic the inputs but for some reason I am missing an input or have the order or list wrong. I have added an option for the short & working indicator control, versus the long & non-working EA control. Any chance you can get the EA control to work?

Thanks again for your help

Ray
As far as Empty4 is concerned the string comments are variables. Comment them out from the indicator and try again
Image
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Can't control indicator from the EA

Post by gaheitman »

traderduke wrote:Fella's
FP thank you very much for your help.

DC thanks for providing an in depth solution. I streamlined my indicator & tried to mimic the inputs but for some reason I am missing an input or have the order or list wrong. I have added an option for the short & working indicator control, versus the long & non-working EA control. Any chance you can get the EA control to work?

Thanks again for your help

Ray
This code calls the indicator using all the defaults. That should help you map out your variables correctly.

Code: Select all

//+------------------------------------------------------------------+
// script program start function                                    
//+------------------------------------------------------------------+
int start()
  {
  Alert(iCustom(NULL,0,"RK-sidus_v12","","","","","",3,2,13,0.0001,50,8,55,45,24,90,1500,true,false,true,true,false,5,0));
  Alert(iCustom(NULL,0,"RK-sidus_v12","","","","","",3,2,13,0.0001,50,8,55,45,24,90,1500,true,false,true,true,false,5,1));
  Alert(iCustom(NULL,0,"RK-sidus_v12","","","","","",3,2,13,0.0001,50,8,55,45,24,90,1500,true,false,true,true,false,5,23));
   return(0);
  }
//
George
User avatar
traderduke
Trader
Posts: 306
Joined: Mon Nov 28, 2011 7:30 pm
Location: East Coast USA

Re: Can't control indicator from the EA

Post by traderduke »

Fella's
It works!! Thanks for the help you were both correct but with 2 different approaches. I seem to have a better understanding of the process thanks to both your answers.

Thanks again

Ray
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Can't control indicator from the EA

Post by SteveHopwood »

Ray, great to see you embarking on the road I started a few years ago. You have a few headaches to come, but ultimately will not be sorry you decided to learn to code this stuff.

FWIW, the more inputs a Crap Custom Abortion (aka Custom Indi) has, the less likely it is that a call to the damn thing will return a useful result. No idea why, but 'tis a fact of life. Mq4 is not described as CrapQ4 merely because I have a warped sense of humour.

The first thing I do when faced by a CCA is look at the number of extern's. When I am given the source code and the externs number more that 5, then I look to do a modified version of the CCA that cuts down on the externs, and release it as '........ For Automation.mq4'

Mostly after that I conclude it is an UCCA (Utter Crap Custom Abortion) and abandon the project, but that is another story. :lol:

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
traderduke
Trader
Posts: 306
Joined: Mon Nov 28, 2011 7:30 pm
Location: East Coast USA

Re: Can't control indicator from the EA

Post by traderduke »

Steve,
Thanks I'll keep that in mind! The funny thing is I needed to optimize the v12 to prove that 9 of the 12 cases were useless. I trimmed it back to 2 cases Ma w/diff & rsi.

Great forum, Steve. The helpfulness of the members is outstanding.

Ray
SteveHopwood wrote:Ray, great to see you embarking on the road I started a few years ago. You have a few headaches to come, but ultimately will not be sorry you decided to learn to code this stuff.

FWIW, the more inputs a Crap Custom Abortion (aka Custom Indi) has, the less likely it is that a call to the damn thing will return a useful result. No idea why, but 'tis a fact of life. Mq4 is not described as CrapQ4 merely because I have a warped sense of humour.

The first thing I do when faced by a CCA is look at the number of extern's. When I am given the source code and the externs number more that 5, then I look to do a modified version of the CCA that cuts down on the externs, and release it as '........ For Automation.mq4'

Mostly after that I conclude it is an UCCA (Utter Crap Custom Abortion) and abandon the project, but that is another story. :lol:

:D
Post Reply

Return to “Coders Hangout”