CIdicator::GetData:Invalid buffer

 

when i run my strategy tester i have in the journal :

CIdicator::GetData:Invalid buffer

please can you help me

thanks 

 
danjeu:

when i run my strategy tester i have in the journal :

CIdicator::GetData:Invalid buffer

please can you help me

thanks 

It can help if we see the code...
 
angevoyageur:
It can help if we see the code...
 

my program use  the cross of  2 ma (mode EMA and SMA)

there is no error of compilations and it run but don't make any  trades and in the journal  i have CIdicator::GetData:Invalid buffer

 can you help me

thanks 

Files:
MA_CROISE.mqh  12 kb
cccc.mq5  7 kb
 
danjeu:

my program use  the cross of  2 ma (mode EMA and SMA)

there is no error of compilations and it run but don't make any  trades and in the journal  i have CIdicator::GetData:Invalid buffer

 can you help me

thanks 

The error occurs when getting value of slow_ma, fast_ma is ok. But I don't found why...not yet.

Done. Attached is your MA_CROISE.mqh corrected. When you copy & paste code, don't forget to replace all occurrences of variable's name.

//+------------------------------------------------------------------+
//| Creates the "Slow MA" indicator                                  |
//+------------------------------------------------------------------+
bool  MA_CROISE::CreateSlowMA(CIndicators *indicators)
  {
//--- Checking the pointer
   if(indicators==NULL) return(false);
//--- Adding an object to the collection
   if(!indicators.Add(GetPointer(m_slow_ma)))
     {
      printf(__FUNCTION__+": Error adding an object of the slow MA");
      return(false);
     }
//--- Setting parameters of the slow MA
   MqlParam parameters[4];
//---
   parameters[0].type=TYPE_STRING;
   parameters[0].string_value="Examples\\Custom Moving Average.ex5";
   parameters[1].type=TYPE_INT;
   parameters[1].integer_value=m_period_slow;      // Period
   parameters[2].type=TYPE_INT;
   parameters[2].integer_value=0;                  // Shift
   parameters[3].type=TYPE_INT;
   parameters[3].integer_value=m_method_slow;      // Averaging method
//--- Object initialization  
   if(!m_fast_ma m_slow_ma.Create(m_symbol.Name(),m_period,IND_CUSTOM,4,parameters))
     {
      printf(__FUNCTION__+": Error initializing the object of the fast MA");
      return(false);
     }
//--- Number of buffers
   if(!m_fast_ma m_slow_ma.NumBuffers(1)) return(false);
//--- Reached this part, so the function was successful, return true

   return(true);
  }
Files:
MA_CROISE.mqh  12 kb
 
angevoyageur:

The error occurs when getting value of slow_ma, fast_ma is ok. But I don't found why...not yet.

Done. Attached is your MA_CROISE.mqh corrected. When you copy & paste code, don't forget to replace all occurrences of variable's name.

 

angevoyageur:

The error occurs when getting value of slow_ma, fast_ma is ok. But I don't found why...not yet.

Done. Attached is your MA_CROISE.mqh corrected. When you copy & paste code, don't forget to replace all occurrences of variable's name.

 Great!  Thank you.

 

Reason: