Testing 'CopyTicks' - page 45

 

Found a loss of TICK_FLAG_BUY, TICK_FLAG_SELL flags in MQLTick structure when copying ticks from custom symbol with CopyTicks(...) function.

From RTS-6.20 symbol exported ticks for this year to CSV file. Create MyRTS-6.20 symbol by copying from RTS-6.20. Loaded to it ticks from CSV file. It seems to be a duplicate. Everything is good with its chart.

But CopyTicks(...).




Used fxsaber script

 
Sealdo Сергей:

Found a loss of TICK_FLAG_BUY, TICK_FLAG_SELL flags in MQLTick structure when copying ticks from custom symbol with CopyTicks(...) function.

From RTS-6.20 symbol exported ticks for this year to CSV file. Create MyRTS-6.20 symbol by copying from RTS-6.20. Loaded to it ticks from CSV file. It seems to be a duplicate. All is good with its chart.

Fixed in beta 2414.

Now exported to CSV and imported with flag column.

 

I have another dumb question: does MT determine the deal direction (writing BUY/SELL in MqlTick.flags) by analyzing the tick data itself, or it getsthe deal direction from the data source?

 
Sealdo Сергей:

I have another dumb question: does MT determine the direction of deals (writing BUY/SELL in MqlTick.flags) by analyzing the tick data itself, or it gets the deal direction from the data source?

From the source.

It all depends on the datafeed, which may set flags itself.

 
MetaQuotes:

From the source.

It all depends on the datafeed, which can also flag itself.

In order not to depend on the source, it is better to organise local logic for flagging.

(Last == Ask ? TICK_FLAG_BUY : TICK_FLAG_SELL);

This way any datafeed will be edible, no matter whether it has trade direction or not.
This will solve the problem of strategy tester for exchange execution.
This means that it will be possible to expand the tick history structure for exchange instruments.
By extending the tick history structure, it will be possible to organise exchange execution in the strategy tester.
We need a real exchange tester!

 

With this kind of program logic, I think there will be quite a few bugs >>>


 
Sealdo Сергей:

With this kind of program logic, I think there will be quite a few bugs >>>

What kind of errors?
I think this will solve the problem of wrong trades rendering like on your screenshot, which don't correspond to offers and bids at all.
By the way, I saw the same problem in TcLab, it seems to me that this is because they are different data channels.
Trades go in their socket, offerer/bid in another socket. Trades have to be on the offer/bid lines and nothing else.
Just a local comparison

(Last == Ask ? TICK_FLAG_BUY : TICK_FLAG_SELL)

will synchronize both data channels, passed trades and offer/bid, and possibly eliminate this defect you mentioned.

There is also the undefined state of counter transactions N/A.
For these too we need to consider the state of the flags.

Checked it out on a CME instrument.
Just counter transactions N/A are not drawn by offer/bid.
But they are drawn inside the spread (green circle), which is correct.
The rest of the trades are strictly on the offer/bid.
You have an instrument from Mos. Exchange, perhaps it is counter transactions which do not fall in the spread, but why they are outside the spread, which is not correct.
So it's not counter trades but directed trades that have a direction.
And as I understand from other discussions, the MT5 terminal does not display counter orders on Mos. Exchange.
Maybe this is the problem of incorrect drawing of past trades.


 
Hi all!!! Can you tell me if it's possible to load quotes history in mt5? I've been looking for info for 2 days but can't find it
 
Igorz2006:
Hi all! Can you tell me, is it possible to load a quotes history in mt5? I've been searching for it for 2 days, but can't find it.

Receiving ticks:

CopyTicks

Gets ticks to an array in MqlTick format

CopyTicksRange

Gets ticks in an array within the specified date range

Документация по MQL5: Доступ к таймсериям и индикаторам / CopyTicks
Документация по MQL5: Доступ к таймсериям и индикаторам / CopyTicks
  • www.mql5.com
[in]  Количество запрашиваемых тиков. Если параметры from и count не указаны, то в массив ticks_array[] будут записаны все доступные последние тики, но не более 2000. Первый вызов CopyTicks() инициирует синхронизацию базы тиков, хранящихся на жёстком диске по данному символу. Если тиков в локальной базе не хватает, то недостающие тики...
 
Thanks, I'll look into it