Tick flags codification - how to understand?
Just as the name says — they are "bit flags" or "binary flags". Here are some references for Python ...
Enum vs Flag for bitmasks in Python | Bjarne Magnussen
Binary flags with Python
And here are some MQL5 references ...
Forum on trading, automated trading systems and testing trading strategies
Sergey Gritsay, 2016.12.11 07:23
Please advise which type of flag corresponds to number 24. Experimentally determined that
- TICK_FLAG_BID = 2
- TICK_FLAG_ASK = 4
- TICK_FLAG_LAST = 8
- TICK_FLAG_VOLUME = 16
- TICK_FLAG_BUY = 32
- TICK_FLAG_SELL = 64
Forum on trading, automated trading systems and testing trading strategies
William Roeder, 2017.02.21 17:27
Since anding with a bit mask can only result in zero or the bit mask and since non-zero is true if((tick.flags &TICK_FLAG_BID)==TICK_FLAG_BID) s+="BID|";
if((tick.flags &TICK_FLAG_ASK)==TICK_FLAG_ASK) s+="ASK|";
if((tick.flags &TICK_FLAG_LAST)==TICK_FLAG_LAST) s+="LAST|";
if((tick.flags &TICK_FLAG_VOLUME)==TICK_FLAG_VOLUME) s+="VOL|";
if((tick.flags &TICK_FLAG_BUY)==TICK_FLAG_BUY) s+="BUY|";
if((tick.flags &TICK_FLAG_SELL)==TICK_FLAG_SELL) s+="SELL|";Code can be simplified. 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|";
- Bjarne Magnussen
- blog.magnussen.casa
I read about it here https://www.mql5.com/en/docs/integration/python_metatrader5/mt5copyticksfrom_py#tick_flag
But if I do query, server will return flags as 230/100/226 ... etc
How to decode them to really values? Maybe table or formula is allow for decode all possible int values?
Where is it?