How to decompose tick volume into buy and sell ticks?

 

hey folks, i pretty much read all forum entries regarding CopyTicks, TICK_FLAG_*, TickCounter functions etc. but I still struggle to understand what is going on there. I also could not find any Website clearly explaining that. Here is my code so far:

iVolumes(_Symbol,_Period,VOLUME_TICK);

   MqlTick TICKS[];

   // CopyTicks(_Symbol,TICKS,COPY_TICKS_TRADE,0,1); // THIS SLOWS DOWN BACKTESTER EXTREMELY

   // Print("TICKS LAST: ",TICKS[0].last); // RESULTS IN INDEX OUT OF ERROR
   

   MqlRates R[];

   CopyRates(_Symbol,_Period,1,1,R);

   ArraySetAsSeries(R,true);

   Print("R: ",R[0].tick_volume);

   Print("iVolume: ",iVolume(_Symbol,_Period,1));

   Print("iTIckVolume: ",iTickVolume(_Symbol,_Period,1));
   

   MqlTick tick;

   if(SymbolInfoTick(Symbol(),tick))
     {
      string s;
      
      Print("Tick.ask: ",tick.ask);
      Print("Tick.bid: ",tick.bid);
      Print("Tick.flags: ",tick.flags);
      Print("Tick.last: ",tick.last);
      Print("Tick.volume: ",tick.volume);
      Print("Tick.flags: ",tick.flags);
      
      Print("TICK_FLAG_BID: ",TICK_FLAG_BID);
      Print("TICK_FLAG_ASK: ",TICK_FLAG_ASK);
      Print("TICK_FLAG_LAST: ",TICK_FLAG_LAST);
      Print("TICK_FLAG_VOLUME: ",TICK_FLAG_VOLUME);
      Print("TICK_FLAG_BUY: ",TICK_FLAG_BUY);
      Print("TICK_FLAG_SELL: ",TICK_FLAG_SELL);

      if(tick.flags  &TICK_FLAG_BID)    s+="BID|";
      if(tick.flags & TICK_FLAG_ASK)    s+="ASK|";
      if(tick.flags & TICK_FLAG_LAST)   s+="LAST|";
      if(tick.flags & TICK_FLAG_VOLUME) s+="VOL|";
      if(tick.flags & TICK_FLAG_BUY)    s+="BUY|";
      if(tick.flags & TICK_FLAG_SELL)   s+="SELL|";

      Print(s);
     }

The code for EUR/USD results in:

2018.12.07 14:57:09.229 2018.07.16 00:00:05   R: 133
2018.12.07 14:57:09.229 2018.07.16 00:00:05   iVolume: 133
2018.12.07 14:57:09.229 2018.07.16 00:00:05   iTIckVolume: 133
2018.12.07 14:57:09.230 2018.07.16 00:00:05   Tick.ask: 1.16835
2018.12.07 14:57:09.230 2018.07.16 00:00:05   Tick.bid: 1.16831
2018.12.07 14:57:09.230 2018.07.16 00:00:05   Tick.flags: 130
2018.12.07 14:57:09.230 2018.07.16 00:00:05   Tick.last: 0.0
2018.12.07 14:57:09.230 2018.07.16 00:00:05   Tick.volume: 0
2018.12.07 14:57:09.230 2018.07.16 00:00:05   Tick.flags: 130
2018.12.07 14:57:09.230 2018.07.16 00:00:05   TICK_FLAG_BID: 2
2018.12.07 14:57:09.230 2018.07.16 00:00:05   TICK_FLAG_ASK: 4
2018.12.07 14:57:09.230 2018.07.16 00:00:05   TICK_FLAG_LAST: 8
2018.12.07 14:57:09.230 2018.07.16 00:00:05   TICK_FLAG_VOLUME: 16
2018.12.07 14:57:09.230 2018.07.16 00:00:05   TICK_FLAG_BUY: 32
2018.12.07 14:57:09.230 2018.07.16 00:00:05   TICK_FLAG_SELL: 64
2018.12.07 14:57:09.230 2018.07.16 00:00:05   BID|

The string s prints either BID| , ASK| or BID|ASK| but nothing else.


The code for any Index results in:

2018.12.07 14:56:05.972 2018.07.16 00:00:03   R: 60
2018.12.07 14:56:05.972 2018.07.16 00:00:03   iVolume: 60
2018.12.07 14:56:05.972 2018.07.16 00:00:03   iTIckVolume: 60
2018.12.07 14:56:05.972 2018.07.16 00:00:03   Tick.ask: 12592.12
2018.12.07 14:56:05.972 2018.07.16 00:00:03   Tick.bid: 12585.12
2018.12.07 14:56:05.972 2018.07.16 00:00:03   Tick.flags: 134
2018.12.07 14:56:05.972 2018.07.16 00:00:03   Tick.last: 0.0
2018.12.07 14:56:05.972 2018.07.16 00:00:03   Tick.volume: 0
2018.12.07 14:56:05.972 2018.07.16 00:00:03   Tick.flags: 134
2018.12.07 14:56:05.972 2018.07.16 00:00:03   TICK_FLAG_BID: 2
2018.12.07 14:56:05.972 2018.07.16 00:00:03   TICK_FLAG_ASK: 4
2018.12.07 14:56:05.972 2018.07.16 00:00:03   TICK_FLAG_LAST: 8
2018.12.07 14:56:05.972 2018.07.16 00:00:03   TICK_FLAG_VOLUME: 16
2018.12.07 14:56:05.972 2018.07.16 00:00:03   TICK_FLAG_BUY: 32
2018.12.07 14:56:05.972 2018.07.16 00:00:03   TICK_FLAG_SELL: 64
2018.12.07 14:56:05.972 2018.07.16 00:00:03   BID|ASK|

The string s prints Always BID|ASK|


The MQL5 Indicator 

iVolumes(_Symbol,_Period,VOLUME_TICK);

prints the Volume in the Backtester and as well R, iVolume and iTickVolume return all the same values. So that is fine!


What I want to achieve is to separate the Tick Volume for a Bar into the number of BUY and SELL ticks. So, for instance, a bar has 60 ticks, I want to know in how many BUY and SELL ticks it separates.

In this forum, I also found the following code to count the BUY and SELL ticks. However, I cannot use it as tick.last is Always 0. The same appears to tick.volume even though R, iVolume and iTickVolume return some Volumes.

//--- BEGIN CODE

MqlTick tick_array[]; 
int copied=CopyTicks(_Symbol,tick_array,COPY_TICKS_TRADE,0,10); 

// Latest loop
for(int i=copied-1;i>=0;i--) {
    char c = '?';    // Unknown                                 
    MqlTick tick = tick_array[i]; 

    if(tick.last <= tick.bid){
        c = 'S';    // SELL
    }else if(tick.last >= tick.ask){
        c = 'B';    // BUY
    }

     // the variable c has information aggression: BUYER, SELLER or Unknown.

        
}

// --- END CODE


What I know already is that tick.flags is a sum of different FLAGs. However the total sum of all flags is (64+32+16+8+4+2) 126. So what does it mean when tick.flag is 130 or 134 as seen in the output?

Print("Tick.flags: ",tick.flags);


As we can see there seem to exist to different Methods to count the number of SELL and BUY ticks:

1. Using Tick.Last and compare it to Tick.Buy and Tick.Sell

2. Use the TICK_FLAG_* Information 


However, I don't quite understand by now how to use the second method to separate the volume into BUY and SELL ticks.


I further do not understand why I only get the string BID| , ASK| and BID|ASK and Nothing for the volume and the BUY and SELL flag. I read that BUY and SELL Flag depends on the broker or on the market itself? I tested two different Brokers, JDF and ActivTrades and in both cases EUR/USD results in BID|, ASK| and BID|ASK| and every Index in BID|ASK| only.

      if(tick.flags  &TICK_FLAG_BID)    s+="BID|";
      if(tick.flags & TICK_FLAG_ASK)    s+="ASK|";
      if(tick.flags & TICK_FLAG_LAST)   s+="LAST|";
      if(tick.flags & TICK_FLAG_VOLUME) s+="VOL|";
      if(tick.flags & TICK_FLAG_BUY)    s+="BUY|";
      if(tick.flags & TICK_FLAG_SELL)   s+="SELL|";


Can also anybody Image why CopyTicks using COPY_TICKS_TRADE slows down the Backtester so much?


