I changed the function to this :
bool compareTicks(MqlTick &a,MqlTick &b){ if(a.time!=b.time){Print("Different time");return(false);} if(a.time_msc!=b.time_msc){Print("Different MSC");return(false);} if(a.ask!=b.ask){Print("Different ASK ("+DoubleToString(a.ask,_Digits)+") ("+DoubleToString(b.ask,_Digits)+")");return(false);} if(a.bid!=b.bid){Print("Different BID");return(false);} if(a.last!=b.last){Print("Different LAST");return(false);} if(a.flags!=b.flags) { Print("Different FLAGS"); bool a_bid=(a.flags&TICK_FLAG_BID)==TICK_FLAG_BID; bool a_ask=(a.flags&TICK_FLAG_ASK)==TICK_FLAG_ASK; bool a_last=(a.flags&TICK_FLAG_LAST)==TICK_FLAG_LAST; bool a_vol=(a.flags&TICK_FLAG_VOLUME)==TICK_FLAG_VOLUME; bool a_buy=(a.flags&TICK_FLAG_BUY)==TICK_FLAG_BUY; bool a_sell=(a.flags&TICK_FLAG_SELL)==TICK_FLAG_SELL; bool b_bid=(b.flags&TICK_FLAG_BID)==TICK_FLAG_BID; bool b_ask=(b.flags&TICK_FLAG_ASK)==TICK_FLAG_ASK; bool b_last=(b.flags&TICK_FLAG_LAST)==TICK_FLAG_LAST; bool b_vol=(b.flags&TICK_FLAG_VOLUME)==TICK_FLAG_VOLUME; bool b_buy=(b.flags&TICK_FLAG_BUY)==TICK_FLAG_BUY; bool b_sell=(b.flags&TICK_FLAG_SELL)==TICK_FLAG_SELL; if(a_bid!=b_bid){Print("Different BID FLAG");} if(a_ask!=b_ask){Print("Different ASK FLAG");} if(a_last!=b_last){Print("Different LAST FLAG");} if(a_vol!=b_vol){Print("Different VOLUME FLAG");} if(a_buy!=b_buy){Print("Different BUY FLAG");} if(a_sell!=b_sell){Print("Different SELL FLAG");} if(a_ask){Print("A::ASK");} if(a_bid){Print("A::BID");} if(a_last){Print("A::LAST");} if(a_buy){Print("A::BUY");} if(a_sell){Print("A::SELL");} if(a_vol){Print("A::VOL");} if(b_ask){Print("B::ASK");} if(b_bid){Print("B::BID");} if(b_last){Print("B::LAST");} if(b_buy){Print("B::BUY");} if(b_sell){Print("B::SELL");} if(b_vol){Print("B::VOL");} //scan b for extra flags as it is a default tick //4 bytes for(int i=0;i<4;i++){ //8 bits uint v=0; for(int j=0;j<8;j++){ if(v==0){v=1;}else{v*=2;} uint test_flag=v<<(i*8); if((b.flags&test_flag)==test_flag){ Print("B::TEST FLAG ("+IntegerToString(test_flag)+") present"); } } } Print("A("+IntegerToString(a.flags)+")B("+IntegerToString(b.flags)+")"); return(false); } if(a.volume!=b.volume){Print("Different VOLUME");return(false);} if(a.volume_real!=b.volume_real){Print("Different VOLUME REAL");return(false);} return(true); }
I discovered that both ticks have the same "known" flags but then found an undocumented tick flag in the "default" (downloaded not uncompressed) tick.
Tick A:: is the result of reconstruction from the compressed stream
Tick B:: is the tick as it was downloaded
The report catces TICK_FLAG_ASK and TICK_FLAG_B on both and on the downloaded tick (B) it catches flag with value 128.
these are the values of the tick flags from another script :
There is no flag with bit resulting in 128
MqlTick a,b={0}; a.flags=TICK_FLAG_ASK; Print("ASK ("+IntegerToString(a.flags)+")"); a.flags=TICK_FLAG_BID; Print("BID ("+IntegerToString(a.flags)+")"); a.flags=TICK_FLAG_LAST; Print("LAST ("+IntegerToString(a.flags)+")"); a.flags=TICK_FLAG_VOLUME; Print("VOLU ("+IntegerToString(a.flags)+")"); a.flags=TICK_FLAG_BUY; Print("BUY ("+IntegerToString(a.flags)+")"); a.flags=TICK_FLAG_SELL; Print("SELL ("+IntegerToString(a.flags)+")");
So , unless i'm not messing up something , (i'm not touching the downloaded ticks they remain as is) ,
what is the undocumented tick flag ?
Here is the response for the undocumented tick flag(s)
Did not understand nothing.
Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
Новая версия платформы MetaTrader 5 build 1930: Плавающие окна графиков и .Net библиотеки в MQL5
Slava, 2018.12.04 11:09
Это - служебный флаг, который выставляет датафид, если у тика по какой-либо причине не был выставлен флаг TICK_FLAG_BID, при том что тик должен быть применён к бару.
Translation :
This is a service flag that sets the datafeed if the tick has not had the TICK_FLAG_BID flag set for any reason, while the tick must be applied to the bar.
I just checked the documented (the flags they want us to know about) flags and the tick streams matched .
I hope there isn't any easter egg tick flag that represents "Synthesized ticks" or something ...
anyway , the docs are good for motivating you to go to the gym i give them that .
Here is the response for the undocumented tick flag(s)
Did not understand nothing.
Translation :
I just checked the documented (the flags they want us to know about) flags and the tick streams matched .
I hope there isn't any easter egg tick flag that represents "Synthesized ticks" or something ...
anyway , the docs are good for motivating you to go to the gym i give them that .
It's an internal flag for the platform, you should just ignore it.
Yeah , they could have added it in the docs though .
I mean :
- them documenting it , 3.2 seconds
- me discovering it , 5 hours
Yeah , they could have added it in the docs though .
I mean :
- them documenting it , 3.2 seconds
- me discovering it , 5 hours
Or you read/search the forum. I made a post about it 5 years ago already.
But who is searching and reading nowadays...
Forum on trading, automated trading systems and testing trading strategies
How to decompose tick volume into buy and sell ticks?
Alain Verleyen, 2018.12.07 16:10
- 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.
Or you read/search the forum. I made a post about it 5 years ago already.
But who is searching and reading nowadays...
Yeah , i found the response to your question actually .
The thing is as a bad coder i tend to assume there's something wrong on my end first so we i'll go through all scenarios before the "wait a minute" .
If i went back in time the Alain that discovered this would agree "it could be in the docs." 😋 (would also but dogecoin).
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi i have this comparator of ticks (to determine whether or not compression and decompression results in the same tick stream)
The function reports a difference in tick flags but i cannot make it report on which flags specifically.
this is the function :
and this is what it reprorts
thank you