Download MetaTrader 5

Unhandled exception 0xC0000005

To add comments, please log in or register
raidsan
91
raidsan  

Error  when use example indicator OsMA:      when switch  the chart period,   there is a error  message print to output :   Unhandled exception 0xC0000005

It seems  come from the function call to  function SimpleMAOnBuffer  in including file MovingAverages.mqh,

What wrong with it?

I have some customer indicators also using function "SimpleMAOnBuffer",  there is stronge error ocur also when switch period of the chart, 

sometime the result value is complete wrong,  sometimes  it will get a output error message : Zero divide just at the location of the calling to function SimpleMAOnBuffer.

Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Chart Timeframes
  • www.mql5.com
Standard Constants, Enumerations and Structures / Chart Constants / Chart Timeframes - Documentation on MQL5
HongDi s& t development co.,ltd.
1603
hongbin fei  
ray :

Error  when use example indicator OsMA:      when switch  the chart period,   there is a error  message print to output :   Unhandled exception 0xC0000005

It seems  come from the function call to  function SimpleMAOnBuffer  in including file MovingAverages.mqh,

What wrong with it?

I have some customer indicators also using function "SimpleMAOnBuffer",  there is stronge error ocur also when switch period of the chart, 

sometime the result value is complete wrong,  sometimes  it will get a output error message : Zero divide just at the location of the calling to function SimpleMAOnBuffer.


Ray: 

   Do you mean 0xC00000005 is caused by Zero Divide? I have an indicator, just convert from MT4 to MT5, this error appear too, but I donot switch period at all, how to debug it? 

raidsan
91
raidsan  

0xC00000005 error is true,  "Zero Divide" is report by mistake.

I check the code again,  and found that is the folowing statement which cause the exception:


Include\MovingAverages.mqh:

   bool as_series_price=ArrayGetAsSeries(price);
   bool as_series_buffer=ArrayGetAsSeries(buffer);
   if(as_series_price)  ArraySetAsSeries(price,false);
   if(as_series_buffer) ArraySetAsSeries(buffer,false);

....

......

//--- restore as_series flags
   if(as_series_price)  ArraySetAsSeries(price,true);
   if(as_series_buffer) ArraySetAsSeries(buffer,true);


I comment the 6 lines and recompile, then no error ocurs while switching period.


HongDi s& t development co.,ltd.
1603
hongbin fei  

 

 After I test and test, I fount if I use this code, will cause 0xC00000005 error, but the first call is correct, when other function call more GetNextObjectName, will error appeared, 

oh, my god! 

 

string GetNextObjectName(string Prestr)

  {

   return (Prestr+DoubleToString(ObjectsTotal(0),0));

  }

 

 

I change to this , all is ok! 

 

string GetNextObjectName(string Prestr)
  {  string b=Prestr;  string a=DoubleToString(ObjectsTotal(0),0);
  StringAdd(b,a);
  return(b);

  }
Ilyas
1212
Ilyas  
ray :

0xC00000005 error is true,  "Zero Divide" is report by mistake.

I check the code again,  and found that is the folowing statement which cause the exception:


Include\MovingAverages.mqh:


I comment the 6 lines and recompile, then no error ocurs while switching period.


Thank you for the message, bug has been fixed, wait for upgrade


To add comments, please log in or register