#### Triomnia Capital is a proprietary trading house and independent provider of trading education, research & advisory.

Our unique methodology integrates the study of cycles, quantitative models and technical forecasting. By combining the field of Digital Signal Analysis and Technical Analysis combined with the latest in artificial intelligence and neural networks we have developed strategies that can accurately predict market moves over a short to medium-term time frame.

- THE ALGORITHM
- DIGITAL SIGNAL ANALYSIS
- OUR PHILOSOPHY - CYCLES
- WHAT IS A CYCLE?
- MARKET MODES
- RANDOM WALK
- DIFFUSION EQUATION
- TELEGRAPHERS EQUATION
- TREND & CYCLE MODE
- TRADE WITH CYCLES
- HIGH MARKET NOISE
- TRENDING MARKET
- MEASURING MARKET CYCLES
- The Dominant Cycle
- COMPLEX NUMBERS
- CALCULATING PERIOD
- CALCULATING AMPLITITUDE
- HILBERT TRANSFORM
- HOMODYNE DISCRIMINATOR

**THE ALGORITHM**

We understand the reservations in the market regarding “black box” systems and automated trading algorithms and therefore did not feel it was in the best interest of the company or the end investor to market and sell the system. We believe that an “auto pilot” concept is extremely beneficial to traders as computers can respond and monitor many factors simultaneously making trading much more efficient and ultimately leads to more accurate trades and a higher return. That being said the volatility that we experienced in last decade is a clear sign that a pilot must exist in order to avoid fundamental changes in the world that affect the currency markets in ways that could not possibly be back-tested. Proper money management combined with a solid trading system and a disciplined trader offer a strong risk to reward scenario.

**INTRODUCTION TO DIGITAL SIGNAL ANALYSIS**

Digital Signal Analysis (DSA), a relatively young field of electronic engineering, forms the foundation for building Digital Signal Processors. These DSP’s take the digital format of every day signals like audio, video, altitude, depth, and mathematically manipulates them. The progression of computers and the powerful technology created using DSP has advanced many industries like oil & gas and electronics. However, the world of financial markets has yet to fully take advantage of these highly useful techniques.

Signals need to be processed so that the information they contain can be analysed or changed into another more useful type of signal. In the real-world most signals come in an analogue form like an analogue TV signal. Converters such as an Analogue-to-Digital converter (ADC) can translate signals from analogue to digital. From which then a DSP can process the signal and feed data back to the real world. Although real-world signals can be processed in their analog form, processing signals digitally provides the advantages of high speed and accuracy. If you are slightly taken back from the introduction do not fear it was merely a brief outline before diving into the more interesting applications used for trading.

In 2001 John F Ehlers released the book ‘Rocket Science for Traders’, and in this text he demonstrated how Digital Signal Processes can be used for trading. With his own extensive experience in electronic engineering he used Digital Signal Processing to create profoundly effective new trading tools. It is from these concepts that we developed further and built the system we trade ourselves, and present to you through our web platform/smart phone app. Let us now look closer at our philosophy when it comes to financial markets.

**OUR PHILOSOPHY - CYCLES**

The only way we can make money in financial markets is if inefficiencies exist. A market is efficient when prices fully reflect all available information at any time. Much research has been done to prove that the market is indeed efficient. However, in our own experience in the proprietary trading and hedge fund world, we have seen many traders from short term scalpers in the futures markets to longer term swing traders that have consistently made large sums of money. This is evidence that markets are not necessarily completely efficient.

Further evidence can be seen simply from observing chart patterns. Events such as double tops, Elliot wave formations and reactions to Fibonacci levels form all the time. Cycles are another example of these events and can therefore be used for trading. These cycles can be measured in different ways; the simplest is measuring the distance between successive lows. However, more sophisticated methods using digital signal analysis can be used to measure cycles more accurately for trading.

**WHAT IS A CYCLE?**

