Simple iCustom

Back to topics list To post a new topic, please log in or register
avatar
15
KingOfSand 2015.05.10 14:41
 

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;
avatar
12983
WHRoeder 2015.05.10 20:30 #
 
  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
avatar
15
KingOfSand 2015.05.14 18:07 #
 

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 :) 

avatar
15
KingOfSand 2015.05.18 16:56 #
 
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.
Back to topics list  

To add comments, please log in or register