Trader's Handbook: orders, prices, stack, funds, currency - page 3

 

PAMM.

Let's build a simple mathematical model of classical PAMM-accounts and take a real example:

  • Manager's initial capital is $1 million (Depo).
  • Average daily (for a year) profit 0.5% (Profit).
  • Average daily (for a year) investment (investment rate in PAMM-account) 0.3% (Investor).
  • Commission from profit 20% (Fee) (manager takes 20% of profit and gives the rest to investors).

The model looks like this:

A model of a classic PAMM account.

This is the annual dynamics of our PAMM-account:

Annual dynamics of PAMM account.

  • Red - how many times the balance of PAMM-account will increase.
  • Blue - how many times the balance of the PAMM account manager will increase.
  • Purple - net performance (Gain) of PAMM-account (TC performance).

We obtained that the total balance will increase by ~7.5 times during the year, while the net performance will increase by ~3.5 times. This is quite good performance on the trust management market.

Let's look at the dynamics for a month:

Monthly dynamics of PAMM-account.
We got that average monthly Gain ~11.5% - this is a strong competition to fraudulent pyramid HYIP schemes of PAMM accounts.

Liquidity Ceiling.

Everything seems to be good, if it were not for one market pitfall: each TS uses certain market patterns, which always have their own liquidity ceiling - the maximum profit (in absolute values), which can be squeezed out of the available market liquidity by this pattern.

Therefore, let's take a look at what participation in a classic PAMM-account gives to the manager from a slightly different perspective - turnover growth (squeezed liquidity):

Dynamics of turnover growth VS Benefit from co-operation with investors.

  • Red - how much the turnover increases from co-operation with investors than if he trades without them.
  • Blue - how much the manager's balance increases from co-operation with investors than if he traded without them.

So we see that over the year, cooperation with investors in our example gave ~10% benefit, while the turnover increased > 2 times. As you can see, a serious skew: 1.1 vs 2.0 (10% vs 100%).

Exponential growth of a trading account is possible only up to the liquidity ceiling. After that, it is linear. For this reason, cooperation with investors may cease to be profitable as soon as the ceiling is reached. I.e. from that moment the manager can earn more if he trades only on his own than with investors.

Curiosity.

Imagine the same example: investments are made, but only the manager takes not 20% of profit, but 100%. In this case, the turnover will grow faster than the manager's profit from such a strange cooperation with investors:

The manager takes all the profits for himself.

This is not a paradox, as it may seem at first. The exponential model of profitability is simply broken here, when with the liquidity ceiling it is impossible to keep constant the value of relative profit (Profit parameter) - it decreases, because the absolute profit becomes constant.

The following statement is true: if there are rare investors who are ready to invest only one per cent of the received profit, then from a certain stage it will not be profitable for the manager to cooperate even with them.

 
Off-market.
Off-market quotes are not uncommon in institutional FOREX. They become a painful issue when deals are made on them. And it is especially painful when these deals have a high (in absolute terms) profit, regardless of its sign.
For various reasons MM-algorithms can fail, giving non-market quotes. In fact, they are quite marketable, as long as they offer to buy/sell at them. But there is usually an obvious loophole in the concluded agreements, when deals made at off-market quotes can be cancelled (and are often cancelled).
Off-market prices are always determined retrospectively through comparison with price histories from multiple sources. If there is a strong outlier, compared to the rest, then it is an off-market quote.

LastLook.
LastLook's right is to refuse to execute at their own suggested price. This is used by some LPs in the direction of toxic clients: if the request comes from a toxic client - do not execute, if it comes from a leaker - execute.
Because of this, the quality of execution drops greatly, increasing the number of redirects. They are fought through algorithmic pricing in some aggregators.
There are sites without flipper, but in case of obvious toxicity, what I described earlier happens in the end: either the site refuses from the toxic client, or from the LP, which suffers losses from this toxicity.

Trader's defence.
An unsophisticated legally profitable trader on institutional FOREX can be easily "undressed", through Off-market and LastLook mechanisms. Therefore, it is reasonable to choose a place for trading through the most advanced aggregator, which neighbours with a strong legal department.
That is, in addition to the fact that the trader will be anonymously represented in the general flow of the aggregator. He will also receive free legal professional assistance in dealing with problems with cancelled trades. Free of charge, because the legal department defends not the trader's rights, but the person of a much larger owner of the aggregator, on behalf of whom, in particular, this trader made transactions. For this, of course, there must be a principled position of the owner.

P.S. Stages repeatedly passed in practice.
 
Virtual aggregator.

As already mentioned, an aggregator is a high-level union of cointegrated symbols. Note that no restriction is placed on the reality of such symbols.

This means that if there are synthetic cointegrated symbols, they can be not only created, but also aggregated.

This is what a virtual aggregator does - it aggregates cointegrated synthetic feeds (price streams) into one high-level (virtual, of course) symbol that can be traded.

Virtual aggregators have the same property as classical ones - they mask toxics, create the best prices, increase instant liquidity, raise the liquidity ceiling of the TS, etc.

