What's the Error in my EA?

 

Hi! 

I am trying to build an EA based on the indicator posted in this article https://www.mql5.com/en/code/7116. I have difficulty in creating the trigger to open a correct buy / sell order when the signal is given by this indicator. I am assuming that bullish divergence signal is given when the value of buffer #0 is ddifferent from EMPTY_VALUE. but in this case orders happen to be done only on some of the Bullish arrows printed on the chart. this is how I am going to check for the signal... can you help me to understand where I am wrong? Looking at the data Window this should be correct!

   IF (iCustom(NULL,0,"FX5_MACD_Divergence_V1.0",separator1,fastEMA,slowEMA,signalSMA,separator2,drawIndicatorTrendLines,drawPriceTrendLines,displayAlert,0,1) != EMPTY_VALUE) 

 Thanks in advance for any help!

 

Lorenz 

 
glorenz75:

Hi! 

I am trying to build an EA based on the indicator posted in this article https://www.mql5.com/en/code/7116. I have difficulty in creating the trigger to open a correct buy / sell order when the signal is given by this indicator. I am assuming that bullish divergence signal is given when the value of buffer #0 is ddifferent from EMPTY_VALUE. but in this case orders happen to be done only on some of the Bullish arrows printed on the chart. this is how I am going to check for the signal... can you help me to understand where I am wrong? Looking at the data Window this should be correct!

   IF (iCustom(NULL,0,"FX5_MACD_Divergence_V1.0",separator1,fastEMA,slowEMA,signalSMA,separator2,drawIndicatorTrendLines,drawPriceTrendLines,displayAlert,0,1) != EMPTY_VALUE) 

Try printing the values returned by your iCustom() calls,  you have 2 buffers,  one for each arrow.  You may be having issues comparing doubles,  read this:  Can price != price ?
 
RaptorUK:
Try printing the values returned by your iCustom() calls,  you have 2 buffers,  one for each arrow.  You may be having issues comparing doubles,  read this:  Can price != price ?


thank you for your quick resoponse... I already printed the custom calls, and they return 'not EMPTY_VALUES' only in those cases where my Buy order works, but on the chart I have more signals given from the Indicator where the print returns the EMPTY_VALUE but the Data window for the buffer returns a value! 
 
glorenz75:

thank you for your quick resoponse... I already printed the custom calls, and they return 'not EMPTY_VALUES' only in those cases where my Buy order works, but on the chart I have more signals given from the Indicator where the print returns the EMPTY_VALUE but the Data window for the buffer returns a value! 

 you have 2 buffers,     .............    RaptorUK  replied !!!!!!
 
deVries:

 you have 2 buffers,     .............    RaptorUK  replied !!!!!!

I have now printed the values of all 8 buffers and it seems that when a signal is given on the chart (green arrow) sometimes the buffer 0 is filled and in other cases it is not, and none of the other buffers give a value (instead of the macd line value buffers :-(
 
glorenz75:

I have now printed the values of all 8 buffers and it seems that when a signal is given on the chart (green arrow) sometimes the buffer 0 is filled and in other cases it is not, and none of the other buffers give a value (instead of the macd line value buffers :-(

Did you read this thread ?  Can price != price ?

Look at the code for the Indicator,  the arrows are buffers 0 and 1,  where there is an arrow you get a value,  no arrow == no value,  i.e. EMPTY_VALUE   ( 0x7FFFFFFF )

Have you double, triple and quadruple checked that you are using the same extern parameter values in your iCustom() call as in the Indicator you placed on your chart ? 

 
RaptorUK:

Did you read this thread ?  Can price != price ?

Look at the code for the Indicator,  the arrows are buffers 0 and 1,  where there is an arrow you get a value,  no arrow == no value,  i.e. EMPTY_VALUE   ( 0x7FFFFFFF )

Have you double, triple and quadruple checked that you are using the same extern parameter values in your iCustom() call as in the Indicator you placed on your chart ? 

 


yes I have.. also when I lunch the tester with my EA calling the custom indicator, the display is filled with many signals that are not catched by the EA itself. Printing the values on some bars gives EMPTY_VALUE even if the data monitor gives a value for the buffer :-( 
 

As I told I am trying to catch the buy signal with the following code..

 

if  (iCustom(NULL,0,"FX5_MACD_Divergence_V1.0",separator1,fastEMA,slowEMA,signalSMA,separator2,drawIndicatorTrendLines,drawPriceTrendLines,displayAlert,0,1) != EMPTY_VALUE)

 

but often bullish arrows on the chart simply give an EMPTY_VALUE and sometimes not. I do not understand the reason.

 

I printed the valeu of 8 buffers just to see what's filled in all the buffers aviable

I also can't understand why sometimes the value is empty even if the arrow is showed on the chart and the data window gives a value for the buffer 

 
glorenz75:


I also can't understand why sometimes the value is empty even if the arrow is showed on the chart and the data window gives a value for the buffer 

It's because you are doing something wrong . . .
 
glorenz75:  IF (iCustom(NULL,0, "FX5_MACD_Divergence_V1.0", separator1, fastEMA, slowEMA, signalSMA, separator2, drawIndicatorTrendLines, drawPriceTrendLines, displayAlert, 0,1)  != EMPTY_VALUE) 

No mind readers here. We have no idea what those variables are. Start with factoring that unreadable line Detailed explanation of iCustom - MQL4 forum

 
WHRoeder:

No mind readers here. We have no idea what those variables are. Start with factoring that unreadable line Detailed explanation of iCustom - MQL4 forum



IF (iCustom(NULL,0, "FX5_MACD_Divergence_V1.0", "*** MACD Settings ***", 12, 26, 9, "*** Indicator Settings ***", true, true, true, 0,1)  != EMPTY_VALUE) 
this are the values of the function (the standard values of the indicator settings)
Reason: