# TICK_FLAG_BUY and TICK_FLAG_SELL simultaneously set in MqlTick structure - page 2

35

I talked to a person who does not know Metatrader but knows very well the BMF market and he gave me an explanation that i would like to share with you.

He said that there are 3 kinds of trades at BMF:

• SELL trades - a seller sends a sell market order that closes someone's buy limit order
• DIRECT trades - a buyer and a seller send buy and sell market orders simultaneously through the same broker and that broker deals the trade directly between them, without closing any limit order at the market.

He explained me that the broker is authorized to make direct deals between its own customers, as long as the transaction price is inside the market spread range (higher than the current bid price and lower than the current ask price) and the trade information is sent to the market. He told me direct deals are regularly recorded as any other trade (so they must generate tick data records as well).

I told him that the "Buy/Sell" records are around 1% of the total market volume and he thinks it looks a plausible figure for the volume share of direct deals at BMF.

So, it seems that the mistery of the "Buy/Sell" ticks at BMF is solved.

I am curious to know if the markets in other countries also have that kind of direct trade, or if it is just a "Brazilian weirdness".

Regards!

35

nicholishen:

Hi Heraldo,

This is not how you evaluate a bitmask.  You could be right some of the time, but those flags could also be set with other flags as well - and the total will not still be 96.

You would need to do something like this instead...

Yes, Nicolishen.

The sentence you mentioned from my post do not reflect how the flags are evaluated in my robot's code.

I was just reporting that I received ticks with flags=96 and that this was a proof that both BUY and SELL flags were simultaneously set, since 96 = 64 + 32 = 2^6 + 2^5 (bits 6 and 5 set).

The statement above has nothing to do with the evaluation of the flags in the robot's code

In my code I properly check the bit flags through bitwise logical operations, exactly as you mentioned.

Thank you anyway.

Moderator
32815

nicholishen:

Hi Heraldo,

This is not how you evaluate a bitmask.  You could be right some of the time, but those flags could also be set with other flags as well - and the total will not still be 96.

You would need to do something like this instead...

That's not exact. 96 can only by bits 5 and 6 set, so 32+64.

Anyway that's really not what matters in this topic.

EDIT: I see Heraldo answer after I posted this, he said the same as expected.
Moderator
32815

HeraldoAlmeida:

I talked to a person who does not know Metatrader but knows very well the BMF market and he gave me an explanation that i would like to share with you.

He said that there are 3 kinds of trades at BMF:

• SELL trades - a seller sends a sell market order that closes someone's buy limit order
• DIRECT trades - a buyer and a seller send buy and sell market orders simultaneously through the same broker and that broker deals the trade directly between them, without closing any limit order at the market.

He explained me that the broker is authorized to make direct deals between its own customers, as long as the transaction price is inside the market spread range (higher than the current bid price and lower than the current ask price) and the trade information is sent to the market. He told me direct deals are regularly recorded as any other trade (so they must generate tick data records as well).

I told him that the "Buy/Sell" records are around 1% of the total market volume and he thinks it looks a plausible figure for the volume share of direct deals at BMF.

So, it seems that the mistery of the "Buy/Sell" ticks at BMF is solved.

I am curious to know if the markets in other countries also have that kind of direct trade, or if it is just a "Brazilian weirdness".

Regards!

Very interesting. Thank you very much for sharing.
764

Alain Verleyen:

That's not exact. 96 can only by bits 5 and 6 set, so 32+64.

Anyway that's really not what matters in this topic.

EDIT: I see Heraldo answer after I posted this, he said the same as expected.

The point I was making was that Heraldo will be missing data when (for example)

`flags = TICK_FLAG_BUY|TICK_FLAG_SELL|TICK_FLAG_VOLUME; `

Any other flag in combination with TICK_FLAG_BUY and TICK_FLAG_SELL will mean that (flags != 96) despite buy and sell flags being set true.

Edit: Yes, I just saw his reply as well. No worries Heraldo.

Moderator
32815

nicholishen:

The point I was making was that Heraldo will be missing data when (for example)

Any other flag in combination with TICK_FLAG_BUY and TICK_FLAG_SELL will mean that (flags != 96) despite buy and sell flags being set true.

Edit: Yes, I just saw his reply as well. No worries Heraldo.

Sure we agree on that. Sorry for the misunderstanding.
35

Alain Verleyen:
Sure we agree on that. Sorry for the misunderstanding.

nicholishen:

The point I was making was that Heraldo will be missing data when (for example)

Any other flag in combination with TICK_FLAG_BUY and TICK_FLAG_SELL will mean that (flags != 96) despite buy and sell flags being set true.

Edit: Yes, I just saw his reply as well. No worries Heraldo.

No worries, Nicholishen. Your intention was good. If I were checking the flags the wrong way I would benefit from your explanation. Thank you!

12