Chart stops processing new events and ticks. Does anyone know what might be happening? - page 2

 
Jeepack #:Yeah that seems to confirm what I was thinking. I couldn't find any other reason why my charts would freeze. I'm rewriting everything to remove most of the object queries by placing all the code in one EA instead of an EA and an indicator. This should also result in all events being on the same thread. I don't know if this will help but I'm pretty optimistic since I know my code could be much more efficient if I coded it this way.
Yes, I also agree that if you can code all the indicator calculations in the EA in a more efficient way, especially if it can be reduced to incremental calculations, then it will reduce memory usage and improve the speed.
 
Fernando Carreiro #:
Yes, I also agree that if you can code all the indicator calculations in the EA in a more efficient way, especially if it can be reduced to incremental calculations, then it will reduce memory usage and improve the speed.

The indicator doesn't do any calculations based on price history, it's just a tool to manage/create orders through manually adjusted graphical objects. So there was never a good reason not to incorporate all the code in the EA other than that's how I started and after I realized it was stupid I didn't want to have to start over.

By the way I still remember the time you told me about how you run all indicator calculations in your EA's and use incremental calculations to be more efficient. That's why I now use ring buffers (or arrays that imitate ring buffers) when analysing historical data and I don't regret making the change; it turns out to be simpler than I thought but I might not have tried it if you hadn't given me the advice so thanks!

 
Same thing happening to me sometimes.  I don't use OnTimer() events.  I use OnchartEvent() occasionally.  I also use Global Variables and a shared data file (built-in mutex: EAs can open it for reading and writing one at a time only.  It took me several days to figure out what caused a permanent lock sometimes - because I forgot to close the file handle at a certain point in the code where I didn't think the program could reach anyway.  It did.  Anyway, I've corrected this bug.) for information exchange between EAs.  I hope I don't have to completely restructure my code because it reached a state where it is a) getting a little bit complicated b) it seems to be working as it should.  Except for the lack of new ticks sometimes.