You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Again, did you try my two suggestions? At which point exactly does the freezing happen? It's probably possible to nail it down to one specific line. Is it inside the LabelCreate function? Or maybe the repetitive chart height check? ...
Also, it seems like you're showing only parts of the code here. Do I understand it correctly that you call "LabelInit" and therefore recreate the whole labels upon each call of OnCalculate or is it just once upon the first call? If so. it doesn't seem very efficient --> wouldn't it be sufficient to just change the label's text ( ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);) whenever needed?
yes i'll try your method then.
but the code i used for label creation is standard Metaquotes, so i think there is no error here. but it would be interesting to know where it comes from exactly and maybe find a way to fix it.
the Label Init code is the culprit, and i didn't use it every iteration of i, only at the beginning of the "MaxBars' check up (so once for every setting change). i also tried to put it in the OnInit() function but i got the same result (because the Init function is called at each setfile change anyway)
thanks for your reply
Jeff
ok i got rid of the culprit code, but later in my development i got the same issue : random freezes as i change parameters
i think it comes from pointers. I've removed ALL the "new" directives in my code and use spawns of a class instead of a pointer, which i don't really need.
i'll let you guys know how it works in the future after i've done further tests to see if it still freezes or not
instead of using
"CLASS* pointer = new CLASS();" i just use "CLASS session;" and "session.function()"
and YES i know how to use pointers thank you very much.
i've tried the "Profiling" method but it seems that the debugger closes rather than stay frozen, so i cannot use it to see where the error comes from
i'll let you know where it goes from here
Jeff
hmm ok the new code froze 1 min ago (the code without the pointers)
so that's not it.
can anyone help me if i post the code ? i'll prepare the smallest code possible
thanks
Jeff
hmm ok the new code froze 1 min ago (the code without the pointers)
so that's not it.
can anyone help me if i post the code ? i'll prepare the smallest code possible
thanks
Jeff
Yes I can try.
thank you for the offer (i'll use it if the error continues) but i think i found out why it's freezing and i'm a bit ashamed of it because it could seem obvious but i thought the compiler would warn me if there was this kind of problem (as it usually does)
the code was
and i replaced it with
which is obviously the right way to go. I thought i would not need the comparison because i thought SHCPrice_high would always be of size > 0 but apparently it does not
thanks for help guys
i wanted to clarify that this is NOT a MT5 bug as i initially thought, so i'm relieved
Jeff
ok i just put back the chart labels that i removed initially (as i thought this was the problem) just to see and it froze again (much quicker than for the other error)
so i don't know exactly what to do.
i'll prepare some code for you to check then (WITH the labels)
thanks
Jeff
Alain; i contacted you with the code
thanks so much for the help
Jeff
ok Thanks to Alain for helping me out finding what was wrong.
i finally got a stable indicator !
i fixed some array issues, i think i was trying to access some buffer of size zero which lead to pointer/memory issues that were making my MT5 freeze randomly.
i fixed the issue and restarted my PC (very important point)
and now it's stable (i've tested for hours now without issues)
so it's not a bug, and my confidence in MT5 has grown higher !
thanks for all those that helped
Jeff