Quoting – A new activity in MT5

[Versiunea romaneasca] [MQLmagazine.com in romana] [English edition]

Lightspeed Trading Well, perhaps I exaggerated the term a bit, but after all, this is how I feel about it. It will be a way to implement fx/futures arbitrage and other similar arbitrages between replaceable assets. Like NYMEX Crude Light/ICE WTI or any major index and its mini versions.

Long time ago, on my former blog, I presented a method to arbitrage the broker’s foolishness offering swap free forex trading and also fx futures trading. At that time, I also spoke just a bit  about missallignment arbitrage. Now we will dwelve in it.

As you know, futures copy the fluctuations of their underlying contracts, and the difference between, called basis, gradually reduces to zero, at futures expiry. I will not dwelve here into the calculations of fair value, because fair value, even for fx futures, can’t be calculated correctly, at least with the resources available to fx traders. However, there is no need to do it so. Since futures is an interest-adjusted spot, it means the basis reduces towards expiry with a so slow speed, especially when interest differentials are small, that for hours, even up amounting to days, it can be considered constant. And for the readers of my blog at that time, we saw fluctuations in basis applying especially with the new trading day , after each daily Globex restart. That means at least during the span of a trading day, the basis can be considered relatively constant. Which means that basis will fluctuate all the time around this constant value, providing a base for evaluating whether the futures is too far or too near from the underlying.  Taking into account that fx has a way higher volume and higher volatility than the futures, we can expect that the generator of the missallignment windows is the fx market, having much lower latency than the lazy futures market.

discount window

You can see in this chart fluctuations of the “discount window” , that is EURUSD – 6EZ9. Because we are not interested in the discount window itself, and we don’t wanna get caught in futures discounts that may be wrong because of wrong interest rate information, we consider the base for calculus the 20 minute simple moving average of the basis (the pink line). Red and green line are at 2 pip distance from the pink moving average. See how wide the basis fluctuates around its own moving average, a continuous arbitrageable white noise…

How is this used by professional traders ?

Professional traders trade in the real-markets, or level II markets. The level II markets are “the markets” as they are for real. Every market is formed up by supply and demand. Demand is represented by orders on the Bid side, which contains orders of traders that are willing to buy at a certain price, and supply is represented by orders on the Ask side, which contains orders of traders that are willing to sell at a certain price. This order posting activity is known as quoting.  When a trader wishes to buy at market price, will buy from the ones that are selling, at the Ask price, and a trader that wishes to sell at market price will sell to the ones that are buying, at the Bid price. This is known as market execution and is the one available to retail traders. Retail traders don’t quote, don’t make a market, they can’t post buy orders on bid, nor post sell orders on ask. Traders that are being filled buy at bid or sell at ask with no spread costs.

A professional trader will know the basis, will take the futures price as the base for building the fx price, and will quote two fx orders, both far from the futures. Should one of them being filled, the other order will be deleted and the futures will be marketed to hedge the fx side. This will help enormously, since costs are quite halved : the forex trade will not incur spreads. Say the futures quotes 1.3000/01 and basis estimated for today is 50 pips up, with fx being normally at fx-50 pips. So we have fx at 1.2950/01. Assuming a 2 pip up/down fluctuation, the trader will quote an fx bid @ 1.2948 and an fx ask @ 1.2952. If one of them is filled in a swift market action , which is presumable in higher volatility moments, the futures will be marketed.  Say the bid is filled and we have now a buy fx @ 1.2948. The ask is deleted and the futures is sold @1.3000. Ten minutes later, another volatile movement will close the gap. Futures quotes 1.3020/21, basis is skewed again, fx quoting not 50 pips lower, but 48, at about 1.2972, where will be closed. Trades will be:

long fx @1.2948 , close @ 1.2972 , profit 24 pips

short futures @  1.3000, close @ 1.3021, loss 21 pips

net profit 3 pips.

Needless to say, the quoting process is a continuous one. Quoting part can reside , from the standpoint of MQL programming either in OnTick() alone, or in both OnTick() and OnBookEvent() if multiple symbols are advised to send quote events, in a multiasset quoting machine. At every quote coming OnTick() or OnBookEvent(), the orders will be repositioned (thus quoting).

But the odds will work always against the retail trader. Forced to use only market execution and support probably big latency, now the platform will make the things slight easier. What is the difference?

Retail traders can’t quote. They always have only market execution. That means that instead of quoting, they have to do it all with pending orders. It’s more of a pseudoquoting instead of quoting, because traders don’t post “quotes” in the orderbook . So it will appear like it is pending orders management. Our MT5 trader will run the expert advisor on the futures contract, with small volatility. The OnTick() will be executed every tick, as it happened with start() in MT4. Every time the prices are different, orders will be deleted and resent to the market – same process as in quoting. But this time we have a superior tool : the OnTrade() event.

The OnTrade() event, as it is implemented now, doesn’t allow the trader to know which order has been filled. Even this way, a quick check can be implemented. It will not require a continuous check as in MT4, that was taking valuable time , causing the EA to skip quotes all the time. So right now retail traders have the ability to mimic pretty accurately what the professionals are doing. However, take into account that market needs to move more. Since your quoted prices are ask for a buy and bid for a sell, the market needs to move an extra pip each way to compensate for spread losses, which means exponentially less opportunities for retail traders. Take into account also futures slippage, that will be dangerous in both moments, when taking and closing the futures trade, because in these moments, the professional arbitrageurs put a heavy pressure on the futures, same as you do, but with a step forward…

An interesting feature of MT5 is the hated lack of hedging , which comes very handy in quoting. Instead of using global profit targets that will attract even more slippage when executed as order closes, the trader can quote his own exit of the situation. Again, as with taking the initial trade, opposite orders are quoted to trap volatility on the fx pair. Remember I wrote upper in the article, italic, what happens ten minutes later ? That was the normal version, supposing that we close trades. But what if we quote closing ?

Given that we have  bought or sold a spread, we can expect a market divergence from any of the two assets , of course with a higher chance on the forex side. So, we have to quote two orders. If one is filled, will clear the position on that side, and, with the add of the OnTrade() which will have the execution signaled, providing the means to close the other trade. For instance, right after taking both trades, the close trades could have been quoted:  short fx @ 1.2951, long futures @ 1.2997. Same as with the quoting process for taking trades, quoting for closing trades has to be continuous, quoting a large gap on both assets, with emphasis on the most liquid one. In MT4 environment, the “hedging enabled” facility would have made this impossible: other orders would not have closed the position, and a faint attempt to use automatic closes would have needed switching from stop loss to take profit…

This technique can be applied with commodities, stock indexes etc. All it matters is that the two assets must be linked by an arbitrage relationship. Take care, however, that execution is dependant on latency. And to have more often executions, is to “quote” the side that is more liquid, because it’s likely to be more volatile and generate more opportunities.

Good luck arbitraging! Without low latency, you’ll need the hell of a lot…

3 Responses to “ Quoting - A new activity in MT5 ”

  1. Nicolas Vitale on January 28, 2010 at 10:06 am

    First thank you for your great website.

    I would like to comment one of the last sentence of this article :

    “And to have more often executions, is to “quote” the side that is more liquid, because it’s likely to be more volatile and generate more opportunities.”

    As far as I know, it seems to me that it is the less liquid market which will be the more volatile. It is one of the arguments used by high frequency traders. As liquidity provider, they expect rebates and are good for “community” because thanks to this liquidity market are less volatile.

  2. Bogdan Caramalac, MQLmagazine sr.editor on January 28, 2010 at 11:13 am

    Thanks, Nicolas!

    Well, I think I viewed this thing in relationship to the slowness with MT4.
    Let’s consider a slow market, that has one new quote each second, and a fast market, that has 3 new quotes per second.
    If I run my EA on the slow market, quoting the fast one, I have to update the quotes every time the slow market changes (that is, one time a second).
    It means in this second there is a higher chance that one of the 3 new quotes on the fast market will be astray and fill my pending order. Given the latency of the slow market, I may have the chance to market a hedge order there until it has the chance to move.

    If I would do the reverse, I would run the EA on the fast market and quote the slow one. That would mean that I would update my pending orders 3 times a second; at this rate, the latency of placing orders would be higher than the fast market latency so I would skip quotes. Even if I’d be filled, the chance to correctly hedge quickly on the fast market would be diminished due to its low latency.

    I see a fast market like a car in the pole position in a race. The slow market is on the secondary position. Always, the average speed of the car on the first place is higher than the average speed of the car on the second place. I see the secondary market driven by arbitrageurs, that always will close the gaps between the slow market and the first market. That’s why I don’t quite the secondary market as moving astray from the first. And if it’s only following the fast one it means that I should never quote the slow market. If I quote the slow market and get filled, most likely the fast market already moved until I have the chance to hedge.

    I’m pretty sure that high frequency trading engines may play both games, but I have MetaTrader. I must play the game that I have more chance to win. If I quote the slow market and get a fill, most likely the fast market already closes the arb window before MT gets a chance to fill a market order. Add to this level I, and the system will lose pips in 90% of the situations, when taken arbitrage windows will be smaller than spreads and fees, because I most likely will not benefit of any rebates…

  3. Nicolas Vitale on January 28, 2010 at 11:58 am

    I totally agree with you with these precisions.