CopyBuffer can't catch the data?

 


Does anyone know why, CopyBuffer can't catch the data? (CopyBuffer returns -1, I use GetLastError to check the error code is 4806)


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

int OnInit()
{
Handle_ATR=iATR(_Symbol,PERIOD_D1, 1);
}
int OnCalculate(......)
{
  CopyBuffer(Handle_ATR,0,0, 1, atr);
}

Documentation on MQL5: Checkup / GetLastError
Documentation on MQL5: Checkup / GetLastError
  • www.mql5.com
Checkup / GetLastError - Reference on algorithmic/automated trading language for MetaTrader 5
 
Kevin Z :


Does anyone know why, CopyBuffer can't catch the data? (CopyBuffer returns -1, I use GetLastError to check the error code is 4806)


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Example: getting iATR data from a custom indicator.

Documentation on MQL5: Technical Indicators / iATR
Documentation on MQL5: Technical Indicators / iATR
  • www.mql5.com
//|                                                    Demo_iATR.mq5 | //|                        Copyright 2011, MetaQuotes Software Corp. | //|                                              https://www.mql5.com | "The method of creation of the handle is set through the 'type' parameter (function type...
Reason: