stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Can't control indicator from the EA
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=2610
Page 1 of 1
Author:  traderduke [ Tue Jun 25, 2013 2:08 pm ]
Post subject:  Can't control indicator from the EA

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
Author:  fxprotrader [ Wed Jun 26, 2013 3:23 am ]
Post subject:  Re: Can't control indicator from the EA

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.
Author:  dietcoke [ Wed Jun 26, 2013 11:11 am ]
Post subject:  Re: Can't control indicator from the EA

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.
Author:  traderduke [ Wed Jun 26, 2013 1:47 pm ]
Post subject:  Re: Can't control indicator from the EA

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
Author:  dietcoke [ Wed Jun 26, 2013 6:13 pm ]
Post subject:  Re: Can't control indicator from the EA

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
Author:  gaheitman [ Wed Jun 26, 2013 9:37 pm ]
Post subject:  Re: Can't control indicator from the EA

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
Author:  traderduke [ Fri Jun 28, 2013 7:35 pm ]
Post subject:  Re: Can't control indicator from the EA

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
Author:  SteveHopwood [ Fri Jun 28, 2013 10:24 pm ]
Post subject:  Re: Can't control indicator from the EA

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
Author:  traderduke [ Mon Jul 01, 2013 4:10 am ]
Post subject:  Re: Can't control indicator from the EA

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
All times are UTC Page 1 of 1