How to refresh gui real-time in EA?

 

I have a problem - i have built a script with GUI that works well, and then I wanted to put it in my EA. The problem is that EA is refreshed every tick and on some symbols the difference betwen tick can take few to 30 secs.

So when i press "resize window" button i have to wait till it refreshes. I when I loop it, it works great, but it is just stuck in a loop. How to program a loop that would exit on new tick? Or does anyone has other ideas on the issue?

 

 

I guess it can work sparately trough script gfx menu sending commands to the EA by text file, but i would really like to have graphics build-in my EA.

 

example graphics 

 
OnChartEvent() with CHARTEVENT_OBJECT_CLICK
Or I something don't understand?
 
ALXIMIKS:
OnChartEvent() with CHARTEVENT_OBJECT_CLICK
Or I something don't understand?
Oh thanks. I just made permamenet loop with RefreshRates and checking if price changed (if so - leaving the loop), but i guess this method will be less CPU-occupying
Reason: