How to find error, when GetErrorCode returns 0!!!
double CiPivots::GetIndexPivots(int pBuffer,int pIndex) { string vMethod = "[" + mSymbol + "," + EnumToString(mPivotTimeFrame) + "] " + __FUNCTION__; double arrayData[1]; // LOCAL STATIC BUFFER TO RETURN SINGLE INDEX VALUE if(CopyBuffer(mHandlePivots,pBuffer,pIndex,1,arrayData) == -1) { ResetLastError(); PrintFormat("%s: Error[#%i] getting iPivots for _buffer[#%i] value at Index[%i]",vMethod,GetLastError(),pBuffer,pIndex); return(0.00); } return(NormalizeDouble(arrayData[0],mDigits)); } // END Of method GetIndexPivots()
You are resetting error code to zero before printing.
Use code styler or manually fix indentation and it will be easier to spot potential problems.
You are resetting error code to zero before printing.
Use code styler or manually fix indentation and it will be easier to spot potential problems.
Thanks a lot @Drazen Penic
It was really a silly mistake by me.
I have moved ResetLastError() above if(CopyBuffer) and get the error code now.
Ragards
Hi
I have created an indicator class and when run it on a testing EA, following methods returns correct values:
However when I am using it in an another class it keeps returning error 0. I have checked there is no error of indicator handle (INVALID_HANDLE)
Any clues how can I find out what is going wrong!!!
Thanks in advance.