Not easy to say what the problem is without the full code or a reproducible example. This error occurs when you try to access an object from a NULL pointer. Take this example:
CExampleClass* cls; cls.DoSomething();
In this case, cls is not initialized and contains a NULL pointer. Trying to access the object will just fail. The correct way to do it would be like this:
CExampleClass* cls; // assuming this is a global variable int OnInit() { cls = new CExampleClass; cls.DoSomething(); return INIT_SUCCEEDED; } void OnDeinit(const int reason) { delete cls; }
Considering this, I'll assume the error lays in this line:
MyButton *b = (MyButton*)m_buttons.At(i);
If m_buttons is an array of buttons, check if the CButton at the index i is a NULL pointer (m_buttons.At(i) == NULL) and initialize it properly. Also, always remember to delete every object initialized with new (every element of arrays that contains pointers should be deleted) to avoid memory leaks.
If the error is not on the mentioned line, please provide more information (like a bit more of the code, the line where the error occurs, etc.).
Good day.
I have a code panel now this panel works fine but when I change chart or Time frame I get an error (Invalid Pointer Access )
this is my Class
Look at the line where the error is located and send us the whole code eg. everything inside OnInit or DeInit etc wherever the problem is....This snippet has an error at cls initialization, but there may be more errors because of this and sometimes fixing one problem, causes others. If you experience any, send the source code or part of the code so we can take a look but its hard to work off a small snippet like this as we do not know what the rest looks like

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a code panel now this panel works fine but when I change chart or Time frame I get an error (Invalid Pointer Access )
this is my Class