Can anyone please shed some more light into this? 




 
  • We will never get these information on Forex, simply because they are not provided by the broker. On some broker (still talking about Forex) you will find FLAG_BUY and FLAG_SELL set, but always both at the same time.

  • There is an undocumented flag (=128), seems it's more internal information from MT5, I asked to the developer but I didn't understand clearly the answer.

  • CopyTicks() and CopyTicksRange() have several weaknesses (or bugs ? ), and they seems to be too slow. Well they can manipulate a lot of data so it takes time but it seems too much time. I am currently trying to get answers from developers.
 

Thank you Alain for your reply!

ADD: We will never get these information on Forex, simply because they are not provided by the broker. On some broker (still talking about Forex) you will find FLAG_BUY and FLAG_SELL set, but always both at the same time.

Ok, that makes sense then.


ADD: There is an undocumented flag (=128), seems it's more internal information from MT5, I asked to the developer but I didn't understand clearly the answer.

I need to look at this...


From your answer, it looks like to me that the only way to separate between BUY and SELL ist to use BID, ASK and LAST from MqlTick as shown by the user above. However, as stated, the LAST value is Always 0. Could this be one of the bugs you mentioned? if not, is this an information not provided by the broker then? However, due to the fact that CopyTicks is super slow it seems not to be an option too...


I haven't looked yed really into the volume/tick Indicators available at https://www.mql5.com/en/code/mt5/indicators. However, it seems that there are some that can provide the number of BUY/SELL ticks. Question really is, if this is correct or not when there might still be some Bugs. Alternatively, they might use different information to calcualte which I haven't yet came across?!

MQL5 Code Base: Indicators
MQL5 Code Base: Indicators
  • www.mql5.com
This is a re-write of the nonLagMA found elsewhere and includes several uncommonly shown coding options, including a simple control dashboard. XFisher_org_v2_Candle indicator provides alerts, sends email and push notifications at the incoming trading signals. Possible signal options
 
algotrader01:
...

From your answer, it looks like to me that the only way to separate between BUY and SELL ist to use BID, ASK and LAST from MqlTick as shown by the user above. However, as stated, the LAST value is Always 0. Could this be one of the bugs you mentioned? if not, is this an information not provided by the broker then? However, due to the fact that CopyTicks is super slow it seems not to be an option too...

No, LAST price is of no use on Forex. As I already said, your goal is unreachable on Forex, forget the idea to get BUY/SELL information from the market, you will not find it using MT4 or MT5.

I haven't looked yed really into the volume/tick Indicators available at https://www.mql5.com/en/code/mt5/indicators. However, it seems that there are some that can provide the number of BUY/SELL ticks. Question really is, if this is correct or not when there might still be some Bugs. Alternatively, they might use different information to calcualte which I haven't yet came across?!

Already answered. If they provide BUY/SELL ticks that's not on Forex, if they claims it is they are wrong, unless they use some external data (maybe).

 
Only bank order flow can give you that information, if you are referring to forex. I think you need to gain some trust with liquidity providers in order to gather such information. I am not sure if it is even legal. The LP may not want to be involved after some time and you lose your precious data. Some of us have worked with such information for a short period of time but i can tell you these order flow information is unreliable. Sometimes the order flow is not according to existing mrket direction. You can make a loss if you follow these order flows blindly. Whatever you have thought of, somebody has already tried it with money, effort and programming expertise, as well as traders gathered from all over the world. The method does not work. Try futures trading. It has depth of market. 
 

Thanks Alain and Zee for your comments so far. I took some time to rethink about this Topic and I am agree with you that you do not get BUY and SELL Tick Data from Forex. However, what I probably actually meant was to decompose the tick volume you get from iVOlume into its Bid and Ask ticks. I searched the Code base and found an indicator stating the following:

"This indicator provides the analysis of tick volume deltas. It monitors up and down ticks and sums them up as separate volumes for buys and sells, as well as their delta volumes."

This is actually I want to achieve too. I guess I am right saying that the author means the Bid and Ask ticks by using the Notation Up and Down ticks?!

So, I tested this using the following Code:

if(NewBar())
  {
   Print("ASK_N: ", ASK_N);
   Print("BID_N: ", BID_N);
   Print("iVolume: ",iVolume(_Symbol,_Period,1));
   Print("--------------------------");
  }

