EA stops working after "WAITING FOR UPDATE" message... need help!

 

Sometimes you have these instances when the chart completely disappears and you see this message in huge letters:

"WAITING FOR UPDATE".

The problem is every time it happens, when the chart does re-appear, my EA seems to stop working for some unknown reason.

There are no error messages or anything. It just doesn't do what it's supposed to do. As if the 'start()' function isn't firing.

I'm trying to get to the bottom of this problem and have some possible leads as to what might be causing it.

Does anyone here know if after "WAITING FOR UPDATE" message, the special function 'init()' fires again?

Thanks!

 
Are you using any offline charts ? or just the standard data ?
 
No, just the standard chart data!
 
nanquan:

"WAITING FOR UPDATE".

The problem is every time it happens, when the chart does re-appear, my EA seems to stop working for some unknown reason.

Happens sometimes. The EA stops working because the chart has stopped working.

According to IBFX, open market watch (control-m) drag the symbol to the chart. Init() probably would fire.

 

When you said Init() would probably fire, did you mean if I followed your method and attached the symbol to the chart manually, or simply allowed it to re-appear on it's own?

Would init() fire in both cases?

This is very important for me to know for certain as it could cause a conflict in the data if init() misfired again in my EA and thus could explain this problem!

 
  1. I don't believe it ever comes back on 'it's own'
  2. How should I know. test it and find out.
  3. If a re-init causes a conflict, then your code is broken. Exactly the same as if you change timeframes and change back.
 
WHRoeder:
  1. I don't believe it ever comes back on 'it's own'
  2. How should I know. test it and find out.
  3. If a re-init causes a conflict, then your code is broken. Exactly the same as if you change timeframes and change back.

1. That's exactly what happens. Perhaps I wasn't clear in describing this phenomena. I was referring to when you get a message on the chart saying "WAITING FOR UPDATE" for maybe 1-2 seconds, and then the chart returns to normal and displays the bars again without you having to do anything.

2. I assumed perhaps you did. How should I have known that you didn't had I not asked? And as for testing it out myself, it's kind of hard doing that when you can't really replicate the situation on demand. This happens very rarely on occasion, so to try and debug it by waiting for it to randomly happen would take a very very long time.

3. My code is not broken, rather my EA is designed to work only on the M1 time frame, therefor I saw no use *adapting* it to go between M1...D1 time frames. My init() function does an analysis of the market and pre-populates several arrays with market analysis information. After the initial historic analysis is made in init(), function start() picks up from there and analyzes one bar at a time. If init() were to re-run it would throw off the whole array, and so I suspect that's what might be causing this problem. I guess I'll implement a mechanism to search through the array and prevent re-population if it's already populated.

Thanks anyway!

 
Init MUST return within 2 seconds. When Init is running the chart is not yet set up. You may not have any history. Do the Analysis on the first tick in start. Your code is likely the cause of your problem.
 
WHRoeder:
Init MUST return within 2 seconds. When Init is running the chart is not yet set up. You may not have any history. Do the Analysis on the first tick in start. Your code is likely the cause of your problem.
Yeah I was thinking about doing that analysis in the start()... perhaps I will try that now, thanks.
 

Check Window handle on init() &/ start(), it may usefull

int chart_handle; // global one

if (chart_handle == 0) 
   {
   chart_handle = WindowHandle(Symbol(),Period());
   }
if (chart_handle == 0) 
   {
   Print (" Doh ");
   return(0);
   }

:D

 
Unnecessary and possibly unreliable. Don't over complicate things.
bool firstTick;
int init(){ firstTick = true; ... }
int start(){
   if (firstTick){ firstTick = false; ... }
   :
}
Reason: