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.
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?
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:
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.
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!
I change to this , all is ok!
Thank you for the message, bug has been fixed, wait for upgrade