Most often the creation of virtual aggregators falls on the shoulders of algotraders. The most advanced classical aggregators can partially do the same: aggregate not only explicitly existing symbols of LPs, but also their synthetics.

A primitive example of visualising the simplest part of a virtual aggregator is the aggregation of synthetic feeds:

Primitive real-time visualisation of synthetic Level2.


The most adequate evaluation of any symbol occurs when analysing its high-level aggregated namesake.
 
Correct calculation of currency swaps.

The value date (final settlement) on the Spot FOREX market is two working days behind the date of the transaction for the currencies involved in the transaction. For this reason, the value date of transactions made on Wednesday is two days longer than for other weekdays. Because of this, triple tariff for prolongation of open positions is charged on overnight.

There is a synthetic financial instrument - LIBOR. It is a loan rate for borrowing a certain currency. Roughly speaking, you have taken a loan in a certain currency at LIBOR rate.

There is a similar inverse rate - LIBID. This is the deposit rate for depositing a certain currency. Roughly speaking, you have made a deposit in a certain currency at the LIBID rate.

Obviously, it is always LIBID < LIBOR, as there are practically no free loans. By unwritten rule, LIBID ~ LIBOR * (1 - 1/800), i.e. LIBID is approximately 1/8% less than LIBOR.

LIBOR rates are calculated and published daily by the British Bankers' Association (BBA). And their value depends on the term of currency borrowing (how long the loan is taken for). For FOREX the shortest rate is used - LIBOR Overnight.

LIBOR rates are always expressed in per cent per annum. Accordingly, to arrive at a daily value, you should divide the rate by 365 days (we do not take into account possible reinvestments). In the following we will talk about LIBID and LIBOR rates, having in mind daily values.

Let's see what happens when you open a BUY AUDCHF position. You borrow CHF at LIBOR_CHF rate and place AUD at LIBID_AUD rate. In this case, on the day of opening the transaction, no write-offs/accruals on the rates are made. I.e. short-term loan/deposit is free for you.

But at the moment of value date there are two options how you can proceed:

1. Close the position and immediately reopen it. You will get the free credit/deposit again. But you will lose on the spread, which is widening significantly at this moment for a reason.

2. Extend your position by making settlements for the existing credit/deposit. Here there will not necessarily be losses, there may be replenishments.

The first option is at the trader's discretion. The second one is used most often.

Since you act through an intermediary - broker, you pay for his services additionally. The broker takes a part of debits from the loan and accruals from the deposit to himself. Usually it is some fixed percentage - MarkUp.

So, let's summarise, taking the already familiar BUY AUDCHF example. We have invested $1000 in buying AUDCHF asset. Accordingly, we placed $1000 AUD-currency and attracted $1000 CHF-currency. It means that on AUD-deposit we will receive overnight accruals at LIBID_AUD rate, and on CHF-loan we will receive write-offs at LIBOR_CHF rate. The sum of these values is called a currency swap:

Swap = (LIBID_AUD - LIBOR_CHF) * (1 - MarkUp), of course, we did not forget to "thank" the broker.

At the moment of writing this article such Swap for BUY AUDCHF is equal to +0.01%. I.e. if you trade with 100:1 leverage, you will get overnight 1% of your investment in BUY AUDCHF - that's $10.

This is the whole methodology of currency swaps calculations.

How brokers earn on swaps.

A broker, having a large client base, makes a swap calculation for each client position. The client is not offended, of course. But the broker does not actually have the same number of positions as the client. He has positions that are close (not exact, as multidirectional positions in liquidity aggregators are observed very often) to the net positions of all clients at once. This means that the broker itself pays much less in swaps than the total amount its clients pay to the broker itself. This is an absolutely legal way of earning money as an advantage of its diverse client base. The smaller the net position, the more the broker earns on swaps. I.e. it is profitable for the broker when clients are worth differently in total. And let's not forget that the broker receives MarkUp additionally.

Also, brokers often use their own methods of swap calculations, which are not market-based at all. Due to this they get additional profit. As a rule, such brokers refuse to disclose the methodology of their swap calculations. Most often they simply copy swap values from larger representatives of the industry.

Strategy on swaps.

Above was an example with BUY AUDCHF, where it was shown that every day you will receive 1%. Without reinvestment, that's 365% per annum. Some people may be tempted to just buy AUDCHF and get their hundreds of per cent profit in a year. But it is not that simple. If you look at how the AUDCHF exchange rate has changed over the year, you can see that it is 40%. This means that with a leverage of 100:1 the changes were 4000%. That is, the risk of losing everything is much higher than the hypothetical profit of 365%.

But here you may want to create a basket of several assets (synthetics), which would change by a smaller amount than its swap.

Let's consider an elementary stationary synthetic with a minimum range of its price: SELL EURUSD, BUY GBPUSD, BUY EURGBP.

Swap = (LIBID_USD - LIBOR_EUR + LIBID_GBP - LIBOR_USD + LIBID_EUR - LIBOR_GBP) * (1 - MarkUp) = ((LIBID_USD - LIBOR_USD) + (LIBID_GBP - LIBOR_GBP + (LIBID_EUR - LIBOR_EUR))) * (1 - MarkUp) < 0.

It turns out that for such simple synthetics the swap will always be negative. So we throw such synthetics out of consideration.

We can also note that SWAP(EURGBP) ~ SWAP(EURUSD) - SWAP(GBPUSD), by analogy with the approximate equality log(EURGBP) ~ log(EURUSD) - log(GBPUSD).
True, SWAP(EURGBP) will be slightly more favourable than (SWAP(EURUSD) - SWAP(GBPUSD)) by the amount of (LIBID_USD - LIBOR_USD). But this is such a small value that it can be neglected.

This means that the opening on the cross and the opening on the synthetic cross are equal from the swaps point of view. From this we can conclude that the synthetic we are looking for should only consist of majors.

Let's summarise the strategy in terms of swaps. We need to create a synthetic of majors that has a range of relative price change smaller than its swap. This is a solvable optimisation problem. Having further its nuances of rebalancing synthetics, etc.

P.S. The article is from 2011.

Документация по MQL5: Торговые функции / PositionsTotal
Документация по MQL5: Торговые функции / PositionsTotal
  • www.mql5.com
Торговые функции / PositionsTotal - Документация по MQL5
 

Rollover fees - Rollover or SWAP points

Before proceeding to the methodology of calculating the amount of payments for prolongation of positions, it is necessary to clearly outline the essential features of trading on the Over-the-Counter (OTC) foreign exchange markets. Transactions on the OTC FOREX market are carried out on the principle of margin trading. This means that the broker gives you the opportunity to work with amounts that are significantly larger than your deposit (your own funds deposited as collateral). The basis of this type of trading is that the broker provides the trader with leverage or, as it is also called, financial leverage. In other words, it is speculative trading operations with the use of money provided on credit against collateral (margin). A margin loan differs from a simple loan in that the amount of money received is several times (sometimes hundreds of times) higher than the amount of collateral. The following are the main distinctive features of the FOREX market:

All trading operations are carried out with the value date Spot, ie settlements are made on the second working day after the day of the transaction. In this case, the value date is only working days for a given currency. For this reason, the fee for prolongation of positions from Wednesday to Thursday is three times higher than on other days, as banks do not carry out conversion operations on Saturday and Sunday. It should be borne in mind that national holidays or other events due to which the central banks of the country are closed can also be the reason for postponing the value date. Banks, companies, private funds, etc. perform speculative operations on the Spot market. The rules of this segment of the market are not clearly fixed, but all participants follow such customs as :
- making payments within two working banking days without charging interest rate on the amount of currency delivered (not to be confused with charging interest on margin credit),
- transactions are mainly realised on the basis of computer trading with confirmation by electronic notices,
- rate binding, i.e. the announced quotations are binding for the execution of currency purchase and sale transactions.

The overwhelming majority of transactions on the OTC FOREX market are speculative in nature and do not involve physical delivery of traded currency volumes, i.e. the client must close the transaction in order to fix the financial result. If the Broker does not receive a corresponding instruction to settle the open position before the end of the trading session, he has the right to prolong the contract at his discretion and under the Trader's responsibility, i.e. to postpone the transaction to the next trading session, thus moving the value date by one day - such operation is called SWAP or Rollover. Each time positions are prolonged and up to their closing, both positive and negative payments may be credited to the trading account. The basis for such payments is an increase in the period of using the credit obtained by using the leverage provided by the Broker.

The amount of payments for prolongation of an open position depends on:
- Difference in rates of placing/borrowing overnight of currencies included in the financial instrument - it is LIBOR overnight for credit (attraction) and LIBID overnight for placement of free funds. The use of the shortest deposit/borrowing periods is due to the fact that it is not known in advance how long a trader will keep a position open. LIBOR overnight rates are calculated and published daily by the British Bankers' Association (BBA);
- The type and volume of the transaction, as well as market quotes at the time of rollover;
- Mark-up (a fee to the Broker for carrying out prolongation operations).

At present two methods of payment for prolongation of transactions are widely used. These are:
A) SWAP operations - simultaneous conclusion of two opposite transactions with different value dates, one of which closes an already opened position at the last price of the trading session, and the other immediately opens a similar one, and at a price that takes into account the amount of payments for prolongation, which is determined at the time of SWAP operation (as a rule, it is the time of the official start of a new trading session),
B) Rollover operations - charging or writing off to the trading account the amount of prolongation payments expressed in the deposit currency.

Let's consider by example the calculation of SWAP value for a transaction with the following parameters:
Financial instrument: EUR/AUD (EUR - Base currency, AUD - Quotation currency);
Transaction type: SELL (EUR - currency of attraction, AUD - currency of placement, as the volume in EUR is sold for AUD);
Trading platform currency: USD.
For this example: Transaction volume: 3.65 lots (1 standard lot = 100,000 units of Base Currency);
Last Quote of the Session for EUR/USD: 1.5089/91;
Last Quote of the Session for AUD/USD: 0.9295/98;
Last quote of the session for EUR/AUD: 1.6224/34;
LIBOR overnight EUR: 0.30750%;
LIBID overnight AUD (normally LIBID = LIBOR - 1/8%)*: 3.5875% = 3.71250% (LIBOR overnight AUD) - 0.125%;
http://www.ehow.com/list_6731458_differences-between-libor-libid.html:"LIMEAN in the Middle"

