Custom symbols. Errors, bugs, questions, suggestions. - page 33

 
RusPro #:

I tried your test, it's exactly the same - lags by a couple of seconds. not on custom, but on silver futures

Instrument Silv-12.21. MICEX, broker BCS. But I think it doesn't matter.

But in your case it is possible that the chart is built not on bids, or that the broker has different quote and trade streams (although, on the exchange - unlikely).

The topic here is about custom instruments.

 
Andrey Khatimlianskii #:

We didn't talk about ordinary tools, we talked about castum. By definition, all the information on them is available in the terminal, nothing should go to the server.

Maybe there is some nonsense there - like server time request or something. In general, it is a blunder. And if you run a test if there is no physical connection, what will happen? I'm curious, but I don't have anything to test it on.

 

Hi all!
For some reason the story is not being copied into the custom symbol. The code is the simplest. I don't get any errors, but there are no quotes in the custom symbol.

I just want to transfer the real quotes with 1 hour offset to the custom symbol.

Can you tell me why the result is empty?
Thank you.


int OnInit()
  {
   
   string Sym1 = "EURUSD"; /// источник
   string Sym2 = "EURUSD2";   /// приемник
   int HBack = 1;   /// количество часов сдвига
   datetime tc = StringToTime(TimeCurrent());   /// конец участка
   datetime sht = tc - HBack * 60 * 60;
   datetime sht2 = tc - 2 * HBack * 60 * 60;
   
   MqlRates mrates[];
   
   if( CopyRates(Sym1, PERIOD_M1, sht, tc, mrates) < 0 ){
        
        Alert("Ошибка копирования исторических данных - ошибка:", GetLastError() );
        return(INIT_FAILED);
        
        }
        
   if( CustomRatesReplace(Sym2, sht2, sht, mrates, WHOLE_ARRAY) < 0 ){
      
      Alert("Ошибка вставки исторических данных - ошибка:", GetLastError() );
        return(INIT_FAILED);
        
        }
      
   
   return(INIT_SUCCEEDED);
  }
 

SymbolInfoXXX is lagging relentlessly compared to iClose:

custom symbol quotes (both ticks and bars).

I have found thatSymbolInfoDouble and SymbolInfoTick, that are called in EA, working on this chart, at some moment"hang": in market overview the quotes change, chart is updated, iClose and CopyTicksRange get actual data, but SymbolInfoXXX gives outdated information.

In the process of parsing it came to the simplest code, which was intended to detect these "hangs", but much earlier demonstrated the problem from the other side:SymbolInfoXXX is simply lagging relentlessly compared to iClose! You can see it with the naked eye:


Run such an EA on your castum chart, please:

int OnInit(void)
{
        EventSetMillisecondTimer(10);
        return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason)
{
        EventKillTimer();
        Comment("");
}

void OnTimer(void)
{
        MqlTick tick;
        SymbolInfoTick( _Symbol, tick );

        Comment( "SymbolInfoInteger( _Symbol, SYMBOL_TIME ) = ", TimeToString( SymbolInfoInteger( _Symbol, SYMBOL_TIME ), TIME_SECONDS ),
                                        "\nSymbolInfoDouble( _Symbol, SYMBOL_BID ) = ", SymbolInfoDouble( _Symbol, SYMBOL_BID ),
                                        "\ntick.time = ", TimeToString( tick.time, TIME_SECONDS ),
                                        "\ntick.bid = ", tick.bid,
                                        "\niClose[0] = ", iClose( _Symbol, PERIOD_CURRENT, 0 ) );
}

(OnTimer can be changed to OnTick, it does not change the essence)

Do you have similar lags?


 
Andrey Khatimlianskii #:

Run an EA like this on your castaway chart, please:

Do you have similar brakes?

On a custom symbol that does not update and does not have a tick in Market Watch, no brakes are felt.

 
MOZART09 the custom symbol. The code is the simplest.

You can't create a custom symbol with the simplest code. There's a lot of tinkering involved. Check this out.

Пользовательские символы: основы применения на практике
Пользовательские символы: основы применения на практике
  • www.mql5.com
Статья посвящена программной генерации пользовательских символов, с помощью которых демонстрируется несколько популярных способов отображения котировок. Предложен вариант малоинвазивной адаптации советников для торговли реальным символом с графика производного пользовательского символа. Исходные коды MQL прилагаются.
 
fxsaber #:

On a custom symbol that doesn't update and doesn't have a tick in Market Watch, I don't feel the brakes.

Probably because the brakes are precisely in the update (or rather in the receipt of updated information by the EA running on such a chart)?

 
Andrey Khatimlianskii #:

Probably because it's the updating (or rather getting updated information from an EA running on such a chart) that's slowing things down?

I don't use updatable custom symbols, so not aware of it.

 

Build 3091, caught hanging quotes (click):


Last tick returned by SymbolInfoDouble and SymbolInfoTick is 04:52:07 (bid 61083.19)

At the same time newer ticks are in the instrument history, chart and marketwatch are updated, iClose returns the correct value.

There is a code to reproduce it. What else do I need to fix?

 

I found a dependence - only the instruments on which the charts were open (and the EA was running to track them, respectively) froze.

If I change the chart instrument to another one (also castrum, but not active so far), everything is OK there. If we return to a "frozen" instrument, or open a new chart for it, there SymbolInfoDouble and SymbolInfoTick are still in the same frozen state.