MqlTick tick;

if(SymbolInfoTick(Symbol(),tick))
  {
   if(ASK!=tick.ask) { ASK=tick.ask; ASK_N++; }
   if(BID!=tick.bid) { BID=tick.bid; BID_N++; }
}
     

The result is for 3 bars is:

2018.12.08 14:34:28.840 2018.07.16 00:10:00   ASK_N: 127
2018.12.08 14:34:28.840 2018.07.16 00:10:00   BID_N: 101
2018.12.08 14:34:28.840 2018.07.16 00:10:00   iVolume: 170
2018.12.08 14:34:28.840 2018.07.16 00:10:00   --------------------------
2018.12.08 14:34:32.628 2018.07.16 00:20:01   ASK_N: 215
2018.12.08 14:34:32.628 2018.07.16 00:20:01   BID_N: 188
2018.12.08 14:34:32.628 2018.07.16 00:20:01   iVolume: 118
2018.12.08 14:34:32.628 2018.07.16 00:20:01   --------------------------
2018.12.08 14:34:35.722 2018.07.16 00:30:02   ASK_N: 269
2018.12.08 14:34:35.722 2018.07.16 00:30:02   BID_N: 252
2018.12.08 14:34:35.722 2018.07.16 00:30:02   iVolume: 88
2018.12.08 14:34:35.722 2018.07.16 00:30:02   --------------------------

As can bee seen, the sum of the ASK and BID ticks is pretty different to the tick volume recevied bei the iVolme function.

After reading through this Topic, the only thing I can think of is that iVolume is increased when a DEAL is performed and a change in ASK and BID does not Always result in a DEAL?

Any ideas on that? Best!


What I just found is that:

https://www.mql5.com/en/forum/109552/page2#comment_3049186

In particular: "Volume is equal to the number of ticks received, i.e. the number of times the start() function was called, it is not specifically trades or Bid/Ask changes. Change in MarketInfo()triggers a tick, and tick count = volume."


So, the Question might rather be: Is there any link/correlation between the BID/ASK ticks and the Tick Volume?

What is a TICK?
What is a TICK?
  • 2008.07.03
  • www.mql5.com
What is a "tick" in MT4...
 

Luckily my first research is not into ticks. Otherwise it will be no ending conclusion. :/

Trying to count the number of buy and sell ticks is like having the observer effect in physics.

I.e. by the time you count it, the actual value has already changed. 

You can try to get an estimate, but never an accurate value on the number of buy/sell ticks. 

Ticks are instantaneous ticks, but you are measuring it in what time granularity?

I will just take what is given by iVolume (number of ticks per unit period) as it is the more reliable figure, and use it to "simulate" buy/sell volume. 

And tick.ask and tick.bid will only be used when checking prices and spread before opening a trade. 

 

algotrader01:

I totally agree with @Zee Zhou Ma post above, but let's see why it's an illusion.

Thanks Alain and Zee for your comments so far. I took some time to rethink about this Topic and I am agree with you that you do not get BUY and SELL Tick Data from Forex. However, what I probably actually meant was to decompose the tick volume you get from iVOlume into its Bid and Ask ticks. I searched the Code base and found an indicator stating the following:

"This indicator provides the analysis of tick volume deltas. It monitors up and down ticks and sums them up as separate volumes for buys and sells, as well as their delta volumes."

This is actually I want to achieve too. I guess I am right saying that the author means the Bid and Ask ticks by using the Notation Up and Down ticks?!

It's plain wrong assumptions. Who said a tick is a trade ? Bid/Ask are changing for different reasons, one of them is there was a trade but that's not even the main one. What is the meaning of a tick where Bid and Ask both changed ? 

Most people are fooling themselves on that matter, in the best case, in the worst you have scammers trying you to sell you a grail. Be careful.

So, I tested this using the following Code:

The result is for 3 bars is:

As can bee seen, the sum of the ASK and BID ticks is pretty different to the tick volume recevied bei the iVolme function.

After reading through this Topic, the only thing I can think of is that iVolume is increased when a DEAL is performed and a change in ASK and BID does not Always result in a DEAL?

Any ideas on that? Best!


What I just found is that:

https://www.mql5.com/en/forum/109552/page2#comment_3049186