A cycle is merely a reoccurring sequence which often behaves in a harmonic fashion e.g. waving of a flag in the wind. In the market a cycle would be when price starts at a low, rises over a certain length of time then falls back to the original price. The time taken to complete the cycle is called the ‘period’.

Given that cycles are seen in natural phenomena, they are highly likely to exist in the market. Some are quite well known; you may have heard of cycles based on seasonal changes like the decline of retail sales in the winter and rise over the summer. Economic and business cycles also exist because of changes in monetary and fiscal policy (hiking/striking interest rates and different forms of quantitative easing). Inflation is increased or decreased by adding or withdrawing funds from the economy by controlling the rate at which central banks lend to other banks. Hiking of rates slows or stops the rise of inflation and striking rates does the opposite. This causes an economic or business cycle. Central banks set inflation targets and when prices deviate too far from the target, action is taken. The range the central bank is willing to see inflation rise and fall is called the ‘amplitude’.

**MARKET MODES**

Many studies have been performed on price movements in financial markets. When it comes to identifying categories or modes of price action most economists and statisticians identify four different types. These are:

- 1) Trending – Tendency of price to move in one direction for a certain period of time.
- 2) Ranging – Non seasonal related cyclical movements influenced by central bank policy etc.
- 3) Seasonal Patterns – Cyclical patterns related to the calendar.
- 4) Randomness – Price movement which is mysterious and unaccountable (often deemed ‘noise’)

Given that modes two and three are cycles, it’s clear to see they are a significant part of the market and are beneficial to analyse.

**RANDOM WALK & DRUNKARD'S WALK**

There are obviously a large number of market participants all with different intentions. Randomness results because these participants make decisions based on profit, loss, greed and fear. It is further complicated because all participants operate across different time frames. For example, a scalping algorithmic trader is entering and exiting the market multiples times a day looking for the next two or three ticks or pips. While a value driven fund manager is building a position to hold for several months or years. Market movement can therefore be analysed in terms of random variables. An example of one such analysis is called the ‘Random Walk’.

This analysis was formed in the field of physics and describes the behaviour of randomness three dimensionally. Observing an oxygen molecule in a box containing nothing but air is an example where the random walk applies. The molecule behaves erratically as it bounces off other molecules and the box walls. The position of the molecule is just as likely to be at any one location in that box as at any other.

How can this be used to describe markets?

The efficient market model implies that successive price changes are independent of one another (the probability of price moving up is equal to price going down – flip of a coin). In addition, it has usually been assumed that successive changes are identically distributed. These two hypotheses constitute the Random Walk Model. There is a lot of mathematics and theory that lie behind this model which I won’t bore you with but we use this theory to define market modes. Another form of random walk is more suited for describing the motion of financial markets. This form is a one dimensional random walk called the ‘Drunkard’s Walk’.

The Drunkard Walk theory is described by a drunkard moving on a one-dimensional array of regular spaced points. At regular intervals the drunkard flips a fair coin and makes one step to the right or left, depending if the coin shows heads or tails. At the end of n steps he could be at anyone one of 2n + 1 sites and the probability he as at any one site can be calculated.

**DIFFUSION EQUATION**

Because the drunken walker moves a certain distance over time we can write a partial differential equation to describe this movement. This is called the Diffusion equation which is also used to describe other phenomena in the natural world like the diffusion of heat through a spoon. The equation is shown below:

This is a well known partial differentiation equation in the science and engineering world. The function P[x,t] expresses the concentration of a diffusing particle (like the drunkard walker) at position x and time t. To better understand the theory of diffusion, try and picture how a smoke plume leaves a chimney. Compare how the smoke rises to how a trend carries itself through a market. A small gush of wind here or there determines the angle to which the smoke, or trend, is bent. The widening of the smoke plume represents the probability of the location of a single particle of smoke as a function of distance from the chimney. This widening is analogous to the decreased accuracy of the prediction of future trend prices further into the future.

