Simple iCustom

 

Hi,

I am having some trouble with iCustom. I need to use it for such a simple thing as passing a buy and put signal to an EA.

Can someone show me a simple way to do this?

 

This is some of the code in the EA:

double CallFromIndicator;
double PutFromIndicator;



CallFromIndicator = iCustom(NULL,0,"IndicatorForEA",1,0);
PutFromIndicator = iCustom(NULL,0,"IndicatorForEA",2,0); 

 .....

....

 

if(CallFromIndicator == 1)
printf (CallFromIndicator + "Call");
return(BUY_SIGNAL);

if(PutFromIndicator == 1)
printf (PutFromIndicator + "Put");
return(SELL_SIGNAL);

 

 The printf is just for debugging

 

And here is some code from the indicator:

#property indicator_buffers 1

 

.....



double PutBuffer[];
double CallBuffer[];

 

.......

 

// PUT

if (EverythingAlignsForAput = true){
         PutBuffer[2] = 1;
} 

// CALL 

if (EverythingAlignsForAcall == true){
         CallBuffer[1] = 1;
}



PutBuffer[2] = 0;
CallBuffer[1] = 0;
 
  1. #property indicator_buffers 1
    :
    double PutBuffer[];
    double CallBuffer[];
    Can't have two
  2. CallFromIndicator = iCustom(NULL,0,"IndicatorForEA",1,0);
    PutFromIndicator = iCustom(NULL,0,"IndicatorForEA",2,0); 
    
    If you have SetIndexBuffer(0, PutBuffer); SetIndexBuffer(1, CallBuffer); then your iCustom calls are wrong.
  3. if (EverythingAlignsForAput = true)    PutBuffer[2] = 1;
    if (EverythingAlignsForAcall == true) CallBuffer[1] = 1;
    Why are you setting element 2? Shouldn't the signal be on the current bar or the previous? In either case your iCustom calls are wrong.

  4. Detailed explanation of iCustom - MQL4 forum
 

Thanks...  Just new to this as you can understand.

 

Could you make an example how I can get two different signals from the indicator to the EA?
My brain is totally ****** up probably :) 

 
No one can make a good example how to get Call and Put signals from an indicator to an EA? So far I only have got info about things that is wrong.
Reason: