Imagine you’re in the subway. You take the first train you can catch and pass by a random number of stops in a random direction, then transfer to another train. You go by another number of stations, and repeat the process. Your travels have both a random component (your random decisions) and a deterministic one (the subway routes and timetables, which all are connected rigidly).
Next, assume your transfers find you on an express train with a stop at the end of the route. Suddenly, while it contributed significantly to where you now find yourself, the random element is gone. Your fate is set. You quickly will travel to the end of the line and depart.
As it turns out, this process closely resembles that of the forex markets. In financial markets, similar situations also happen, except that Markov criterion is the subway timetable and bars on the price chart become stations. Here, we’ll examine these processes in the context of the forex market on a daily time frame, with all calculations relating to closing of the trading day. Following an overview of Markov chains and a discussion of this unique way of viewing the market, we’ll demonstrate an algorithm to build a simplified model for independent research.
Markov chains in FX
Millions of trading operations are performed in the forex market daily. When most of its participants share different views, the market moves sideways, but if there exists a prevailing sentiment, we witness stable price development. In the course of this development, every day has a certain connection with all previous days. This is a price memory that grows weaker as the market trades through time.
In mathematics, such relationships correspond to Markov processes, and sequences themselves are called Markov chains. Andrey Markov (1856-1922) was a Russian mathematician who specialized in stochastic processes, and many of his contributions lend themselves well to the financial market. Researching series of price movements based on the nonlinear dynamic model has made it possible to formalize Markov criterion for the forex market, and to determine points at which these processes start developing with high probability.
One of the main things about this model is the conclusion that five-day market chains are the most stable and predictable. As such, they provide the strongest base for a trading approach. The result of the model is the digital sentiment function d(t) that takes on a value +1 for upward motion, -1 for downward motion, and 0 for absence of any distinct sentiment. These chains conform according to two rules:
- If another chain is identified going in the same direction as a chain already building, it’s added to the previous chain. This increases its current length by five days;
- If there’s a chain in the opposite direction, it cancels the previous chain and establishes another direction.
"Chain gang" (below) shows a digital sentiment function for the euro/dollar pair in the two-month interval from Nov. 15, 2010, to Jan. 14, 2011. We can see both five-day single chains and their compositions in this chart. This result already conveys the market meaning, but it’s quite rough for trading. Our next step is to get a more precise characteristic, called a sentiment index, of one currency.
Global sentiment index
When we analyze a currency, we do so in the context of pair quotations. We don’t research a currency individually, only how it relates to other currencies, which are in turn affected by others. It would be much more informative to get independent characteristics of separate currencies and then check them. For that reason, while building our sentiment index we look at currencies separately using the assembly of their crosses. For example, the sentiment index formula for the euro can be put as follows:
Where “qi” are weight constants for 17 euro crosses: EUR vs. U.S. dollar, pound, Swiss Franc, yen, Canadian dollar, Australian dollar, New Zealand dollar, Argentinian Nuevo peso, Brazilian real, Chinese renminbi, Indonesian rupiah, Indian rupee, South Korean won, Mexican peso, ruble, Turkish lira and South African rand . The variable di(t) is a digital sentiment function for these crosses. Our index reflects the weighted sentiment for the euro on a global scale and is quite an accurate indicator. Similarly, we can calculate indexes for USD, GBP, CHF, JPY, etc.
"Tracking the euro" (below) contains the results of calculated sentiment indexes for the euro and the dollar. Such a comparative chart carries a great deal more information about the sentiment of the currency pair in question. Let’s note the main points from its analysis.
The crossing of the indexes indicates a changing in currencies’ power balance and can be used most successfully as basis of a trading strategy. However, statistically, with the indexes’ differential being more than 0.65, the probability of a positive trading scenario rises to 80%. This is the main technique used with this method. In the period shown, this took place six times: long on Nov. 18, short on Nov. 24-30, long on Dec. 1-3, long on Dec. 24-30, short on Jan. 5-7 and long on Jan. 12-14.
The index ratio also allows us to understand the reasons of the present movement more deeply. For instance, the fall in the euro from Nov. 24 to Nov. 30 was caused not only by dollar strength but mostly euro weakness relative to other currencies. In other words, traders were selling the euro more than they were buying the dollar. The same situation happened Jan. 5 to Jan. 7. We saw the opposite scenario Dec. 1 to Dec. 3 when against a background of moderate euro sentiment, the dollar was exposed to pressure. The current strength of the euro also is supported by a strong buying interest.
A sudden change of index differential, as a rule, signals a forthcoming rush. In most cases, it’s possible to realize profit in a short space of time and with tight stops. This was the case on Dec. 1 and Jan. 10. The stop could have been quite tight in the first case, and it was followed by four figures of changes over the three trading days. In the second example, the differential reached a key value in just two days. Here, two other features took place, as well:
- Close proximity of the index lines suggests a flat market. At that rate, the method usually generates short one- or two-day decisions, like on Nov. 18.
- Consecutively, a rising differential indicates a developing trend, which happened Dec. 24 to Dec. 30.
In spite of the virtues of this approach, it has a considerable shortcoming. It allows us only to forecast one day ahead. This is the price we have to pay for precision. Maintaining day-by-day open trades based on this method is quite comfortable, though. This technology is universal among currencies.
Enter the averages
For an even simpler approach than the digital sentiment function, we can use a variation that uses simple moving averages. First, we must define the construction mechanism for the function d(t). As a basis, let’s take a five-day simple moving average, paired with a copy of itself, just shifted one day forward.
This way, every downright intersection of the simple moving average with its shifted twin will initiate a five-day chain with a negative sentiment and assign the digital sentiment function with the value -1. An upright intersection will get the value +1. With this approach, chains don’t "stack" as they do with the original digital sentiment function. They only shift direction.
Next, let’s take 0.094 as the weight constant for USD, EUR, GBP, CHF, JPY currencies, and 0.048 for the rest. Over the period shown in "Sentiment lite" (below), the moving average approach generated 11 trading decisions when the euro and dollar sentiment indexes differential exceeded 0.65. The overall result was +252 points (with a 55% winning ratio). We got this positive performance mainly thanks to the crosses’ assembly and the logic of the five-day chains.
The power of this approach in its original form, and the solid results of the moving average variation, indicate the digital sentiment function is a powerful trading tool as well as a rich foundation for further study.
Aleksey Yudin is a professional quantitative analyst. Reach him at firstname.lastname@example.org.