Spread trade question? - page 2

 
sbdavra: i wants to know that how can i get {last deal price} and {last deal volume} of  particular symbol without using loop in MQL5
Please don't hijack another poster's thread when the subject matter is completely different. Start your own thread. This one is about the effect of spread.
 
Fernando Carreiro:

Sorry, but you are sadly mistaken! You do PAY the total spread (irrespective of it being ECN, STP, DD or what-ever), and here is a very simple example to illustrate this:

Say you buy 1 Lot of the EUR/USD and it is currently with a spread of 1 pip. Your order (and your equity) will immediately be down by $10, and you have just paid spread. If you were to then close the market order before the Bid price changes (i.e. Ask can change as much as it wants, but not Bid), then your Balance would be decreased by $10 (1 Lot x 1 Pip). You have just physically paid the spread!

The reason why @whroeder1 states that you pay spread on the opening of a buy order and at the closing of the sell order, is simply the convention that one opens a Buy Order at Ask and Sell Order at Bid and then closes the Buy Order at Bid and Sell Order at Ask. So, should the spread become 0 (i.e. Ask becomes same as Bid, but Bid does not change), just before closing the order, then a Buy Order would still be in a loss by the initial spread but a Sell Order would end up not paying any spread at all.

...

Seems contradictory to me. You have "just" paid the spread but finally you could end up not paying any spread at all. So the spread is refund ? That doesn't make sense.

Of course you equity is immediately down by $10 (or whatever), that's of course not the discussion. Anyway, my point is probably too "philosophical" about what is "pay", that doesn't really matter.

 
Alain Verleyen: Seems contradictory to me. You have "just" paid the spread but finally you could end up not paying any spread at all. So the spread is refund ? That doesn't make sense. Of course you equity is immediately down by $10 (or whatever), that's of course not the discussion. Anyway, my point is probably too "philosophical" about what is "pay", that doesn't really matter.

This is NOT a philosophical issue. This is a financial transaction and you PAY spread, otherwise brokers would not implement it. It is part of their revenue stream.

There is no contradiction because Buy orders and Sell orders are handled differently:

  • When you place a Buy market order, the spread cost is immediately set (frozen), meaning that even if spread widens or narrows during the lifetime of that market order, the final spread cost will not change (even though it is only applied to your Balance when the order closes).
  • When you place a Sell market order, the spread floats as it widens and narrows during the lifetime of the order, and is only set (frozen), when the order is finally closed.

This is because the fixed point of reference is the Bid Price, and the Ask price is (Bid + Spread). On other trading systems that use a Mid price as the reference price, where "Bid = Mid - Spread/2" and "Ask = Mid + Spread/2", then obviously the convention will be different. But on MetaTrader (and other similar trading systems), the convention is the one described so far.

EDIT PS! If you wish and believe it would help other traders understand this important concept, I could prepare a blog post explaining this in much more detail and with graphs.

 
Fernando Carreiro:

This is NOT a philosophical issue. This is a financial transaction and you PAY spread, otherwise brokers would not implement it. It is part of their revenue stream.

That's why it's different for an STP broker, a ECN broker or a dealing desk broker.

There is no contradiction because Buy orders and Sell orders are handled differently:

  • When you place a Buy market order, the spread cost is immediately set (frozen), meaning that even if spread widens or narrows during the lifetime of that market order, the final spread cost will not change (even though it is only applied to your Balance when the order closes).
  • When you place a Sell market order, the spread floats as it widens and narrows during the lifetime of the order, and is only set (frozen), when the order is finally closed.

This is because the fixed point of reference is the Bid Price, and the Ask price is (Bid + Spread). On other trading systems that use a Mid price as the reference price, where "Bid = Mid - Spread/2" and "Ask = Mid + Spread/2", then obviously the convention will be different. But on MetaTrader (and other similar trading systems), the convention is the one described so far.

EDIT PS! If you wish and believe it would help other traders understand this important concept, I could prepare a blog post explaining this in much more detail and with graphs.

What you wrote here is not exact. But I am not ready for a hot discussion, as you seem so certain to be right 100%. I should not have started it, sorry.

I don't care to be right or wrong, let's say you are right :-)

EDIT: Pending discussion, I don't have time currently to continue...

 

Alain Verleyen: That's why it's different for an STP broker, a ECN broker or a dealing desk broker.

What you wrote here is not exact. But I am not ready for a hot discussion, as you seem so certain to be right 100%. I should not have started it, sorry.

I don't care to be right or wrong, let's say you are right :-)

EDIT: Pending discussion, I don't have time currently to continue...

In order to explain in more detail, I will be using real live data for the example. Also, in order to simplify things, I will also be assuming that the volume for the positions that I take will be of minor significance and will not impact the underlying market liquidity.

I have chosen the USD/ZAR, because this symbol often has noticeable periods where the bid price does not change, but the ask price does (i.e. only spread changes). It also happens on many other symbols, but on this one it is relatively easy to find such occurrences which is perfect for this example.

So, using MetaTrader v5 in order to view the tick data, I selected the time period between 2018.01.23 14:43:38 - 14:45:23 (EET/UTC+2). I have attached an archive file of the tick data in both CSV and screenshot (see below).

I will now describe both a Buy Order as well as a Sell Order lasting just under a minute, during that period:

  1. At 2018.01.23 14:43:48, Bid = 12.12943, Ask = 12.13381 (Spread = 43.8 pips):
    • I place both a Buy Order (at Ask) and a Sell Order (at Bid) and immediately afterwards, both orders show a P/L of -43.8 pips (a loss) each.
  2. At 14:43:49.534, spread narrows by 1 pip (Bid is the same, but Ask = 12.13371):
    • The Buy Order is still showing a loss of 43.8 pips (because it will close at Bid which has not changed).
    • But the Sell Order is now showing a loss of 42.8 pips (because it will close at the Ask which has changed).
  3. For the next 50+ seconds, the spread will fluctuate (Ask will change, but not the Bid), and as it does, the Sell Order's P/L will also fluctuate, but the Buy Order's P/L will stay the same as it was when it first opened.
  4. At 14:44:45, I close both orders where Bid = 12.12943 (unchanged), Ask = 12.13361 (Spread = 41.8 pips):
    • The Buy is closed at a Bid of 12.12943, therefore it will have a final P/L of -43.8 pips (- 12.13381 + 12.12943 = -0.00438)
    • The Sell is closed at a Ask of 12.13361, therefore it will have a final P/L of -41.8 pips (+ 12.12943 - 12.13361 = -0.00418)

You may ask: Why did I choose a period where only the Bid price remained constant? Why did I not choose a period where Ask priced remained constant?

Well, because MetaTrader uses the Bid Price as the reference price as all Bar OHLC Data is expressed as Bid prices (see MqlRates). So the Bid price is the reference price and the Ask is a reflection of changes in spread (i.e. Ask = Bid + Spread), because that is the convention that was chosen by MetaQuotes. So all transactions taking place on MetaTrader follow that convention and it is how we should view the relationship between Bid, Ask and Spread as well as how Market Orders are carried out on this platform.

On another system (and I have used such a system), where Mid prices are used as the reference for OHLC data, then obviously the transactions are viewed in another way, but on MetaTrader (and on many other platforms), this is the convention, where Buy Orders open at Ask and close at Bid and Spread is applied at the Open, and where Sell Orders open at Bid and close at Ask and Spread is applied at the Close.

Other systems may adopt a different convention, but since we are using MetaTrader, this is how the transactions should be viewed!

Tick Data for the example above:


 
My formulation was unclear, imprecise and so not correct. When I have found a good way to explain what I mean, maybe I will continue this discussion.