**TELEGRAPHERS EQUATION**

The problem with the Drunkard Walk theory is that it does not take momentum into account. A more realistic way of describing an objects motion needs to account for some form of memory. By taking account of the known location from which the particle came from and the likely hood it will continue in the same direction. To make this change to the Drunkard Walk model we can allow a coin toss to determine the persistence of motion. Therefore on heads with probability p the drunkard makes his step in the same direction as the last and on tails (1-p) he moves in the opposite direction. This then yields the following equation:

This is also a well known equation called the Telegrapher’s Equation. The equation expresses the idea that diffusion occurs in restricted regions. It also describes the harmonic motion of P[x,t] in the same way it describes the electric wave travelling down a pair of wires.

This is better understood by using a meandering river as an example. By observing a river from source to sea we can see that its path is random. However if we are in a short meander of a river we can predict how the meander is going to behave.

This means that despite the randomness observed across the bigger picture, there is still short term coherency. The market is identical in that short term cycles exist but it is generally efficient over the longer time span. These short term cycles can therefore be used to predict turning points, but we must realise they come and go in the long term.

Harmonic motion is the natural response to any disturbance on any scale. The markets are no different and it does not take much strain to extend the solution to the Drunkard’s Walk problem from physical phenomena and use it to describe the action of markets.

**TREND & CYCLE MODE**

The Drunkard’s Walk solution can describe two market conditions. In the first one, the probability is evenly divided by stepping to the right or left, resulting in the Trend Mode, which is described by the diffusion equation. The second one, the probability of motion direction is skewed, results in the Cycle Mode, which is described by the Telegraphers equation. The difference between the two conditions can be as simple as the question that the majority of traders constantly ask themselves. If the question is “I wonder if the market will go up or down?” then the probability of the market movement is about 50-50, establishing the conditions for the trend mode. However, if the question is posed as “will the trend continue?” then the conditions are such that the Telegrapher’s Equation applies. As a result, the Cycle Mode of the market can be established.

It’s important to realize when short term cycles are present and to trade them in the correct way thereby increasing profits.

**WHEN NOT TO TRADE WITH CYCLES**

Caution must be taken when analyzing the market in this way as all market action is not described by cycles alone and therefore cycle tools are not always appropriate. A more thorough analysis can be achieved by recognizing the types of markets where the Telegrapher’s equation applies and when the Diffusion equation applies. We can, therefore develop tools to determine when market action is in a Cycle Mode or a Trend Mode. Our strategy can then switch back and forth between these modes the most appropriate tool can be used for analysis.

These modes can be analyzed using technical analysis indicators. The preferred tools for trending markets are moving averages and data smoothers, and oscillator-type indicators for cycle modes. These indicators can be significantly improved and made adaptive by using digital signal processing. More will be discussed on this later, but for now let’s address the question “when should I not trade with cycles?” There are two scenarios where we should avoid trading with cycles – these are when:

- 1) “Noise” in the market is too high.
- 2) The market is trending.

**HIGH MARKET NOISE**

Attempting to trade cycles when there is a relatively high amount of noise can reduce profitability. A good parameter to help us gauge noise is the ‘Signal to Noise Ratio’.

Signal – Earlier, when discussing the drunkard’s walk and telegrapher’s equation, we mentioned that short term coherence can help us with trading. If there is coherence in prices, we can expect the coherence to continue for a short time into the future. This short term coherency is essentially a moment of market inefficiency that represents a signal to act in the market.

Noise – Earlier we described noise as price movements that are mysterious and unexplained. However, we can discuss noise in a more theoretical way.

This can best be explained using an example…The figure below shows a two month cycle with no noise. Each bar represents one day.

This is an unrealistic condition because as we mentioned earlier noise is a significant component of the market.

A more realistic representation is shown below. Focusing on the same two month cycle, the daily fluctuations in price forms the ‘noise’ that can interfere with our signal. In this sense we can define the range of any given price bar from low to high as noise. To help show why it’s less profitable trading cycles in high noise conditions, we will discuss the illustration below where the noise peak-to-trough amplitude is equal to half the peak-to-trough amplitude.

**9 db SNR**

The diagram above illustrates a 0 dB Signal-to-Noise ratio (SNR). Even after measuring the cycle accurately, we could enter a trade long at the trough (Blue arrow) of the cycle and exit the trade at the peak (Red arrow) and still break even on profit. It is for this reason we should avoid trading in a 0 dB scenario, such as this, as the cycle measurement can never be 100% accurate.

What Signal-to-Noise ratio can we work with?

A more suitable condition for trading would be a 6 dB Signal-to-Noise ratio. This is where the cycle peak-to-peak amplitude is four times the distance of the noise peak-to-peak amplitude. An example of which is illustrated below.

**6 dB SNR**

**TRENDING MARKET**

No matter how accurately we measure our cycles, if the market is trending in a certain direction any signals triggered in the opposite direction will leave little room for profit. The limitations of cycle trading during trending conditions can be explained further using the theoretical diagram below.

The red and black graphs represent cycle and trend components of the market respectively. The peak-to-trough amplitude of the cycle component is two units (selling the peak and exiting at the trough will give us 2 units of profit). For arguments sake, the slope of the trend line is also set to two. From a theoretical standpoint we can add these together to form a composite wave form – the blue graph.

To help understand how trending conditions negate the advantages of cyclical trading, let’s compare the maximum profit we can generate in both conditions. We can do this by selling at the peak and covering at the trough for both the cycle and ‘composite wave form’ graphs. The result shows that the profit generated from the ‘composite wave form’ is around half of the profit realised in the cycle.

Based on this analysis, as a rule of thumb, we can avoid trading trends when the trade slope across the period of the cycle exceeds twice the cycle peak-to-peak amplitude.

**Trend Persistence**

When the amplitude is small you can sometimes find that price doesn’t cross the instantaneous trend line that often. This is probably because the amplitude is quite small. As a rule of thumb we don’t trade cycles that do not cross the instantaneous trend line at least once every half cycle.

**MEASURING MARKET CYCLES**

Earlier we mentioned that the ‘period’ of market cycles can be measured simply by calculating the distance between successive lows. However, because of continuously changing market forces, these cycles also continuously change in their period and amplitude. Therefore we need to adopt more sophisticated methods to achieve accurate measurements.

**THE DOMINANT CYCLE**

The existence of a ‘dominant cycle’ is important to understand. What is a dominant cycle? A cycle that exists in the market and continuously changes just like many other existing cycles but at a much slower rate of change. Because of these characteristics, measuring the period and amplitude of the dominant cycle is the key to accurately picking turning points in the market.

**How to Measure the Dominant Cycle?**

To explain how to measure the Dominant Cycle we will work through the following steps…

- 1) Define complex numbers.
- 2) Explain how we can use a combination of trigonometry and complex numbers to calculate phase angle, period and amplitude.
- 3) Introduce the Hilbert Transform and show how it’s used to create complex signals from simple chart data.
- 4) Introduce the Homodyne Discriminator and how it’s used to measure the phase of complex signals directly, and calculate the cycle period of the market.

**COMPLEX NUMBERS**

Complex numbers or variables lay the groundwork for the creation of our mathematical tools and indicators. Without complex numbers, building these tools would be extremely difficult. To explain what complex numbers are, it’s best to briefly discuss the nature of numbers first.

**The Nature of Numbers**

There are many types of numbers that exist in mathematics. Real numbers are the most known form of numbers and are used in everyday life. These are a continuous series ranging from minus infinity to plus infinity along a straight line. However, there is no reason why numbers must be confined to a straight line and, in mathematics; we can conceive numbers that exist on a plane. The diagram on the left shows a set of real numbers on a 1 dimensional plane. The diagram on the right shows a 2 dimensional plane with real numbers on the horizontal axis and imaginary numbers on the vertical axis.

**Imaginary Numbers**

Don’t be taken back the name. They are simply a category of numbers that allow us to conceive the vertical axis of a 2 dimensional plane. Imaginary numbers also have another use in algebra where they define the square root of negative quantities. The imaginary number j was therefore defined to be…

**Real + Imaginary = Complex**

A complex number is defined as a combination of real and imaginary numbers. It is used in the form of:

Where a and b are real numbers and j is the imaginary unit. These like real numbers can be multiplied, divided, added and subtracted to other complex numbers.

**Polar Coordinates**

By expressing complex numbers in polar coordinates we can obtain the variables we need to calculate the phase and amplitude of the dominant cycle. With reference to the diagram below the polar coordinate dimensions are r at the angle of theta.

Using the mathematical techniques of trigonometry and Pythagoras theory we can determine the relationships between the real, imaginary and polar coordinates…

These polar coordinates can be used to calculate the dominant cycle period and amplitude. To find the period we need to first define the angular frequency.

**Angular Frequency**

The frequency of a cycle shows the rate at which it completes its oscillations with respect to time. For example, the power coming from a household wall socket is an alternating current. The frequency of this current is 50Hz or 50 cycles per second. Each time a cycle is completed it sweeps through 360 degrees, or 2π radians, of a sine wave.

For the tools we are going to derive later, it is convenient to calculate the rate of rotation of the cycle. This can be done using the angular frequency ω, where ω is the Greek letter omega. The definition is below…

Using this definition, ωt is the number of radians a cycle covers in a certain amount of time. Since ωt is an angle it can be substituted for the polar coordinate . Therefore a cycle can be displayed in terms of imaginary and real components…

**CALCULATING PERIOD**

We can calculate the Period of the cycle using the angle ωt. The diagram below will help understand how.

As the cycle progresses from 0 to 2π we can determine where it is in that cycle over time. At time t1 the phase angle is wt1 and at t2 the phase angle is wt2.The difference between both phase angles can be called ΔΘ. To calculate the cycle period, we simply keep adding all the ΔΘs until we reach 360° or 2π radians (this means until one cycle is complete). The number of times we’ve had to add ΔΘ can be called n. The period will be the product of the difference in time and the number of times we had to add the differences in time or…

**CALCULATING AMPLITITUDE**

The waveform observed on simple charts is called ‘analytic waveform’. If we break down the analytic waveform into its two orthogonal components, we can find the amplitude using Pythagorean Theorem. From the diagram earlier, we can see that the square of the imaginary component plus the square of the real component is equal to r2 (square of the amplitude). The amplitude is simply the square root of this value and we can measure it on a bar-by-bar basis.

**HILBERT TRANSFORM**

This is where the mathematical theory ends and the practical engineering begins. The Hilbert transform is the name of the procedure that enables us to create complex signals from simple chart data. Once we obtain the complex signals, we can produce indicators that are far superior in both accuracy and speed than other techniques out there.

**Recap: At the beginning of the strategy section we mentioned that the point of using Digital Signal Processing was to analyse/manipulate real world signals to make them more accurate and faster to interpret. The wave form observed in chart data, that all traders are familiar with, is an example of such a real world signal. In the signal processing world these are called analytic signals.**

Analytic signals are complex functions without imaginary values that only have positive or negative frequencies, but not both. This is not the ideal complex function to use. We need to construct more general complex functions by exposing the ‘imaginary part’ of the function. This will enable us to efficiently calculate the dominant cycle period, amplitude and phase.

**Constructing the General Complex Function from the Analytic Signal**

To construct the general complex function we need to first establish the relationship between sinusoids and complex exponentials. This can be shown through Euler’s equations:

These equations are the Rosetta Stone of signal processing. They have been derived in a number of texts, to which you may want to research for more information. For now all you need to know is that they represent the InPhase (Cosine) and Quadrature (Sine) components of a complex function. These components are used in the Hilbert Transform to calculate cycle data. We can discuss this further by using the diagrams below.

The three graphs above show InPhase and Quadrature components (left) and the result when you sum them together (right). These graphs show single impulses at the frequency f0. Also, the graphs are represented in the frequency domain rather than the time domain that we showed earlier when discussing the phase diagrams. When these two components IP (InPhase) and Q (Quadrature) are added together they equal the real term of e^{jwt}. Also notice how the negative frequency impulses cancel out.

**Applying the Hilbert Transformer**

The Hilbert Transformer has been derived in many mathematics and engineering texts. As we mentioned before, it is used to generate complex signals from analytic signals. In other words we can use it to calculate the InPhase and Quadrature components and subsequently the dominant cycle measurements.

The transformer rotates all positive frequencies by -90 degrees and all negative frequencies by +90 degrees. Because the frequency response of a sampled systems is periodic we can describe the Hilbert Transform using angular frequency (below).

By using a mathematical tool called the Fourier Transform we can determine the coefficients for the expression representing the above plot and through further trial and error the following expressions can be determined.

These expressions enable us to calculate the Quadrature (Q) and InPhase (I) components in real time using chart data. These parameters are used to calculate the dominant cycle period, phase and amplitude.

**Homodyne Discriminator – Measuring Cycle Period**

Thanks to the Hilbert Transform we are able to calculate the Q and I components from regular chart data. Now we can use these to measure the cycle period by calculating the phase of the complex signal directly. Because a cycle has a constant rate of phase change (over time the cycle goes from 0 to 360⁰ at a constant rate), all we need to do is take the bar to bar difference to obtain the rate of phase change. These can then be added to together until a full cycle of 360⁰ is reached.

This can be performed using different techniques, however the preferred method which produces the most accurate results is called the Homodyne Discriminator.

**Homodyne Discriminator – Theory**

The resultant expression shows we end up with the amplitude (p) squared and the angular frequency (2π/Period). The (tn – tn-1) term equals one bar. This means we only need two consecutive samples to obtain the **instantaneous cycle period.**

**Homodyne Discriminator – Method**

The cycle period is calculated in the following steps:

- 1. Calculate the InPhase and Quadrature components using the Hilbert Transformer (as explained in the previous section).
- 2. Smooth components in a unique complex average and again in an Exponential Moving Average to avoid undesired cross products as a result of the multiplication of the complex conjugate. This complex averaging is achieved by applying the Hilbert Transform again to both the InPhase and Quadrature components – this advances the phase of each component by 90 degrees.
- 3. Subtract the 90 degree advanced Quadrature component from the original InPhase component.
- 4. Add the 90 degree advanced InPhase component to the original Quadrature component.
- 5. Smooth the new averaged InPhase and Quadrature components again using an Exponential Moving Average.
- 6. Multiply the signal by the complex conjugate of the signal 1 bar ago. The Real and Imaginary components are calculated separately.
- 7. Both the real and imaginary components are smoothed again before the cycle period is calculated.
- 8. This is achieved by taking the arctangent of the imaginary and real component ratio.

**Adaptive Indicators**

The dominant cycle makes it possible to create adaptive indicators. What do I mean by this?

Most indicators use fixed periods of time like 90 day moving averages or 60 day stochastic. This is the most common and least effective way of analysing markets because they are constantly over and under extending. Continuously calculating the dominant cycle eliminates the need to have fixed time periods and the indicator can adapt to the underlying cycle.

**Conclusion**

The theory highlighted in this section and particularly the procedure to calculate the dominant cycle forms the basis for our analysis techniques. We used this to code our own tools. These are used in conjunction with Elliot Wave theory, Fibonacci study and multiple time frame analysis to identify trade entries & exits.

Furthermore, analysis is conducted across multiple FX pairs simultaneously to select pairs which have the best trading opportunities.