Broker's Mark-up: 0.25% (Brokers usually charge between 0.25% and 0.75%);

1. Let's calculate the volume of this trade expressed in USD at the moment of prolongation:
Volume = 3.65 x 100.000 x 1.5091* = 550,821.5 USD
*in this case to calculate the volume of the Base currency of the financial instrument it is necessary to use ASK of EUR/USD quotation, because for SELL EUR/AUD operation it is necessary to have for sale the amount in EUR.

2. Let's calculate the cost of attracting EURO for the trading volume of this operation expressed in USD based on the LIBOR overnight EURO rate and taking into account the Broker's Mark-up (when attracting funds, the Broker's Mark-up is added to the LIBOR overnight rate):
Cost of Raising = 550,821.5 USD x ((0.30750 + 0.25) / 100 / 365) = 8.41 USD

3. Let's calculate the cost of AUD placement for the trading volume of this operation expressed in USD based on the LIBID overnight AUD rate and taking into account the Broker's Mark-up (when placing funds, the Broker's Mark-up is deducted from the LIBID overnight rate):
Placement Cost = 550,821.5 USD x ((3.5875 - 0.25) /100 / 365) = 50.37 USD

4. Let's calculate the cost of SHORT rollover payments for EUR/AUD denominated in USD (SHORT, since the Sell transaction is being rolled over in this example):
Rollover SHORT (USD) = Cost of Placement - Cost of Attraction = 50.37 - 8.41 = 41.96 USD

5. The value of one pip for Sell EUR/AUD expressed in USD at the time of rollover is:
1 pip Value (EUR/AUD) = Transaction Volume x (10 x 0.9298)* = 3.65 x 9.298 = 33.93 USD
*One pip of any currency pair is equal to 10 units of the Quoted currency. The use of the ASK price of the last session quote for AUD/USD in the calculations is due to the fact that this is the price at which AUD could be purchased when the settlement currency is USD.

6. Let's calculate the value of payments for SHORT transaction prolongation expressed in pips:
SWAP SHORT (pips) = Rollover SHORT (USD) / 1 pip Value (EUR/AUD) = 41.96 / 33.93 = 1.24 pips

Thus, depending on the method of making payments for rollover transactions, an operation will be performed on the trading account:
- SWAP SHORT - closing Sell EUR/AUD position at the price of 1.623400a and opening a new position with the same parameters at a more favourable price of 1.623524a, which is 1.24 pips higher than the closing price,
or
- Rollover SHORT - charging the trading account 41.96 USD
a in trading terminals that use SWAP, prices with 8 - 10 decimal places can be used.
b because the Cost of placement is higher than the Cost of attraction,
The calculations for operations with other currency pairs and types of operations are similar. It is necessary to take into account that for BUY operations the Base currency is the subject of placement and the Quoted currency is the subject of borrowing.


There are methodologies for calculating the cost of prolongation of open positions on the basis of current values of base rates of central banks for lending to commercial banks of the country. In the opinion of the author of this article - this approach is not correct, because it does not take into account the difference of rates on attracting or placing funds.

In favour of the above methodology based on the use of short-term rates is also the fact that in periods of liquidity crises overnight rates can be many times higher than the current base rate of the central bank. The use of long-term rates in calculating the cost of prolongation of positions for the next trading session under such conditions cannot correspond to the economic essence of this operation. To confirm the above, we can consider the chart of LIBOR overnight USD rate dynamics in the second half of 2008 (see chart - US dollar LIBOR rates charts). The chart shows that LIBOR overnight rates reached values around 6.5%, while the FED rate for the same period was at the level of 2% (see the table - Fed federal funds rate).

US dollar LIBOR rates charts:



Fed federal funds rate
12-16-2008 0.250%
10-29-2008 1.000%
10-06-2008 1.500%
04-30-2008 2.000%
03-18-2008 2.250%
01-30-2008 3.000%
01-22-2008 3.500%
12-11-2007 4.250%
A clear understanding of the methodology of calculating the cost of overnight rollover is necessary for FOREX market participants, especially beginners, to optimise their trading strategies and to choose a Broker.



Methodology of calculation of SWAP / Rollover values when performing operations with precious metals under margin trading conditions.

First of all, it is necessary to outline the essential differences between operations with precious metal carried out on "SPOT" and "SWAP" terms.

The purpose of "SPOT" type operations is execution of client orders by a credit institution or management of its own precious metals fund, i.e. operations related to physical delivery of metal to a buyer. All transactions of this type are carried out on "spot" terms with value date on the 2nd working day after the day of conclusion of the transaction, where value date is the date of crediting-writing of metal and currency according to the full volume of the transaction. The basis for determination of price parameters of transactions on the market "SPOT", for example for gold, is the price of London market - loco London, where "loco" means the place of metal delivery, which is the most important condition of transactions with physical gold.

SWAP" type operations, as applied to the gold market, is the purchase and sale of metal on "SPOT" terms with simultaneous execution of the reverse transaction on "FORWARD" terms, where the date of execution of the closer transaction on "SPOT" terms is the value date, and the date of execution of the more distant transaction is the date of swap termination. The essence of the operation is the possibility of converting gold into currency with retaining the right to redeem gold at the end of the swap and vice versa. The redemption price is the forward price, which is determined at the time of the transaction on the basis of the gold price on SPOT terms and the interest rate on borrowings or deposits for the precious metal and the transaction currency in effect at the time of the transaction. Such agreements can be concluded for almost any term: from one day to several years. When such transactions are carried out in the over-the-counter market using leverage, where any trading participant can withdraw from the transaction at any time, SWAP transactions are used with a term of one day.

Like currencies, precious metals can be placed as a deposit or transferred as a loan. Such situation has developed due to the fact that a significant part of gold reserves is a part of reserves of central banks, which would like to derive additional income from it. As a result, a very developed international market of gold credit has been formed. A bank, attracting precious metals within the framework of deposit agreements, can use them for a certain period of time in schemes of financing gold mining, for arbitrage operations, etc. Owners of gold receive income on the invested gold and are also relieved from the costs associated with the storage of physical metal.

Let's consider the essence of LONG and SHORT operations of one standard lot on GOLD (100 troy oz) at the spot market price of 1604.15/25 USD per one troy ounce (1 troy oz) in the OTC market with the application of leverage;

Transaction TypeLeveraged loan
Placement(Deposit)
Note (all rates are overnight)
LONG $160.425100 troy ozUSD Loan at % Libor ($160.425), Gold Deposit at % GLOR (100 troy oz)
SHORT 100 troy oz$160.415
Loan GOLD at % GLBR (100 troy oz), Deposit USD at % Libid ($160.415)

Where,
Libor - London Interbank Offered Rate is the weighted average overnight interest rate on interbank loans provided by banks in the London interbank market offering funds in different currencies.(http://www.bbalibor.com/bbalibor-explained/the-basics)
Libid - London Interbank Bid Rate - weighted average overnight interest rate at which banks are willing to accept deposits from other banks.

The Libor and Libid rates have been fixed by the British Banking Association since 1985 at 11:00 a.m. Western European time every day based on data provided by selected banks. There is a small spread between the fixed LIBID and LIBOR rates (with the LIBOR rate being higher than the LIBID rate). The rates themselves are set as a result of active interbank trading and are continuously changing in an attempt to balance the supply and demand for funds in the interbank market. There is no formal fixing procedure for LIBID rates, it is accepted that LIBID = (LIBOR - 0.125%) (a difference of 1/8 basis point).(https://en.wikipedia.org/wiki/London_Interbank_Bid_Rate).


Libor values for each currency are published daily on the British Banking Association website http://www.bbalibor.com/rates/historical.(see below).
1-Feb 2-Feb 3-Feb 6-Feb 7-Feb 8-Feb 9-Feb 10-Feb
EUR
s/n-o/n 0.28286 0.28286 0.28286 0.28286 0.28143 0.28143 0.28143 0.28143 0.28143
1w 0.34443 0.33943 0.33871 0.33643 0.33286 0.32986 0.32271 0.32129
2w 0.40543 0.39900 0.39614 0.38857 0.38214 0.37743 0.37057 0.36314
1m 0.64143 0.63143 0.62357 0.61143 0.60071 0.59214 0.58214 0.57500
2m 0.82271 0.81214 0.80357 0.79500 0.78357 0.77414 0.76657 0.75586
3m 1.04943 1.03971 1.03171 1.02214 1.01786 1.01086 0.99943 0.99157
4m 1.16071 1.15143 1.14714 1.13643 1.12829 1.12300 1.11300 1.10671
5m 1.25857 1.24929 1.24357 1.23571 1.22714 1.21929 1.20929 1.20429
6m 1.36643 1.35714 1.35143 1.34214 1.33857 1.33143 1.32357 1.31786
7m 1.43714 1.42786 1.42214 1.41286 1.40500 1.39786 1.39143 1.38429
8m 1.49929 1.49000 1.48429 1.47643 1.46757 1.46000 1.45214 1.44500
9m 1.55714 1.54786 1.54071 1.53286 1.52529 1.51786 1.51000 1.50286
10m 1.61214 1.60429 1.59857 1.59071 1.58171 1.57429 1.56643 1.55929
11m 1.66714 1.65929 1.65500 1.64571 1.63929 1.63214 1.62286 1.61714
12m 1.72000 1.70929 1.70500 1.70000 1.69214 1.68500 1.67714 1.67143

USD
s/n-o/n 0.13900 0.14100 0.14200 0.14150 0.14400 0.14200 0.14200 0.14200
1w 0.19520 0.19550 0.19550 0.19550 0.19500 0.19400 0.19220 0.19120
2w 0.22400 0.22350 0.22250 0.22150 0.22100 0.22000 0.21950 0.21850
etc.

GLBR - Gold Lease Bid Rate - weighted average interest rate that bidders are willing to pay for leased gold bullion - borrowing.
GLOR - Gold Lease Offered Rate - weighted average interest rate at which market participants are ready to lease gold bars - placement.

GLBR and GLOR rates - interest rates, which in physical terms are paid on gold deposits and borrowings by commercial banks - gold dealers, so-called Bullion Banks. These rates are quoted in the market with a spread of approximately 20 points, i.e. GLOR = (GLBR - 0.20%) (http://www.lppm.com/OTCguide.pdf page 21). There is no formal fixing procedure for GLOR and GLBR rates. Instead, the London Bullion Market Association (LBMA) calculates daily the weighted average interest rate GOFO mean (Gold Forward Offered Rate), which is an international benchmark for SWAP-type transactions in relation to the gold market and is calculated for 1, 2, 3, 6 and 12 month periods. GOFO values are published daily on the website of LBMA, Reuters, etc. at 11:00 (London time) and are considered by gold market participants as equivalent to the Libor Rate for currencies. The GOFO mean is calculated based on interest rate data from at least six LBMA member gold market makers (NM Rothschild & Sons Ltd, Bank of Nova Scotia, Deutsche Bank AG, HSBC Bank USA, Societe Generale, etc.). The values of the highest and lowest rates are excluded from the calculation of the average. Assuming that interest rates on gold loans and deposits are quoted with a spread of 20 (twenty) basis points on average, we can present the averaged values of GLBR and GLOR in the form:

GLBR = (GOFO mean + 0.1%) GLOR = (GOFO mean - 0.1%)


GOFO mean values are published daily on the Precious Metals Market Association of London website http://www.lbma.org.uk/pages/index.cfm?page_id=55&title=gold_forwards&show=2012. (see below).
DATE 1 Month 2 Months 3 Months 6 Months 12 Months
01-May-12 0.36200 0.38800 0.41400 0.48400 0.55800
02-May-12 0.36000 0.38200 0.41600 0.48400 0.55000
03-May-12 0.36200 0.39000 0.42600 0.49200 0.56200
04-May-12 0.35000 0.38200 0.41000 0.47800 0.55200
08-May-12 0.33000 0.36600 0.39400 0.47200 0.54000
09-May-12 0.32667 0.36000 0.38333 0.47000 0.54667
10-May-12 0.35333 0.38167 0.41167 0.49000 0.56667
etc.


Let's calculate the SWAP value for LONG and SHORT positions for the financial instrument GOLD/USD:
SWAP(long) = V*GOLD/USD(ask)*(1/365)*GLOR /100 - V*GOLD/USD(ask)*(1/365)*Libor/100
SWAP(long) = V*GOLD/USD(ask)*(1/365)*( GLOR - Libor)/100,

Express GLOR as GLOR = (GOFO mean - 0.1%), we get the final formula for,
SWAP(long) = V*GOLD/USD(ask)*(1/365)*(GOFO mean - 0.1% - Libor)/100

similarly for SHORT:
SWAP(short) = V*GOLD/USD(bid)*(1/365)*Libid /100 - V*GOLD/USD(bid)*(1/365)*GLBR/100
SWAP(short) = V*GOLD/USD(bid)*(1/365)*(Libid - GLBR)/100.

Expressing Libid = (Libor - 0.125%) and GLBR = (GOFO mean + 0.1%), we get the final formula for,
SWAP(short) = V*GOLD/USD(bid)*(1/365)*(Libor - 0125% - (GOFO mean + 0.1%))/100.

We get the formulas as given:
SWAP(long) = V*GOLD/USD(ask)*(1/365)*( GOFO mean - LIBOR - 0.1%)/100
SWAP(short) = V*GOLD/USD(bid)*(1/365)*( LIBOR - GOFO mean - 0.225%)/100.

Where,
V - volume of the deal expressed in troy ounces,
GOLD/USD(ask), GOLD/USD(bid) - price of the financial instrument at the moment of SWAP calculation.

1/365 - SWAPs on OTC market are calculated every calendar day,

LIBOR, LIBID, GLOR, GLBR, GOFO mean* - see above,
(*For the purpose of these calculations, GOFO mean rate is used for the minimum published period of time - one month).

The dealer, providing services for transactions on Gold OTC market applies to the rates of LIBOR and GOFO mean, the so-called Mark Up - an additional interest accrued for the execution of the transfer of positions to the next value date, usually from 0.25 to 0.75%. In practice, this leads to the fact that the client receives a slightly lower interest when placing metal and pays a slightly higher interest when borrowing.

The formulae for calculating SWAPs for Silver can be derived in a similar way.
The Differences Between LIBOR & LIBID | eHow
The Differences Between LIBOR & LIBID | eHow
  • Alex Kocic
  • pocketsense.com
How the Two Rates Are Set Every day, a group of major world banks tell the BBA what rates they expect they will have to pay and be willing to pay on loans taken or given. After discarding the top four and bottom four figures, the BBA comes up with the two averages, which are then published at 11 a.m. London time (6 a.m. EST). The BBA lists...
 
Rough algorithm for obtaining T&S data from Level2.
Let's imagine that we have some sequence of Level2 values - large vectors, where each price level corresponds to its volume (gangs). Let's number the elements of this sequence from zero (current), towards the past.

ECN (exchanges).
We compare Level2[0] and Level2[1]. If Bid[0] >= Ask[1], then all gangs from Level2[1]_Ask that are not higher than Bid[0] go to T&S. Similarly for the situation Ask[0] <= Bid[1]. In other cases, nothing gets into the simulated T&S.
This algorithm can be easily checked on the link to the T&S data officially provided by exchanges. Then to make some improvements through unequal gang distributions, etc.. In general, the topic digs always from the coarse model above.

STP (preferably a lot of LPs).
Vector_Ask[0] = Level2[0]_Ask - Level2[1]_Ask. This vector has all negative values summed from the best (in terms of price) band until the first non-negative band is encountered. This sum is entered into T&S[0]. With Bid, it is similar.

ECN/STP.
It is more complicated here, because we need to combine two almost contradictory methods for ECN and STP. I will not describe it.

Why T&S?
I have already described its applicability in MM-algorithms. Also, for example, it is possible to estimate price levels of serious volumes and analyse their influence on distant (seconds, minutes, hours) price targets.
In FOREX, in order to evaluate interrelations between all symbols, it is sometimes reasonable to use Level2 not of symbols, but of currency pairs (build a synthetic Level2 yourself).
 
Off-topic.

As it turned out, it is not enough to write a handbook, you have to teach how to read/receive it correctly.

Reading/perception speeds.
Classical reading speed (CRS) - the number of letters (words) per unit of time.
Information perception speed (IPS) - the amount of understanding/digestion of the contained information per unit of time.
In most cases, in each person, the value of CRS is almost unaffected by the true content of what they read. This is a terrible scourge of information perception, from which it is necessary to get rid of in the direction of constancy not of BCC, but of SWI.
Let's take a simple example. Most people read fiction and science literature with the same BCC. That is, when reading a scientific work, the brain is practically idle, running through a set of letters. In the case of fiction, this is sometimes justified. But not in other cases.

How to read a liter ary text.
It is necessary to switch from the widespread constancy of BCC to the infrequent constancy of SWI.
For example, to go into the meaning of several sentences for orders of magnitude longer (if necessary) than if you just read it with your BCC.
The fact is that most people read a given literary text within ~ half an hour. And this time depends, as a rule, only on the individual BCC. As a result - "abstruse and unnecessary". Which, of course, is not the truth.
In fact, the amount of information contained in the presented lecture is so large that the time of its perception should be measured in days.
If you haven't spent several days for digesting what you read here from time to time, it is highly probable that you haven't fully understood what is written.
It is unlikely that you will get into it if you don't start parsing each paragraph with pen and paper, building various schemes and variants. Trying something in terminals and finding or refuting various conjectures/assumptions arising during thinking.

Determination of quality of perception level.
When any question (one's own or someone else's) can be easily accommodated in the created near-market understanding, we can say that the picture of market fundamentals is qualitatively collected. If something doesn't fit - close the gap by any means except one: closing your eyes.
 
Order allocation.

This is the name of the rule (algorithm) of distribution of filling (at execution) of limit orders located on the same gang.
For example, several orders are located on the best gang, the total volume of which is greater than the incoming volume of a market order from PriceTaker. It is clear that PriceTaker will receive the full execution volume at the price on the best gang. The question arises, how to distribute this volume among the orders that were on the gang?
And here each system has its own vision of how to do it correctly.

Pro-Rata.
This is a classic allocation rule, where at the time of execution all bids have an execution ratio that corresponds to the portion of the volume that the bids contribute to the total volume of the gang.
This means that it doesn't matter if you break your limiter into chunks, in what order you send those chunks. The execution will always be the same.

FIFO.
This is where the timing of the limiter's staging reigns supreme. Limiters are filled by priority: until the previously placed limiters are filled completely, other limiters will not be filled.
With this allocation rule, PriceGivers try to place their limiters before the others in order to increase the probability of their execution. As a consequence, it causes spread narrowing and volume reduction on the gangs, because if someone has placed his bid on a new gang (reducing the spread), another participant has no desire to join this gang, as he will be an outsider before the more nimble one anyway.
When placing an order for a new gang, it is sent either in full volume or broken into pieces in descending order, placing them in the same sequence in the queue. This allows, if necessary, to remove a part of the volume of your request (according to the stack principle) without losing the execution priority.

Volume (Weigth) FIFO.
I made up the term on the fly. The priority is based not on the time of placing, but on the volume of the order (or another custom attribute - Weight).
This allocation encourages PriceGivers to fill the best gangs with maximum liquidity. For PriceTakers, this is one of the best rules of thumb.

Weight Pro-Rata.
Also a term coined. It is a modification of Pro-Rata, where bids are no longer given the same distribution weights, but depending on the Weight attribute.
For example, any distribution (mat. term) can be used according to the time of bidding: the earlier you bid, the higher the weight. In particular, it is common to use a matrix linear distribution by time (Time Pro-Rata).
The same is done for Volume and even for more complex attributes (e.g. Weigth = TimeLive * Volume).
At such approach various mathematically grounded methods of optimal order placement are applied - maximisation of probability of the highest probability of execution of orders from a market participant by total volume. I.e. there are algorithms, how to split the order into pieces and in what sequence to send them to the band.

What they use and why.
Each marketplace comes up with its own rules of allocation, or uses those already worked out by someone else. Depending on the goals that it pursues. It is clear that the main goal is to increase profits, ie increase turnover. And then there is a non-trivial question of choosing an algorithm of allocation. In order to motivate PriceGivers and PriceTakers activity not to reduce. It all depends on the existing client base of the site and prospects of development.
Most often they do not bother and choose simple variants: Pro-Rata and FIFO.
FIFO variants are the only algorithm where there are no collisions with the minimum allowable volume (lot).
 
PriceTakers vs PriceGivers.
When T&S data has a classification by direction, we can talk about the overall trading performance of PriceTakers or PriceGivers.
Let us further assume that the mentioned direction refers to PriceTakers. This is a convention in fact, as PriceGivers-directions are just with the opposite sign.
Let's remember that each element of the T&S-sequence represents data on a deal made by one of the PriceTakers: price, volume and its direction.
It means that we are quite able to build the dynamics of changes in the total Equity of all PriceTakers for each symbol separately and, respectively, for any set of symbols. Moreover, in FOREX, considering all crosses and majors at the same time, we can build the dynamics of changes in the total currency profile of PriceTakers: how much currency PriceTakers have "on hand".

Level3--.
There is such a notion as Level3 - it is complete information about the current state of each market participant. Roughly speaking, it is a well-guarded insider. However, as mentioned above, we can get close to it by calculating Equity_PriceTakers.
Let me remind you, the actual purpose of PriceTakers is meat for PriceGivers, among which there are very strong market participants. I.e. algorithmic pricing itself serves to enrich PriceGivers by draining PriceTakers.
So PriceGivers will do everything to make Equity_PriceTakers decrease. Therefore, the use of such an easily calculable algorithmic insider seems reasonable from the point of view of the nature of the modern electronic financial market.
 

Anexample of using peculiarities of ECN pricing algorithms in pair work ofPriceTakers and PriceGivers.


Writing the framework of this TS took one and a half hours. And three times more - debugging. The main time was spent on fighting with bugs of ECN itself, MT4 bridge and MT4 terminal (crooked updating of order tables - fake limiters, etc.).

The result was ridiculous, as well as the spontaneous idea of creating the TC. The purpose of publishing was the same as always: to motivate to improve literacy (despite the expected discrediting of myself and failure of the idea itself).

PriceGiver.mq4 is the simplest MM-algorithm: spread trading against draining PriceTakers. In this case, for the sake of simplicity, no classification (the main trick of any MM-algorithm) of PriceTakers was made. And the simplest variant was chosen: to create a draining PriceTaker.

PriceTaker.mq4 is the draining hamster.

It is clear that PriceGiving is possible only on ECN/STP platforms. This TS, in particular, shows the advantage of such platforms: you can trade against other clients. That is, you can use MM algorithms. In this case, you will not be a toxic. I spoke about simple variants of realisation of classifiers of market participants...

Consider this TS as a practical tutorial.

Of course, you can outshine any results of demo contests (for example, this one (www.dukascopy.com/strategycontest/)) with this TS. But do not forget what these contests are held for and who "orders the music". To avoid unnecessary headaches for the organisers of such contests, I recommend to hold them where you can't be a PriceGiver. I.e. on STP-platforms (without ECN).

Keep in mind that such TCs can be used to transfer money from one account to another. For example, there can be fraudulent money management schemes, when the manager collects a substantial amount of investor's money and then transfers it to his account, losing on commissions.

Overflow may also be of interest for money laundering schemes, avoiding other types of liability, etc.

It is important that you now have theoretical and practical data on the realisation of this type of activity. Well, and, of course, theoretical and practical basis for creating your own MM-algorithms.

Trade with limiters, create your liquidity on ECN/STP platforms - it is profitable.

Note that MM-algorithm does not require such spread trading at all. It is enough to choose a weakly changing FI (or create a synthetic one). For example, EURDKK (or EURUSD * USDDKK). The FI flatness serves as a measure of MM algorithm risk: the less it changes during the time of position opening - the lower the risk. The same synthetics still allow to disguise MM-algorithm from simple detection. In particular, the same "overflow" can be realised in a way that is difficult to identify.

In general, generalise, think, experiment, research - it is useful.

ECN/STP-platforms got one more tool for testing and revealing subtle bugs of ECN pricing and execution. MT4 problem areas have been exposed once again. Perhaps, the public will finally raise the question about their relevance of fixing....

The demonstration work of the TS is finished. If you find it interesting - I will be glad to receive any feedback.


Forum thread https://www.mql5.com/ru/forum/14166

Original source: http://www.forexfactory.com/showthread.php?p=6985317#post6985317
Files:
ECNTest.zip  12 kb
Reason: