BUY SELL orders/deals explanation

 

Hello,

I notice an strange behavior/display of the EA's log.

According to all documentations a SELL deal is done from BID price and a BUY deal from ASK price. But I notice that if I Print() the MqlTick() .last structure, what  is printed/displayed is always the BID price doesn't matter if it was a SELL or BUY deal.

What is the explanation for this

Documentation on MQL5: Standard Constants, Enumerations and Structures / Data Structures / Structure for Current Prices
Documentation on MQL5: Standard Constants, Enumerations and Structures / Data Structures / Structure for Current Prices
  • www.mql5.com
Standard Constants, Enumerations and Structures / Data Structures / Structure for Current Prices - Documentation on MQL5
 

MqlTick.last is the price of the last deal from your broker (not your own deal). This price is only available when Depth of Market is enabled.

In a deal there is always a buyer AND a seller. If you are buying at ask, someone is selling at bid. If some is selling at bid, an other one is buying at ask. So each deal is done at some bid price, which is returned to mqltick.last (if available).

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Symbol Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Symbol Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Symbol Properties - Documentation on MQL5
 

Let me try to clarify some things:

1) FOREX market is completely different from stocks and futures markets;

2) If you're buying at ask, not necessarily someone is selling at bid... You could have, for instance, a very simple case where someone (person A) puts a buy limit order at a given price: so this person is not buying at ask, but simply putting an order at a given price, willing to wait for someone to sell at that price in the future. Another second person (person B), will actually sell at bid (at any given time in the future) and will in fact be responsible for the trade to occur.

3) What the original poster wrote is 100% correct for stocks and futures markets, however this is not true for FOREX market, and I'll try to explain why:

■ opposed to stock exchanges, Forex market is decentralized, i.e., you don't have an exchange where all trades occur and who, in fact, is responsible for all market data/information;
■ in stock exchanges, when you buy a stock (or a futures contract), you're actually buying directly from a second person/institution, and the broker will only charge you a fee for the trade;
■ in the Forex market, when you buy a given currency, you're actually buying indirectly this asset, i.e., you're actually buying the currency with a spread charged by your broker; in this case, the broker in fact goes to the market and purchases the currency, but sells it later to the client at a higher price, which is actually the way the broker gets its profit;

That's the reason why all trades occur at bid in Forex market.

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
 
Malacarne:

Let me try to clarify some things:

1) FOREX market is completely different from stocks and futures markets;

2) If you're buying at ask, not necessarily someone is selling at bid... You could have, for instance, a very simple case where someone (person A) puts a buy limit order at a given price: so this person is not buying at ask, but simply putting an order at a given price, willing to wait for someone to sell at that price in the future. Another second person (person B), will actually sell at bid (at any given time in the future) and will in fact be responsible for the trade to occur.

3) What the original poster wrote is 100% correct for stocks and futures markets, however this is not true for FOREX market, and I'll try to explain why:

■ opposed to stock exchanges, Forex market is decentralized, i.e., you don't have an exchange where all trades occur and who, in fact, is responsible for all market data/information;
■ in stock exchanges, when you buy a stock (or a futures contract), you're actually buying directly from a second person/institution, and the broker will only charge you a fee for the trade;
■ in the Forex market, when you buy a given currency, you're actually buying indirectly this asset, i.e., you're actually buying the currency with a spread charged by your broker; in this case, the broker in fact goes to the market and purchases the currency, but sells it later to the client at a higher price, which is actually the way the broker gets its profit;

That's the reason why all trades occur at bid in Forex market.

Thank you ! Now, after your explanations the picture is very clear.
 
Malacarne:

Let me try to clarify some things:

1) FOREX market is completely different from stocks and futures markets;

2) If you're buying at ask, not necessarily someone is selling at bid... You could have, for instance, a very simple case where someone (person A) puts a buy limit order at a given price: so this person is not buying at ask, but simply putting an order at a given price, willing to wait for someone to sell at that price in the future. Another second person (person B), will actually sell at bid (at any given time in the future) and will in fact be responsible for the trade to occur.

3) What the original poster wrote is 100% correct for stocks and futures markets, however this is not true for FOREX market, and I'll try to explain why:

■ opposed to stock exchanges, Forex market is decentralized, i.e., you don't have an exchange where all trades occur and who, in fact, is responsible for all market data/information;
■ in stock exchanges, when you buy a stock (or a futures contract), you're actually buying directly from a second person/institution, and the broker will only charge you a fee for the trade;
■ in the Forex market, when you buy a given currency, you're actually buying indirectly this asset, i.e., you're actually buying the currency with a spread charged by your broker; in this case, the broker in fact goes to the market and purchases the currency, but sells it later to the client at a higher price, which is actually the way the broker gets its profit;

That's the reason why all trades occur at bid in Forex market.

I was thinking a little bit more about:

 "■ in the Forex market, when you buy a given currency, you're actually buying indirectly this asset, i.e., you're actually buying the currency with a spread charged by your broker; in this case, the broker in fact goes to the market and purchases the currency, but sells it later to the client at a higher price, which is actually the way the broker gets its profit;"

I can not figure where I am wrong in my below thinking:

So, because when I BUY the broker actually SELL to me; and that is why the BID price is registered. And because the BUY price>SELL price the broker make profit.

Now, let say I SELL. According to what you said above it should be like that: the broker actually BUY from me and than SELL to the market. If I am right, than the ASK price should be registered (the bold words give the registered prices in the two cases). More over; because BUY price>SELL price the broker lose.

I am sure I am wrong; so please explain what happens when I SELL. 

 
tenlau:

I was thinking a little bit more about:

 "■ in the Forex market, when you buy a given currency, you're actually buying indirectly this asset, i.e., you're actually buying the currency with a spread charged by your broker; in this case, the broker in fact goes to the market and purchases the currency, but sells it later to the client at a higher price, which is actually the way the broker gets its profit;"

I can not figure where I am wrong in my below thinking:

So, because when I BUY the broker actually SELL to me; and that is why the BID price is registered. And because the BUY price>SELL price the broker make profit.

Now, let say I SELL. According to what you said above it should be like that: the broker actually BUY from me and than SELL to the market. If I am right, than the ASK price should be registered (the bold words give the registered prices in the two cases). More over; because BUY price>SELL price the broker lose.

I am sure I am wrong; so please explain what happens when I SELL. 

The spread is valid only for the customer, but not for the broker himself! Remember that the broker can always buy/sell at bid, so in the case you sell, the broker has two options: either sell the amount at the same price (bid price) in the market or sell this amount to another (internal) customer at the ask price, practicing the spread...

Put this in mind: the broker is like a bank, he never loses!

 
Malacarne:

The spread is valid only for the customer, but not for the broker himself! Remember that the broker can always buy/sell at bid, so in the case you sell, the broker has two options: either sell the amount at the same price (bid price) in the market or sell this amount to another (internal) customer at the ask price, practicing the spread...

Put this in mind: the broker is like a bank, he never loses!

Well, now you lighted me a bit but also darkened. So if I BUY broker always win; if I SELL broker could win or could be even.

Please tell me if I understand right.

Now if I am right this rise another question, that could be or not, put in another thread: what is the behavior (how exactly process my order) an ECN, DD,NDD,STP,MTF etc.

And specific: What kind of broker is Alpari MT5 platform; from your opinion.

 
tenlau:

Well, now you lighted me a bit but also darkened. So if I BUY broker always win; if I SELL broker could win or could be even.

Please tell me if I understand right.

Now if I am right this rise another question, that could be or not, put in another thread: what is the behavior (how exactly process my order) an ECN, DD,NDD,STP,MTF etc.

And specific: What kind of broker is Alpari MT5 platform; from your opinion.

Discussions about brokers are forbidden in the community. Sorry.
 
Malacarne:
Discussions about brokers are forbidden in the community. Sorry.

Sorry, I do not want to break the rules, do not take into consideration the question about Alpari, but please answer the others. 

 
tenlau:

Sorry, I do not want to break the rules, do not take into consideration the question about Alpari, but please answer the others. 

There is a discussion about the types of brokers here. You could first take a look there.

Maybe you'll find something interesting. If not, please ask again in the forum. Anyway, I hope this might be useful.

 
Malacarne:

Let me try to clarify some things:

1) FOREX market is completely different from stocks and futures markets;

2) If you're buying at ask, not necessarily someone is selling at bid... You could have, for instance, a very simple case where someone (person A) puts a buy limit order at a given price: so this person is not buying at ask, but simply putting an order at a given price, willing to wait for someone to sell at that price in the future. Another second person (person B), will actually sell at bid (at any given time in the future) and will in fact be responsible for the trade to occur.

A buy limit order isn't a deal, it's a pending order with no actual transaction. The buy will only occur (pending order triggered) when the ask price of this symbol will reach the buy limit order price. The deal is at ask price for the buyer. The trade will only occur at this price (buy limit order price) if a trader will sell at this price, if there is no seller at this price the price can go up and you will get slippage.


3) What the original poster wrote is 100% correct for stocks and futures markets, however this is not true for FOREX market, and I'll try to explain why:

Can you quote what you think is actually 100% correct in the OP ? As I am not sure of what you mean.


■ opposed to stock exchanges, Forex market is decentralized, i.e., you don't have an exchange where all trades occur and who, in fact, is responsible for all market data/information;

■ in stock exchanges, when you buy a stock (or a futures contract), you're actually buying directly from a second person/institution, and the broker will only charge you a fee for the trade;

Is it true in all case ? Can you explain why there is a Bid AND an Ask price for PETR4 for example, which is well a stock ?

■ in the Forex market, when you buy a given currency, you're actually buying indirectly this asset, i.e., you're actually buying the currency with a spread charged by your broker; in this case, the broker in fact goes to the market and purchases the currency, but sells it later to the client at a higher price, which is actually the way the broker gets its profit;

It depends of the broker type. An ECN+STP broker is supposed to only work as an intermediary and doesn't take part to the transaction.


That's the reason why all trades occur at bid in Forex market.

We are talking about retail traders using MT5 and a broker to trade. All trades in Forex Market occurs at bid for the seller, at ask for the buyer. Metaquotes choose to put the bid in MqlTick.last the same way they choose to draw charts with bid price. This is how I understand the issue, maybe I am wrong.
Reason: