# A Temperature Definition for the FOREX Market

By Armando Rodriguez

The purpose of such a definition is to capture the randomness of the FOREX market for a given pair in a single number. The random walker statistic have been proved to describe both: the motion of pollen particles on the surface of a liquid, called the Brownian motion and the quotes in the FOREX market. In the Brownian motion, observed variances of the position in any given time interval are proportional to the temperature of the liquid that suspends them. Following the analogy, the variance of the FOREX quotes may be related to some “market temperature” for a given pair.

Yet, this variances refer to a still liquid, so if there was a flow,  the frame of references for those positions must move with the liquid. Assume v is the velocity of the liquid and x0 the position of the frame of reference at t=0, then the temperature proportionality may be expressed as:

T = C * var(x – (x0 + v*t))

Where T is the absolute temperature, x is the position of the Brownian particle in a fixed frame of reference and C is a constant with dimensions Degrees/Velocity2

What does a position variance mean in a Brownian experiment? Since the Brownian particle is moving continuously, it goes through infinite positions. For the experiment, a large but finite number N of snapshots are needed, then the variance of the position in those N snapshots with show to be proportional to the temperature. The variance though, will also be proportional to the number N of snapshots, so the constant C must be inversely proportional to N. Pulling N out of the constant, we get:

T = C1 * VarN(xn – (x0 + v*tn))/N

C1 here is a constant that is independent of the number N of snapshots, but not of the particles mass. The heavier the particle, the smaller the variance will be at the same temperature. If the mass is pulled out of the constant, then:

T = B * M * VarN(xn – (x0 + v*tn))/N

The above can be expressed as:

T = B * K

Where:

K = M * VarN(xn – (x0 + v*tn))/N

is the average kinetic energy of the Brownian particle. B is one of the constants of nature called the Boltzmann constant with dimensions (degree / unit of kinetic energy).

The fluid velocity v and the t=0 intercept x0 may be estimated by applying linear regression to the set of points (xn , tn) or:

v = (avg(xn * tn)- avg(tn)*avg(xn))/( avg( tn 2) – (avg(tn))2)

x0 = avg(xn) – v* avg(tn)

Following the analogy, allow the x to be the quote values q; v and q0 the quote slope in time and intercept respectively and N the number of quotes, the equations become:

K’ = M’ * VarN(qn – (q0 + v*tn))/N

Where:

v = (avg(qn * tn)- avg(tn)*avg(qn))/( avg( tn 2) – (avg(tn))2)

q0 = avg(qn) – v* avg(tn)

Since the variance will grow with the square of the average value of the quotes, the smaller this quote average, the “heavier” they will behave. So we may analog the mass of a pair to the inverse of its average squared:

M’ = 1/(avg(qn))2

Finally:

T = B’ * K’

The constant B’ is totally arbitrary, since we are free to choose any temperature scale. The straight forward choice would be an absolute temperature scale like the Kelvin scale, though a more familiar one would be the Fahrenheit scale, for which the absolute zero is -459.67 F and the average room temperature is 77. The Celsius scale is another possible choice, with an absolute zero of -273.15 C and room temperature of 25 C. So all is needed is taking the average K’ for a typical period and assigning it the average room temperature.

(77 - (-459.67)) = BF * avg(K’)

Or:

B’F = (77 - (-459.67)) / avg(K’)

For a Celsius scale:

B’C = (25 -(-273.15)) / avg(K’)

This is as far as the analogy goes because there is a basic difference between a physical Brownian system and a FOREX market pair. In the first, the internal energy of the system is conserved, meaning that for cooling or heating it, energy must be drained from or supplied to the system and this involves time. On the other hand, quotes energy may disappear or appear without any draining/supplying involved, this because the market has no such thing as inertia. For making a market temperature behave as a Brownian system the stability must be artificially built in by using a running average instead of a sequence of values.

The above is not the only difference, another is that molecules are so small and numerous, that any practical time interval or space would still be large when compared to the microscopic world. Not so with the market, where a second is already microscopic, so ten minutes would be about the smallest macroscopic interval.

Still more differences: the kinetic energy distribution in an ideal gas follows the Maxwell-Boltzmann distribution, but the quotes don’t distribute the same.  In the first, the average kinetic energy is always about twice the standard deviation, the quotes distribution exhibit standard deviations several times greater than the average. This advises against selecting long intervals for averaging, since it may disperse widely.

Contrary to molecules that are always in motion, the market pauses for the weekends and holidays. Any algorithm for calculating a pair’s temperature must avoid the resulting holes in the data by enforcing the condition that the average time within the interval must be around the middle of the interval. Also, stray values, may be encountered in the quote stream, so any quote differing beyond x%, from the average within the interval should be ignored. For ten minute intervals the chosen percentage was 0.1% (10 pips)

The ten minute average kinetic energies of each pair will be calculated every ten minutes to affect an exponential moving average (Kema) with a characteristic time of approximately 24 hours. Let the present time be tn, the time ten minutes ago be tn-1 and the calculation of kinetic energy using averages for the last hour be Kn:

Kema(tn) = Kema(tn-1) + (Kn - Kema(tn-1)) / 144

The number 144 comes from the number of 10 minute intervals in 24 hours. These values will be stored time stamped in the Temperatures table, one row for each pair every 10 minutes.

The actual temperature in the Kelvin, Fahrenheit or Celsius scale, will be computed on demand using the expressions:

TF = B’K * Kema(tn)

TF = B’F * Kema(tn) – 459.67

Or

TC = B’C * Kema(tn) – 273.15

The constants (B’X) will be calculated so that temperatures average about the typical room temperature.