Table of all trades. Accessed via MQL5 - page 5

 
prostotrader:

Here in my code is the prevention of duplication:

Well then :) there is a loss of ticks in your code.
 
Yury Kulikov:
Well then :) there's a loss of ticks in your code.

:) but for some reason they're redundant :)

Thank you very much Yuri, I'll look into it now.

 

Indeed, when switching to COPY_TICKS_TRADE - the error of ticks mixing disappeared, but at the same time in COPY_TICKS_TRADE mode the flags cannot be received

  • TICK_FLAG_BUY - a tick occurred as a result of a buy deal
  • TICK_FLAG_SELL - tick occurred as a result of a sell deal

 
Karputov Vladimir:

Indeed, when switching to COPY_TICKS_TRADE - the error of ticks mixing disappeared, but at the same time in COPY_TICKS_TRADE mode the flags cannot be received

  • TICK_FLAG_BUY - a tick occurred as a result of a buy deal
  • TICK_FLAG_SELL - tick occurred as a result of a sell deal

Flags come as a result of a real trade (I am testing it on a real account)
 
Yury Kulikov:
Well, then :) there is a loss of ticks in your code.

Yuri, try my indicator (look closely)

I wait for ticks to appear, rather than watching them in the history.

I copy each time, before new ticks appear.

int copied=CopyTicks(Symbol(),ticks,COPY_TICKS_TRADE,start_time,0);

"0" is how many ticks have reappeared.

If copied = 0, there are no new ticks.

If we remove this "support".

if(start_time==ulong(ticks[copied-1].time_msc)) return;

then there will definitely be a duplication.

The task is not to view the tick history, but to display the tick feed in real time.

 
prostotrader:
On the real the flags come in (I'm testing on the real right now)

Yes, that's right. I got confused withCOPY_TICKS_INFO.

Added:

nevertheless, in COPY_TICKS_ALL mode the ticks, some, arrive in a jumbled order.

 
prostotrader:

Yuri, try my indicator (look carefully)

There are too many letters in your code :)

The algorithm is simple. In OnCalculate() look at the actual volume, if it has changed, then load the last ticks, remember how many ticks were at the last moment (the same value time_msc), so that the next call CopyTicks() to cut off these ticks from the calculation.

 
Yury Kulikov:

There are too many letters in your code :)

Algorithm is simple. In OnCalculate() look real volume, if it has changed, then load last ticks, remember how many ticks were at the last moment of time (the same value time_msc), so the next call CopyTicks() exclude these ticks from the calculation.

Thanks, I think I know how to solve the problem...
 
Yury Kulikov:

There are too many letters in your code :)

Algorithm is simple. In OnCalculate () look at the actual volume, if it has changed, you download the last ticks, and remember how many ticks were at the last moment (the same value time_msc), so the next call CopyTicks () exclude these ticks from the calculation.

Yuri, thanks again very much for the competent advice.

I did everything and it works perfectly, but for more than 3 hours there is no situation which

I described :)

 

Well, finally! It worked!

Everything is correct and the ticks are no longer duplicated or lost.

The demo is in the ZIP-file, and if you want to check it yourself, the debug-version is in the basement.

Files: