CopyBuffer Error 4806

 
Hello to you.

I looked for solutions and tried them out, but I can't seem to fix the problem.

I created a first version which does not pose any problem, everything works. I add new handles and strategies without changing the code structure, just new entry and exit.

Certainly entering that I had before which works very well no longer works.


i use a TableHandles[] is correctly resize with all handle.

 my code simplify

#define  ADX 50;

OnInit(){
...
if(!initHandle()) return(INIT_FAILED); // All handle init in function bool  initHandle()
...
}
bool initHandle (){
....
TableHandles[ADX] = iCustom(_Symbol,15, "::Indicators\\ADX_v2.ex5", 50);
....
}
OnTick(){
...
LongEntrySignal40 = TransfoBuffer(ADX, 1, 1)
...
}
...
bool TransfoBuffer (uchar Index, int shift, int bufferIndex=0){
   double buffer[];
   if(!IndicatorValues(buffer, Index , 3, shift, true, bufferIndex)) return false;
   return BoolTransfoBuffer  (buffer);
}     
...
bool BoolTransfoBuffer(double &buffer[]){
   return (buffer[0] > buffer[1] && !DoublesEqual(buffer[0], buffer[1], false)) && (buffer[1] < buffer[2] && !DoublesEqual(buffer[1], buffer[2], false)); 
}
...
bool IndicatorValues(double& buffer[], uchar Index, int bars, int shift, bool doRounding=true, int bufferIndex=0){
   ResetLastError(); 
      if(CopyBuffer(TableHandles[Index], bufferIndex, shift, bars, buffer) < 0) {  // i have error.
         //--- if the copying fails, tell the error code 
         PrintFormat("Index %d + bufferIndex %d + shift %d + bars %d ,  error code %d", , Index, bufferIndex, shift, bars, GetLastError());  
         return(false); 
      }      
      return(true); 
}

I don't understand why my version has the bug when these lines of code are the same as in version 1 with ADX ... and in version 2 ADX does not work.

I guess it's the way MT5 function is giving me an error in its memory handling. I would like to find a solution to change my code so that there is no longer this problem.

Thank you in advance for taking your time to help me with this problem.

 

ERR_INDICATOR_DATA_NOT_FOUND

4806

Requested data not found


And how often do you get this error? Only at startup or at every tick?

 
Vladimir Karputov:

ERR_INDICATOR_DATA_NOT_FOUND

4806

Requested data not found


And how often do you get this error? Only at startup or at every tick?

It's every tick.

 
Anthony De Barros :

It's every tick.

It means either there is no indicator or you are creating it incorrectly.

In any case, you need a complete indicator and advisor code.

 
Vladimir Karputov:

It means either there is no indicator or you are creating it incorrectly.

In any case, you need a complete indicator and advisor code.

Yes but the scenario is that this code has just been completed by new entry / exit. The part that crashes does not pose a problem before this addition of signal.

I didn't change anything. As you can see I create the handle it looks to me correct.

In my opinion it is as if it does not fit well in my handle table, maybe there are too many? (over 300)

 
Up, always need help.
Reason: