Tiki in real time - page 6

 
Andrey Khatimlianskii:

Replace OnBookEvent in your code with OnTick, and compare the result.

You can't compare results :)

You need to run both EAs at the same time to compare results.

But I already know that it will be the same, BUT

but if I run OnTick(), there will sometimes be a delay in results,

i.e. not real time.

 
prostotrader:

You can't compare results :)

You have to run both EAs to compare results.

But I already know that it will be the same, BUT

only if it is OnTick(), there will be a delay in results,

i.e. not real time.

There won't be a delay. On the contrary, if you subscribe to many instruments to update the stack, OnTick may work faster. Don't be lazy to compare.

 
Andrey Khatimlianskii:

There will be no delay. On the contrary, if you subscribe to the stock updates on many instruments, OnTick may work faster. Don't be lazy to compare.

And why not subscribe to all the stakes that are possible?

You could come up with something else.

On a single tool with a single tick subscription, OnBookEvent() is triggered more often than OnTick().

2020.01.23 16:56:53.226	Ticks_test (GOLD-3.20,M1)	OnTick Tick is done!
2020.01.23 16:56:53.226	Ticks_test (GOLD-3.20,M1)	OnBookEvent Tick is done!
2020.01.23 16:56:53.712	Ticks_test (GOLD-3.20,M1)	OnTick Tick is done!
2020.01.23 16:56:53.712	Ticks_test (GOLD-3.20,M1)	OnBookEvent Tick is done!
2020.01.23 16:56:53.930	Ticks_test (GOLD-3.20,M1)	OnBookEvent Tick is done!
2020.01.23 16:56:53.996	Ticks_test (GOLD-3.20,M1)	OnTick Tick is done!
2020.01.23 16:56:53.996	Ticks_test (GOLD-3.20,M1)	OnBookEvent Tick is done!
2020.01.23 16:56:54.016	Ticks_test (GOLD-3.20,M1)	OnBookEvent Tick is done!
2020.01.23 16:56:54.280	Ticks_test (GOLD-3.20,M1)	OnBookEvent Tick is done!
2020.01.23 16:56:54.392	Ticks_test (GOLD-3.20,M1)	OnBookEvent Tick is done!

A new pack of ticks arrives - OnBookEvent() is triggered.

If you don't like my version, write your own.

By the way, the result is higher, with 84 tumblers signed on the real!

Added

Here is more

//+------------------------------------------------------------------+
//|                                                  Test_freeze.mq5 |
//|                                     Copyright 2018, prostotrader |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, prostotrader"
#property link      "https://www.mql5.com"
#property version   "1.00"
bool is_book;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
    //int fr_level = int(SymbolInfoInteger(Symbol(), SYMBOL_TRADE_FREEZE_LEVEL));
   // Print(__FUNCTION__, ": ", Symbol(), " Freeze level is ", fr_level);
   is_book = MarketBookAdd(Symbol());
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
  if(is_book == true) MarketBookRelease(Symbol());
}
//+------------------------------------------------------------------+
//| BookEvent function                                               |
//+------------------------------------------------------------------+
void OnTick()
{
  Print(__FUNCTION__, " Tick is done!");
}
//---
void OnBookEvent(const string &symbol)
{
  if(Symbol() == symbol)
  {
    Print(__FUNCTION__, " Tick is done!");
  }
}


2020.01.30 19:31:11.112 Test_freeze (BR-3.20,M1)        OnTick Tick is done!
2020.01.30 19:31:11.113 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.132 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.192 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.199 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.219 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.249 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.261 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.309 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.323 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.414 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.433 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.539 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.667 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.703 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.789 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.802 Test_freeze (BR-3.20,M1)        OnTick Tick is done!
2020.01.30 19:31:11.809 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.821 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.949 Test_freeze (BR-3.20,M1)        OnTick Tick is done!
2020.01.30 19:31:11.950 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.049 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.122 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.201 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.292 Test_freeze (BR-3.20,M1)        OnTick Tick is done!
2020.01.30 19:31:12.293 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.314 Test_freeze (BR-3.20,M1)        OnTick Tick is done!
2020.01.30 19:31:12.315 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.336 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.350 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.372 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.412 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.433 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.491 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.577 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.740 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.799 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.862 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:12.992 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!

Added

And let's call it a day!

You have only fantasies and assumptions, and

I have 7 years of experience in writing robots and successful trading on FORTS +

I have a concrete working code.

Как заказать торгового робота на MQL5 и MQL4
Как заказать торгового робота на MQL5 и MQL4
  • www.mql5.com
Главным преимуществом торговых терминалов MetaTrader является возможность создания автоматических торговых систем, способных совершать торговые операции без вмешательства трейдера, что позволяет исключить влияние психологии на результаты торговли. Для этого нужно сформулировать торговую стратегию и реализовать ее в виде программы на языке MQL...
 

There was an error in the code.

Posted with corrections on page 5

https://www.mql5.com/ru/forum/331060/page5#comment_14783678

Тики в реальном времени
Тики в реальном времени
  • 2020.01.30
  • www.mql5.com
Всем доброго времени суток. Появилась необходимость протестировать торговый алгоритм на реальных тиках брокера "Открытие...
 
prostotrader:

Why not sign up for all the tumblers that are possible?

You can think of something else.

On one tool with a single glass subscription, OnBookEvent() is triggered more often than OnTick()

What difference does it make how many OnBookEvent events come in? You stated that when it receives ticks it will happen earlier than OnTick. And I suggested to check this, to output the time of receiving a tick there and there (just not in the same EA).


prostotrader:

And let's end it there!

You have only fantasies and assumptions, and

And I have 7 years of experience in writing robots and successful trading on FORTS +

I have a specific working code.

You have the aplomb that reverberates through all your messages. Why have you decided that FORTS can work only from OnBookEvent - only you know.

But respect for the code. When I find time, I will post mine. This is not a priority task.

 
Andrey Khatimlianskii:

What difference does it make how many OnBookEvent events arrive? You stated that when a tick is received in it, it will happen earlier than in OnTick. And I suggested you check it, output the timing of receiving a tick there and there (just not in the same EA).


You have an aplomb that reverberates through every post. Why have you decided that FORTS can work only from OnBookEvent - only you know.

But respect for the code. When I find time, I will post mine. This is not a priority task.

You can work through whatever you like!

I've posted my solution, based on my experience working on FORTS.

I would agree with you if I were to say that I was tooconfident in my behaviour, in my speech.

Would agree with you if I didn't have experience.

2020.01.30 19:31:11.112 Test_freeze (BR-3.20,M1)        OnTick Tick is done!
2020.01.30 19:31:11.113 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.132 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.192 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.199 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.219 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.249 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.261 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.309 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.323 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.414 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.433 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.539 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.667 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.703 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.789 Test_freeze (BR-3.20,M1)        OnBookEvent Tick is done!
2020.01.30 19:31:11.802 Test_freeze (BR-3.20,M1)        OnTick Tick is done!

Time of first OnTick()2020.01.30 19:31:11.112

Time of second OnTick()2020.01.30 19:31:11.802

That is, 690 ms have passed, meanwhile, between the OnTick() of these 690 ms

OnBookEvent() was triggered 15 times

Do you think these triggers have nothing to do with ticks?

Well, read the help for OnBookEvent()

События BookEvent никогда не пропускаются и всегда ставятся в очередь, даже если в данный момент еще не закончена обработка предыдущего события BookEvent.
При этом необходимо иметь в виду, что события BookEvent доставляются сами по себе и не несут с собой состояния стакана заявок.
Это означает, что вызов MarketBookGet() из обработчика OnBookEvent() позволяет получить текущее актуальное состояние стакана на момент вызова,
а не то состояние стакана, которое вызвало отправку события BookEvent.
Для гарантированного получения всех уникальных состояний стакана функция OnBookEvent() должна быть максимально быстрой. 

New tick batch arrives - OnBookEvent() is guaranteed to trigger - this provides opportunity to get the ticks in real time with CopyTicks().

While with OnTick() you can get only ticks from the history.

You receive them all and nothing is missing, but not in real time.

It's very strange that I have to explain all this in such detail to someone with a lot of experience.

Once again, everyone is free to choose the programming and trading methods they like!

Added

There is another important point that many people forget.

This is the speed at which the EA makes a decision by analyzing the input data.

Using OnBookEvent() instead of OnTick(), my EA will be faster than yours.

 
prostotrader:

Time of first OnTick()2020.01.30 19:31:11.112

time of second OnTick()2020.01.30 19:31:11.802

That is, 690 ms have passed, meanwhile, between the OnTick() of these 690 ms

OnBookEvent() was triggered 15 times

Do you think these triggers have nothing to do with ticks?

Please print out the values of the ticks as well. You can't see from the above log that OnBookEvent has caught a change in the MqlTick structure.

Putting SellLimit outside the spread will create an OnBookEvent event, but will not generate a trade or BestBid/BestAsk/BestVolume change. I.e. INFO and LAST tick tapes (CopyTicks history) will not be updated.

 
fxsaber:

Print out the tick values as well, please. The above log does not show that OnBookEvent caught the change of MqlTick structure.

If SellLimit is set outside the spread, it will create OnBookEvent event, but it will not generate a trade or BestBid/BestAsk/BestVolume change. I.e. INFO and LAST tick tapes (CopyTicks history) will not be updated.

Why print it out?

The first line of the OnBookEvent() description says

Вызывается в индикаторах и экспертах при наступлении события BookEvent.
Функция предназначена для обработки изменений стакана цен (Depth of Market).
 
prostotrader:

Why print it out?

The first line of OnBookEvent() description says

If you measure how many BookEvent events happen in an hour and how many records in CopyTicks, you can make a conclusion.

 
fxsaber:

If you measure how many BookEvent events occur per hour and how many entries in CopyTicks, you can deduce.

There is the code above, check it out for yourself.

There is a working code.

I believe it works in real time and certainly faster,

than OnTick().

What is the problem? Do this, do that...

You have to post your working code to prove or disprove something!

Reason: