Download MetaTrader 5

bug in ICustom() ????

To add comments, please log in or register
ScienziatoBesti
13
ScienziatoBesti  

Hi,

I slightly modified the iFractal indicator and I called the new one MaxMin. It seems to work properly but some problems arrive when I try to use it in an EA.

I call it with the function

      if((m_handle_MinMaxM1=iCustom(NULL, PERIOD_M1, "MyIndicators\\MaxMin.ex5", MinMax_nBar) )==INVALID_HANDLE)
        {
         printf("Error creating MinMax indicator");
         return(false);
        }

and I get the data from it with this code

 ResetLastError();
   int copied1 = CopyBuffer(m_handle_MinMaxM1,0,start, stop, m_tempMaxM1);
   if(copied1<=0)
   {
      Print("Unable to copy the maximums. Error = ",GetLastError());
      return -1;
   }
   for(int i=0; i< copied1; i++)
   {
      if(m_tempMaxM1[i]<0.0001) {
         Print("no data ready");
         return -1;
      }
   }

   ResetLastError();
   int copied2 = CopyBuffer(m_handle_MinMaxM1,1,start, stop, m_tempMinM1);
   if(copied2 != copied1)
   {
      Print("Unable to copy the minimums. Error = ",GetLastError());
      return -1;
   }
  

the first time the EA get correctly the data from the indicator but then, when from EA I try to get other data, it stops to work.

I tried to use iFractal in place of iCustom and my EA code works well. So I thought that the problem is in the indicator code but if I copy and paste the iFractal code in the MinMax file and then I use iFractal by iCustom I get the same behaviour. It doesn't work properly!!! It works only the first time the EA call the indicator Data.

Can someone help me? It seams an iCustom() bug


I attached all the code...

Files:
MaxMin.mq5 7 kb
Roberto Jacobs
48859
Roberto Jacobs  
ScienziatoBesti:

Hi,

I slightly modified the iFractal indicator and I called the new one MaxMin. It seems to work properly but some problems arrive when I try to use it in an EA.

I call it with the function

and I get the data from it with this code

the first time the EA get correctly the data from the indicator but then, when from EA I try to get other data, it stops to work.

I tried to use iFractal in place of iCustom and my EA code works well. So I thought that the problem is in the indicator code but if I copy and paste the iFractal code in the MinMax file and then I use iFractal by iCustom I get the same behaviour. It doesn't work properly!!! It works only the first time the EA call the indicator Data.

Can someone help me? It seams an iCustom() bug


I attached all the code...

I think this is not a iCustom bug.


 if((m_handle_MinMaxM1=iCustom(NULL, PERIOD_M1, "MyIndicators\\MaxMin.ex5", MinMax_nBar) )==INVALID_HANDLE)
   {
      printf("Error creating MinMax indicator");
      return(false);
   }
//--  what is MinMax_nBar? This is supposed to be part of input parameter of a custom indicator

ScienziatoBesti
13
ScienziatoBesti  
Thanks for you reply. I confirm it is NOT a bug. I was wrong. The problem was in my indicator... thank you
To add comments, please log in or register