Discussion of article "Graphical interfaces X: Advanced management of lists and tables. Code optimization (build 7)" - page 3

 

Tol, I realise that this is not the right topic, but since the latest update....

In general: I noticed it a long time ago, but I was waiting for this update to come out (in case it will be fixed, but no...).

If there is a window with a chart (CStandartChart), and there is a window located on top of the subgraph, then, if the connection with the server is lost, and then restored, the object-graph becomes higher than the other windows.

It would be necessary to redraw the topmost window somehow. It is clear that you can track this in your CProgram, but it seems to me that the library should do such things.

(It slows down a lot, but this is probably due to real-time recording).


 
Artyom Trishkin:

...

If there is a window with a chart (CStandartChart), and there is a window located on top of the sub-graph, then if the connection with the server is lost and then restored, the chart object becomes higher than the other windows.

It would be necessary to redraw the topmost window somehow. It is clear that you can track this in your CProgram, but it seems to me that the library should do such things.

(It slows down a lot, but that's probably because of real-time recording).

Ok, thanks for the message. Haven't tested with disconnecting/reconnecting yet. I'll see what I can do.

Why are the brakes so bad? What programme is used to record with? It's very slow. It looks as if the processor is 100% loaded? I tried recording with Fast Stone Capture and actively using the GUI in the MQL application. Everything is normal, nothing slows down like that.

 
Anatoli Kazharski:

Okay, thanks for the message. Haven't tested with disconnecting/reconnecting yet. I'll see what I can do.

What's with the slowdowns? What programme is being used to record with? It's very slow. It looks as if the processor is 100% loaded? I tried recording with Fast Stone Capture and actively using the GUI in the MQL application. Everything is fine, nothing slows down like that.

Free version of oCam. But I, by the way, without real-time recording it slows down too. There are a lot of objects. And in the timer you have to scan many symbols for price crossing levels, which for each symbol - its own, respectively, and the list of symbols is dynamic, and it also needs to be monitored for changes. One thing is good - after the update I didn't have to redo it like last time ;))).
 

Artyom Trishkin:
...

But by the way, I am also slowing down without realtime recording.

There are a lot of objects.

And the timer has to scan many symbols for price crossing levels, which are different for each symbol, and the list of symbols is dynamic, and it also needs to be monitored for changes.

...
And with what frequency are these checks done?
 
Anatoli Kazharski:
And at what frequency are these checks done?

Timer:

//+------------------------------------------------------------------+
//| Timer|
//+------------------------------------------------------------------+
void CProgram::OnTimerEvent(void)
  {
   CWndEvents::OnTimerEvent();
//---
   static int count=0;
   if(count<500)
     {
      count+=TIMER_STEP_MSC;
      return;
     }
//--- Zero the counter
   count=0;
//--- Catch the change in the Market Watch
   if(IsChangeSymbolListInMW()) {
      UpdateAllDataAndTables();
      }
//--- Catch the appearance of new bars
   bool need_update=false;
   for(int i=0; i<ArraySize(m_array_new_bar); i++) {
      if(m_array_new_bar[i].isNewBar()>0) {
         string sy=m_array_new_bar[i].GetSymbol();
         ENUM_TIMEFRAMES timeframe=m_array_new_bar[i].GetPeriod();
         Print("New Bar.",sy," on ",GetNameTF(timeframe));
         if(timeframe==PERIOD_D1) {
            for(int j=0; j<ArraySize(m_array_symbols_new_sig_d1); j++) delete m_array_symbols_new_sig_d1[j].symbol_tick;
            ZeroMemory(m_array_symbols_new_sig_d1);
            }
         if(timeframe==PERIOD_W1) {
            for(int j=0; j<ArraySize(m_array_symbols_new_sig_w1); j++) delete m_array_symbols_new_sig_w1[j].symbol_tick;
            ZeroMemory(m_array_symbols_new_sig_w1);
            }
         if(timeframe==PERIOD_MN1) {
            for(int j=0; j<ArraySize(m_array_symbols_new_sig_mn); j++) delete m_array_symbols_new_sig_mn[j].symbol_tick;
            ZeroMemory(m_array_symbols_new_sig_mn);
            }
         need_update=true;
         }
      }
   if(need_update) {
      UpdateAllDataAndTables();
      }
//--- Changing the value texts in the main window
   short row=(short)m_table_base_symbol_list.SelectedItem();
   ChangeTextData(row);

//--- Looking for notification criteria D1, W1, MN1
   GetNotify(m_sorted_struct_symbols_d1,m_array_symbols_new_sig_d1,PERIOD_D1);
   GetNotify(m_sorted_struct_symbols_w1,m_array_symbols_new_sig_w1,PERIOD_W1);
   GetNotify(m_sorted_struct_symbols_mn,m_array_symbols_new_sig_mn,PERIOD_MN1);
//--- Redraw the graph
   m_chart.Redraw();
  }
//+------------------------------------------------------------------+
Timer step (TIMER_STEP_MSC) 16
 
Artyom Trishkin:

Timer:

...
timer step (TIMER_STEP_MSC) 16

Is it necessary to do this kind of condition checking exactly in the timer?

If in the timer, why so often?

You can try to reduce the step and set a different interval for each group of conditions. I added the CTimeCounter class for this purpose. Read the article again to understand how to use this. Section: Application for item test

 
Anatoli Kazharski:

Is it necessary to check conditions of this kind in the timer?

If in the timer, why so often?

You can try to reduce the step and set a different interval for each group of conditions. I added the CTimeCounter class for this purpose. Read the article again to understand how to use this. Section: item test application

Yes, I'm already thinking about this.

Checking for a new bar can be done less often, of course - it's not critical. But the check for prices crossing levels on some symbols (their list changes dynamically, respectively, and instances of the class of working with ticks are dynamically added/removed) should be done often enough to be able to determine the facts of crossings in time.

When I read that it is now possible to have a different interval for different events, I immediately thought of such a need.

 
Artyom Trishkin:

... But the check for crossing by prices of levels on some symbols (their list changes dynamically, respectively, and instances of the class of working with ticks are dynamically added/removed) should be done often enough to be able to determine the facts of crossings in time.

So, if you work with ticks, it is better to do these checks in OnTick(). Why should the timer be chiselled every 16 ms?
 
Anatoli Kazharski:
So, if you work with ticks, it is better to make these checks in OnTick(). Why should the timer be chiselled every 16 ms?
It's multicurrency. What OnTick()?
 
Artyom Trishkin:
It's multicurrency. What OnTick()?

Through events, then. But not through a timer with such a frequency. In general, the brakes are on your side, not on the library's or video recording's side. I have no more questions.