In particular: "Volume is equal to the number of ticks received, i.e. the number of times the start() function was called, it is not specifically trades or Bid/Ask changes. Change in MarketInfo()triggers a tick, and tick count = volume."


So, the Question might rather be: Is there any link/correlation between the BID/ASK ticks and the Tick Volume?

iVolume() doesn't take into account "Ask only" ticks. See here.

So I repeat again, there is NO WAY to get Buy/Sell information on Forex with MT4 or MT5 data.

MT5 : ticks data questions, issues and bugs. All about ticks.
MT5 : ticks data questions, issues and bugs. All about ticks.
  • 2018.11.26
  • www.mql5.com
Build 1940/64 bits. Broker A, real account. EURUSD...
 
algotrader01:


What I know already is that tick.flags is a sum of different FLAGs. However the total sum of all flags is (64+32+16+8+4+2) 126. So what does it mean when tick.flag is 130 or 134 as seen in the output?


As we can see there seem to exist to different Methods to count the number of SELL and BUY ticks:

1. Using Tick.Last and compare it to Tick.Buy and Tick.Sell

2. Use the TICK_FLAG_* Information 


However, I don't quite understand by now how to use the second method to separate the volume into BUY and SELL ticks.


I further do not understand why I only get the string BID| , ASK| and BID|ASK and Nothing for the volume and the BUY and SELL flag. I read that BUY and SELL Flag depends on the broker or on the market itself? I tested two different Brokers, JDF and ActivTrades and in both cases EUR/USD results in BID|, ASK| and BID|ASK| and every Index in BID|ASK| only.


Can also anybody Image why CopyTicks using COPY_TICKS_TRADE slows down the Backtester so much?


Can anyone please shed some more light into this? 




might be late but i just started playing around with MQL5 around 3 weeks ago..i hope this below snippet of the backtester log can give you a clearer view, not sure if this would fit your case

MH      0       02:26:29.507    Tester    _Near=3
JI      0       02:26:29.507    Tester    _Far=9
RL      0       02:26:29.554    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   Start copying bar data from previous 4
EH      0       02:26:32.101    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   USDJPY: received 8230272 ticks in 2547 ms
ID      0       02:26:32.101    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   Last tick time = 2020.05.01 23:57:41.204
DD      0       02:26:32.101    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   First tick time = 2019.11.25 00:00:01.108
NP      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   Tick array size is 63| CHARTMODE=SYMBOL_CHART_MODE_BID | ThisBar TickVolume: 49
HK      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   Looping the tick_array after CopyTicksRange
MN      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:1
LR      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:2
OF      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:3
NJ      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:4
MN      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:5
PR      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:6
OF      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:7
FJ      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:8
IN      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:9
GP      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:10
RD      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:11
QH      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:12
PL      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:13
KP      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:14
FS      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:15
EG      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:16
HK      0       02:26:32.122    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:17
LO      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:18
ES      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:19
MG      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:20
PK      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:21
OO      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:22
FR      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:23
IF      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:24
HJ      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:25
CN      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:26
RR      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:27
EF      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:28
HJ      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:29
RN      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:30
CQ      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:31
DE      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:32
EI      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:33
FM      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:34
OQ      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:35
LE      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:36
MI      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:37
FM      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:38
KP      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:39
GD      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:40
FH      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:41
EL      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:42
LP      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:43
KD      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:44
RH      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:45
QL      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:46
DO      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:47
OS      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:134 count:48
RG      0       02:26:32.123    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:49
GD      0       02:26:32.136    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   Tick array size is 195| CHARTMODE=SYMBOL_CHART_MODE_BID | ThisBar TickVolume: 119
GE      0       02:26:32.136    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   Looping the tick_array after CopyTicksRange
PJ      0       02:26:32.136    RGJ2EMA3-267 (USDJPY,M6)        2020.05.04 00:00:00   This tick FLAG NO:130 count:1

since my broker set the chart mode to bid, i removed the flag no 4 which the "ask" and i got the consistent count value between copyticks result and tickvolume from copyrates..hope this helps..

 

Correct, a bid-price change = tick-volume change,

ask-price change doesn't add to the tick-volume.

An OnTick() trigger can be either bid or ask price change.
Reason: