Trouble with the iCustom function parameters?

 
I'm not returning any value for this iCustom function.

I am trying to get the following value of Momentum
//======================
// Indicator Setup
//======================
SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,3);
SetIndexBuffer(0,Pos_Diff);
SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,3);
SetIndexBuffer(1,Neg_Diff);
SetIndexStyle(2,DRAW_LINE,STYLE_DASHDOT);
SetIndexBuffer(2,Momentum);

with this following code

Momentum = iCustom(NULL, 0, Indicator, Momentum_Period, 2,1);

The Momentum[] array of the indicator only uses one parameter which is Momentum_Period

so i'm assuming i am not passing the parameter through correctly or maybe it's something different.

I've also tried this code to print values of all the indicators in the Indicator named Indicator and it's just returning 0.

int start()
{

{
int mode=4;
for(int cnt=0;cnt<=mode;cnt++) {
Print("Values = ",iCustom(Symbol(),0,Indicator,0,mode-1,0));
}
return(0);

Any help would be appreciated.
 
loki56:

I'm not returning any value for this iCustom function.

I am trying to get the following value of Momentum
//======================
// Indicator Setup
//======================
SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,3);
SetIndexBuffer(0,Pos_Diff);
SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,3);
SetIndexBuffer(1,Neg_Diff);
SetIndexStyle(2,DRAW_LINE,STYLE_DASHDOT);
SetIndexBuffer(2,Momentum);

with this following code

Momentum = iCustom(NULL, 0, Indicator, Momentum_Period, 2,1);

The Momentum[] array of the indicator only uses one parameter which is Momentum_Period

so i'm assuming i am not passing the parameter through correctly or maybe it's something different.

I've also tried this code to print values of all the indicators in the Indicator named Indicator and it's just returning 0.

int start()
{

{
int mode=4;
for(int cnt=0;cnt<=mode;cnt++) {
Print("Values = ",iCustom(Symbol(),0,Indicator,0,mode-1,0));
}
return(0);

Any help would be appreciated.



Give me indicator full code and I help you...

 
loki56:

I'm not returning any value for this iCustom function.

I am trying to get the following value of Momentum

with this following code

The Momentum[] array of the indicator only uses one parameter which is Momentum_Period

so i'm assuming i am not passing the parameter through correctly or maybe it's something different.

I've also tried this code to print values of all the indicators in the Indicator named Indicator and it's just returning 0.

Please read some other posts before posting . . .

Please edit your post . . . please use the SRC button to post code: How to use the SRC button.

 
loki56:

I'm not returning any value for this iCustom function.


Read this thread : Detailed explanation of iCustom - MQL4 forum
 
more:


Give me indicator full code and I help you...


https://www.mql5.com/en/code/8840

 

If you don't want to use these default values for the Indicator you need to specify the values for them all in the iCustom() call . . .

extern int       Boll_Period=20;
extern double    Boll_Dev=2.0;
extern int       Keltner_Period=20;
extern double    Keltner_Mul=1.5;
extern int       Momentum_Period=12;
extern int       Back_Bars=1000;
extern bool      Alert_On=true;
extern bool      On_Screen_Info=true;
 
RaptorUK:

If you don't want to use these default values for the Indicator you need to specify the values for them all in the iCustom() call . . .


So I put the all values into the parameters part in iCustom()?


Momentum = iCustom(NULL, 0, Boll_Period,Boll_Dev,Keltner_Period,Keltner_Mul,Momentum_Period,Back_Bars,Alert_On,On_Screen_Info, 2,1);


 
loki56:

So I put the all values into the parameters part in iCustom()?


Momentum = iCustom(NULL, 0, Boll_Period,Boll_Dev,Keltner_Period,Keltner_Mul,Momentum_Period,Back_Bars,Alert_On,On_Screen_Info, 2,1);


Yes, and the name of the Indicator, and the buffer you want and the shift of the cell in the buffer. did you read this thread ? Detailed explanation of iCustom - MQL4 forum . . . . and can you please edit your 1st post in this thread, as already requested.
 

pass your indicator name in quotes-like "Indicator".this may help.also pass the parameters to icustom in same number and order as declared in your custom indicator.

Reason: