Values of indi's not picked up by EA

To add comments, please log in or register
Ernest Klokow
1233
Ernest Klokow  

I am writing and EA and are using 2 custom indicators. I have used different custom indicators successfully in other EA's. 

My problem is that the EA does not pick up the values displayed in the data window. It returns zeros when the ame values in the data window are non zero.

Here is an example from the Journal which shows zero values:


And here are the values displayed in the data window for the same period and time:

I have tried all the possible index buffer positions in the EA for these indicators but to no avail. They all return zero values but as can be see there are values in certain buffers.

Can somebody please give me some guidance?

Fabio Cavalloni
4213
Fabio Cavalloni  
There is a problem with the iCustom function, you need to write the related code here if you want an help.
Ernest Klokow
1233
Ernest Klokow  

Here is the iCustom code:

 SSLup = iCustom(NULL,0,"SSL_fast_sBar_mtf",SSLlb,50,SSLtimeframe,"M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF",0,1);
 SSLup = iCustom(NULL,0,"SSL_fast_sBar_mtf",SSLlb,50,SSLtimeframe,"M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF",1,1); 

AND

CCIup = iCustom(NULL,0,"CCI 200 level alert",CCIperiod,0,100,-100,0,"M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF",true,false,"CCI Critical Level", "BUY; CCI Upper Trigger Cross","SELL; CCI Lower Trigger Cross",1500,"Price(C0 O1 H2 L3 M4 T5 W6) ModeMa(SMA0,EMA1,SmmMA2,LWMA3)", 1,1);    
CCIdown = iCustom(NULL,0,"CCI 200 level alert",CCIperiod,0,100,-100,0,"M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF",true,false,"CCI Critical Level", "BUY; CCI Upper Trigger Cross","SELL; CCI Lower Trigger Cross",1500,"Price(C0 O1 H2 L3 M4 T5 W6) ModeMa(SMA0,EMA1,SmmMA2,LWMA3)", 4,1);    
CCIdown0 = iCustom(NULL,0,"CCI 200 level alert",CCIperiod,0,100,-100,0,"M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF",true,false,"CCI Critical Level", "BUY; CCI Upper Trigger Cross","SELL; CCI Lower Trigger Cross",1500,"Price(C0 O1 H2 L3 M4 T5 W6) ModeMa(SMA0,EMA1,SmmMA2,LWMA3)", 0,1);    
CCIdown2 = iCustom(NULL,0,"CCI 200 level alert",CCIperiod,0,100,-100,0,"M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF",true,false,"CCI Critical Level", "BUY; CCI Upper Trigger Cross","SELL; CCI Lower Trigger Cross",1500,"Price(C0 O1 H2 L3 M4 T5 W6) ModeMa(SMA0,EMA1,SmmMA2,LWMA3)", 2,1);    
CCIdown3 = iCustom(NULL,0,"CCI 200 level alert",CCIperiod,0,100,-100,0,"M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF",true,false,"CCI Critical Level", "BUY; CCI Upper Trigger Cross","SELL; CCI Lower Trigger Cross",1500,"Price(C0 O1 H2 L3 M4 T5 W6) ModeMa(SMA0,EMA1,SmmMA2,LWMA3)", 3,1);    
William Roeder
20250
William Roeder  
Ernest Klokow: Here is the iCustom code:

Useless without the exact version of your indicator's code.

Ernest Klokow
1233
Ernest Klokow  

Here is the relevant code from one of the indicators:

//----
extern int     Lb          =3;
extern int     SSL_BarLevel=50;    //BarLevel 10-90
extern int     TimeFrame=1440;
extern string  TimeFrames="M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
//----
double sslHup[];
double sslHdn[];
double hlv[];
string IndicatorFileName;
datetime TimeArray[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   string TimeFrameStr;
   if(TimeFrame<Period()) TimeFrame=Period();
   switch(TimeFrame)
     {
      case PERIOD_M1:  TimeFrameStr="M1";break;
      case PERIOD_M5:  TimeFrameStr="M5";break;
      case PERIOD_M15: TimeFrameStr="M15";break;
      case PERIOD_M30: TimeFrameStr="M30";break;
      case PERIOD_H1:  TimeFrameStr="H1";break;
      case PERIOD_H4:  TimeFrameStr="H4";break;
      case PERIOD_D1:  TimeFrameStr="D1";break;
      case PERIOD_W1:  TimeFrameStr="W1";break;
      case PERIOD_MN1: TimeFrameStr="MN1";break;
      default :        TimeFrameStr="TF0";
     }
//----
   IndicatorBuffers(3);
   SetIndexBuffer(0,sslHup); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,167); SetIndexLabel(0,"SSLup "+Lb+" ["+TimeFrame+"]");
   SetIndexBuffer(1,sslHdn); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,167); SetIndexLabel(1,"SSLdn "+Lb+" ["+TimeFrame+"]");
   SetIndexBuffer(2,hlv);
//----
Fabio Cavalloni
4213
Fabio Cavalloni  

From what we see from your previous screenshot the problem of value 0.0 is about CCI indicator, not SSL one.

In case of you are using same variables values as indicator defaults, I suggest to you to remove all variables in iCustom function, leaving only iCustom(NULL,0,"Indicator_name",buffer,shift) in this way you will avoid all issues realted to variables mistmatching values/types.

Ernest Klokow
1233
Ernest Klokow  

The value is 0 (zero) for both the CCI and SSL indicators.

I have copied the long text for the string parameters because i was not sure if I could change it to something different that is shorter.

I cannot leave out some parameters since i need to optimise the EA later for those parameters.

Ernest Klokow
1233
Ernest Klokow  
I just tried this " leaving only iCustom(NULL,0,"Indicator_name",buffer,shift)" but still get zero's as results.
Ernest Klokow
1233
Ernest Klokow  
        SSLup = iCustom(NULL,0,"SSL_fast_sBar_mtf",0,1);
        SSLup = iCustom(NULL,0,"SSL_fast_sBar_mtf",1,1);
Fabio Cavalloni
4213
Fabio Cavalloni  

Look at the experts log... I'm pretty sure that you put indicator name wrongly or you have indicators in a different folder than MQL4\Indicators\

0 value can occur if indicator is not found or maybe if you are using a wrong variable type to store result of iCustom function.

Ernest Klokow
1233
Ernest Klokow  

I think I have found the problem. So far I have tested it in the Strategy Tester and have now loaded it onto a chart on advice from Fabio and checked the Experts tab. The values appearing in the Experts tab are completely different from the values in the Data Window so I am checking for the wrong values in my if statement!

Fabio thank you for your very valuable help. You helped me solve the problem!

12
To add comments, please log in or register