BBands_stop_V1 iCustom value calling problem

 

Hi,

I'm preparing an expert advisor and I want to use BBands_stop indicator in my ea. However I couldnt call values in BBands_stop indicator. Can anyone help me how can I do it ?

Here is my code

bBand = iCustom(NULL,0,"BBands_Stop_v1",Length,Deviation,0);

I cannot take the true value by writing above.

I also include my BBands_Stop_v1 indicator into the attachment.

I would be so happy if anyone help me quick.

Thanks.

Files:
 
ihsany87:

Hi,

I'm preparing an expert advisor and I want to use BBands_stop indicator in my ea. However I couldnt call values in BBands_stop indicator. Can anyone help me how can I do it ?

Here is my code

bBand = iCustom(NULL,0,"BBands_Stop_v1",Length,Deviation,0);

I cannot take the true value by writing above.

I also include my BBands_Stop_v1 indicator into the attachment.

I would be so happy if anyone help me quick.

Thanks.


//---- input parameters
extern int    Length=20;      // Bollinger Bands Period
extern int    Deviation=2;    // Deviation was 2
extern double MoneyRisk=1.00; // Offset Factor
extern int    Signal=1;       // Display signals mode: 1-Signals & Stops; 0-only Stops; 2-only Signals;
extern int    Line=1;         // Display line mode: 0-no,1-yes  
extern int    Nbars=1000;
//---- indicator buffers
....
extern bool SoundON=true;

You are using iCustom wrongly there are more extern input parameters inside your indicator and you have to choose what buffer you want the value from and what bar it is you get that value.... Read the topics about iCustom recently placed

 

Thanks for response,

should I use it like that ?

bBand = iCustom(NULL,0,"BBands_Stop_v1",Length,Deviation,MoneyRisk,Signal,Line,Nbars,0);

 
ihsany87:

Thanks for response,

should I use it like that ?

bBand = iCustom(NULL,0,"BBands_Stop_v1",Length,Deviation,MoneyRisk,Signal,Line,Nbars,0);


No, still missing parameter " extern bool SoundON=true " and i don't see what buffer you do wanna have the value from and for what bar

you can't choose both with "0" so there is something missing

 
I want to get the uptrendstop and downtrendstop values of the BBands_stop. How can I get this values into my ea ?
 
ihsany87:
I want to get the uptrendstop and downtrendstop values of the BBands_stop. How can I get this values into my ea ?

Detailed explanation of iCustom - MQL4 forum
 
I also saw this BBands_Stop_v1 and currently using it in Demo account but most of the time I missed the first signal where supposed to be placed my entry specially in TF H1 & H4 due to my day job. I want to make it as an EA but I don't know how to program and I'm not an IT guy or programmer. Very much appreciate any help and assistance.
 
Catyrz:
 Very much appreciate any help and assistance.
If you follow this link they will code whatever you would like them to code for you:  MT4 & MT5 coding
 
deVries:


No, still missing parameter " extern bool SoundON=true " and i don't see what buffer you do wanna have the value from and for what bar

you can't choose both with "0" so there is something missing

your are wrong in demanding a parameter for every declared external indicator parameter. you only need to specify the values different from the default values.

bBand = iCustom(NULL,0,"BBands_Stop_v1",Length,Deviation, ...)

this in fact is a valid parameter specification.

ihsany87:
I want to get the uptrendstop and downtrendstop values of the BBands_stop. How can I get this values into my ea ?

As deVries correctly pointed out you need to specify which buffer the value belongs to you want to return.

double upTrendBuffer   = iCustom(NULL, 0, "BBands_Stop_v1", Length, Deviation, 0, 0);
double downTrendBuffer = iCustom(NULL, 0, "BBands_Stop_v1", Length, Deviation, 1, 0);
double upTrendSignal   = iCustom(NULL, 0, "BBands_Stop_v1", Length, Deviation, 2, 0);
double downTrendSignal = iCustom(NULL, 0, "BBands_Stop_v1", Length, Deviation, 3, 0);
double upTrendLine     = iCustom(NULL, 0, "BBands_Stop_v1", Length, Deviation, 4, 0);
double downTrendLine   = iCustom(NULL, 0, "BBands_Stop_v1", Length, Deviation, 5, 0);

above code gives you the indicator values for bar 0 (the last/current bar). be aware that every call to iCustom() might throw an ERR_HISTORY_WILL_UPDATED or ERR_INCORRECT_SERIESARRAY_USING error if called for another than the current timeframe. ERR_INCORRECT_SERIESARRAY_USING better should be named ERR_TIMEFRAME_NOT_AVAILABLE.

 
paulepanke:

your are wrong in demanding a parameter for every declared external indicator parameter. you only need to specify the values different from the default values.

So would this if what you have written is correct . . .

bBand = iCustom(NULL,0,"BBands_Stop_v1", MoneyRisk, Line, ...)

  . . .  but I don't think it is as there would be no way for MT4 to know which value is for which extern parameter and which default values are to be used.

 
RaptorUK:

So would this if what you have written is correct . . .

  . . .  but I don't think it is as there would be no way for MT4 to know which value is for which extern parameter and which default values are to be used.

 

you are right, I was not clear enough. assumed you have 8 parameters and you only want to change the third, you have to specify at least 3. for all remaining parameters default values are applied. this means MT4 always reserves the last two parameters for "buffer" and "bar". everything else is passed to the indicator. applying of default values takes place in the indicator, iCustom() has no idea of how many parameters an indicator needs.
Reason: