You are on page 1of 9

Trading Strategies for Lead/Lag

Relationships

April 15, 2020

1
CONTENTS
Contents
1 Background 3

2 Strategy-1(Price Prediction) 4

3 Strategy-2(Pairs Trading) 5

4 Strategy-3(Pivot Points, Resistance and Support levels) 6

5 Strategy-4(Moving Averages) 7

6 Strategy-5(Momentum Oscillators) 8

7 Correlation Results 9

2
1 Background
As the correlation study was conducted on Bank Nifty constituents’ futures,
we would only be able to predict price movements and forecasted prices of the
lagger’s future(using correlation information) at various points during the trading
session. To understand the strategies mentioned in the following sections, it is
imperative to get accustomed to the time series context used by them.

Let us consider time series corresponding to two futures A and B. For studying
correlation, we had partitioned these series into 1 second intervals. Within
each interval(t), price of only the last trading message(T PAt /T PBt ) was con-
sidered to compute return value. Return value(R) was then calculated as
T PAt −T PAt−1 T PBt −T PBt−1
RAt = T PA for future A and as RBt = T PB for future B. This
t−1 t−1
resulted in two return value time series one for each of A(RA ) and B(RB ) on
which correlation study was performed.

Distance Correlation(DC) was used to study covariation between RA and RB .


The most important aspect about distance correlation is that it is able to capture
non-linear relationships between two securities. It always takes a positive value
between 0 and 1, with 0 denoting independent variation and 1 representing com-
plete dependence(perfect linear relation). The basic idea of distance correlation
is to find co-variance among the distance between consecutive return values of
the two instruments. The more the value of distance correlation between RA and
RB , the more the chance of similar variation in distance between consecutive
values of RA when the distance between consecutive values of RB changes or
vice-versa.

d(Cov(X, Y ))
DC = p
d(V ar(X) d(V ar(Y )

For detailed information related to computation of distance correlation, please


visit the url mentioned below.

https://en.wikipedia.org/wiki/Distance_correlation

Invariant: For explaining all the trading strategies listed below, two futures A
and B are used assuming that A has an average correlation coefficient ρ with
respect to B and leads B with an average offset of τ (the averages have been
computed using tbt data from one month).

Note: Correlation Analysis was done on March Futures. All the 1 second
interval points(return values) of time series have been calculated using the last
trading price within the interval. As correlation values were computed for only
21 offset values(-10 . . . 0 . . . +10), BSpline interpolator was used to make the
distance v/s offset curve smooth and continuous. The global maximum of this
generated curve represents the maximum correlation value and the corresponding
offset best signifies the instrument pair correlation. As only 16 days(excluding
10-03-2020 and 27-03-2020(holiday and expiry date respectively)) had valid data,
the correlation analysis may have some biases involved.

3
2 Strategy-1(Price Prediction)
The most vanilla trading strategy incorporating lead/lag results is about pre-
dicting the mid quote price(average of best bid and best ask price) of the lagger
sometime in the future(in relation to leader) and thereby, making appropriate
buy/sell decision at the current timestamp to avail profit while unwinding the
position in future.

Let us denote best bid and best ask of future X(A/B) at time t as BBXt and BAXt
BBXt +BAXt
respectively. Therefore, mid quote price of X at time t is MXt = 2 .
Now, consider the return value time series of A(RA ) and B(RB ) with interval
size of one second as we had used the same setup for correlation analysis. Let us
focus on time intervals t-τ , t and t+τ . The following equation holds due to the
definition of distance correlation resulting in lead/lag relationship among return
values of the two futures:

RBt+τ = ρ(RAt − RAt−τ ) + RBt − 1

MX −MX
t t−1
MXt−τ −MXt−1 MXt+τ −MXt
Since RXt = MXt−1 , RXt−τ = MXt−1 and RXt+τ = MXt ,
the equation 1 can be rewritten as
MAt − MAt−τ MBt − MBt−1
MBt+τ = MBt (ρ( )+ ) + MBt − 2
MAt−1 MBt−1

Thus, if we know the mid quote prices of futures A and B at times t, t-τ (only for
A) and t-1, we can easily compute the mid quote price of B at time t+τ . If it
turns out that MBt+τ < MBt , we sell futures of B at time t and then, cover the
sell by buying it again at time t+τ . Similarly, if MBt+τ > MBt , we buy futures
of B at time t and unwind the open position at time t+τ .

The reason for using mid quote price is that it is the best estimate of price at
which trading can occur at a particular time and hence, it mitigates complexity
which might arise if bid-ask spread is considered instead. Here, the assumption
is that the leader offset τ is less than one second. For τ greater than 1 sec-
ond, some changes need to be made in return value computations. The above
strategy is quite reasonable as it involves prediction of lagger’s future price
using mid quote prices of A and B around 1 second boundary because correla-
tion analysis was also done on 1 second partitioned return value series of A and B.

A more generalized form of equation 2 is given below while involves linear


regression of terms representing top p offsets. It considers the top p offsets τ1 ,
τ2 , τ3 , . . . , τp (assuming each one of them is < 1 second) and their corresponding
correlation coefficients ρ1 , ρ2 , ρ3 , . . . , ρp .

p
X MAt − MAt−τi  MBt − MBt−1
MBt+τ = MBt ( ρi ( ) + ) + M Bt − 3
i=1
MAt−1 MBt−1

4
3 Strategy-2(Pairs Trading)
This strategy involves taking positions in both the futures A and B unlike
the previous one where trading was done entirely in future B. It is for highly
correlated futures. It exploits the fact of correlation coefficient degradation. The
basic idea is to trade when the correlation decreases(in a small window) between
the two futures by taking short position in out-performing future and taking long
position in under-performing future. It assumes that on an average correlation
will again bounce back to it’s average value(over a trading month) after some
time. Once the correlation converges to it’s average value, the positions in both
the futures can then be reversed to gain profit in each of them.

Let us consider the return value time series(split into 1 second intervals) corre-
sponding to futures A(RA ) and B(RB ). Let window size be tw (in multiple of a
second). In order to get correlation value for a window starting at time t-tw and
ending at t, we use the following formula:
RBt − RBtw
ρ tw = − 4
RAt − RAtw

In terms of mid quote prices(MAt & MBt ), equation 4 can be rephrased as,
MB t −MB t−1 MB tw −MB tw −1
MB t−1 − MB tw −1
ρ= MA t −MAt−1 MA tw −MAtw −1
− 5
MAt−1 − MA tw −1

To identify if a future is out-performing or under-performing,


Pn we will use the
i=1 Pi Vi
concept of volume-weighted average price(VWAP)( n Vi ) where Pi denotes
P
i=1
the trading price and Vi denotes the traded volume of ith transaction in a certain
window. We keep two windows of size tw and 5tw in our case.

Now, the strategy will work as follows. First, the window correlation for window
tw is calculated(ρtw ) and then compared with ρthres = 0.5. If ρtw > ρthres , no
position is adopted for that window. Else, a position is adopted in both the
futures depending on out-performing/under-performing situation. A future is
said to be out-performing for window tw if V W APtw > V W AP5tw . Similarly,
if V W APtw < V W AP5tw , the futures is under-performing. The trick is to be
long on the under-performing future and to short the out-performing future at
the current timestamp as due to mean reversion property of correlation, the
futures are bound to converge to their mean value after a short period which
will make the ρtw > ρthres . When the correlation value rises above the threshold
in a particular window, the corresponding positions in both futures are reversed
to earn profit. This process is repeated throughout the trading day.

Note: Windows used for correlation computation are static while those used
for VWAP calculations are sliding. In case when ρtw > ρthres and there are no
open positions left, we may use Strategy 1 for trading in the lagging future(B)
till the correlation drops and open positions are created using Strategy 2.

5
4 Strategy-3(Pivot Points, Resistance and Sup-
port levels)
In order to use this strategy, some terms related to pivot points should be
understood first. Pivot Point(P) is a static level defined by the value P =
HP +LP +CP
3 where HP, LP and CP stand for High Price, Low Price and Closing
Price of the previous trading day. Pivot Point level is significant as it represents
the mean level around which the price fluctuates for most of the duration of
trading day. There are two other special terms, Resistance(R) and Support(S).
Resistance level indicates that once the price touches it, it will drop back towards
the pivot point level. Thus, in a way it provides some resistance to price movement
above it. Likewise, Support level represents the level where a downward trend in
price gets halted, thereby, providing some support against its further downward
movement. There are times when Resistance and Support levels are breached.
For such cases, we define a hierarchy of resistance(R1 , R2 , . . . ) and support
levels(S1 , S2 , . . . ). One interesting point about resistance/support levels is that
their functionality reverses depending on the side from which price approaches
it(R1 if approached from below acts as resistance level and acts as support level
otherwise). These levels are calculated as follows(P, LP, HP denote the same
quantities as earlier):

R1 = 2 ∗ P − LP S1 = 2 ∗ P − HP − 6

R2 = P + (R1 − S1 ) S2 = P − (R1 − S1 ) − 7

We will predict the mid quote price of the lagger(B) in the same way as was done
in Strategy 1. In addition, we maintain three count variables which keep track of
count of breaching resistance level R1(CR1b ), count of accurate price prediction
at R1(CR1p ) and count of reaching resistance level R1(CR1r ) respectively. All of
them are set to zero initially. Probability of crossing resistance level R1(PR1b )
and accuracy of price prediction(PR1p ) are then calculated as follows:

CR1b CR1p
PR1b = PR1p = − 8
CR1r CR1r

Now, when the mid quote price of the lagger(MBt ) reaches within x% of resistance
level R1(R1 ± x%(R1)) at time t, there are two possible scenarios depending
on price prediction. Let us assume that equation 2 hinted that mid quote price
of B will rise(MBt+τ > MBt ). First, if the actual mid quote price(MBt+τact )
at time t + τ is greater than mid quote at time t, i.e, MBt+τact > MBt , we
increase CR1p by one and decrease CR1b by one as our prediction was right
and R1 has been crossed. Second, if the actual mid quote price(MBt+τact ) at
time t + τ is lesser than mid quote at time t, i.e, MBt+τact < MBt , we decrease
CR1p by one and increase CR1b by one as our prediction was wrong and R1
was not crossed. CR1r is incremented in both cases. Next time when R1 is
reached, we can make a decision to trade/not to trade using the two probability
counters. If PR1b > Pbthres and PR1p < Ppthres , we sell at time t and then buy
at time t+τ . If PR1p > Ppthres and PR1b < Pbthres , we buy/sell at time t based
on whether prediction is price fall/rise. We unwind this position at timet+τ .

6
If both PR1p > Ppthres & PR1b > Pbthres and are non-contradictory, we trade
based on the price prediction. Else(for the case of contradiction), we trust the
probability whose magnitude is higher. If both of these probabilities are less
than their respective thresholds, we do not trade at this opportunity.

Note: The probabilities can be negative(as count can become negative in


case of successive failures(regarding breach/price prediction) of the measured
quantity). In case of negative values, we interpret the negative sign as alluding
to the reverse of what would be represented if the sign was positive. We need to
maintain a different counter for measuring breach in case when R1 is approached
from above to differentiate between upward and downward breach as they may
have different probabilities of occurrence. Similarly, the same idea can be applied
to other levels(S1 , R2 , S2 ) with minute modifications.

5 Strategy-4(Moving Averages)
This strategy makes use of moving averages of mid quote prices in windows of
distinct sizes. In order to understand the basic idea behind this strategy, we
exclude lead/lag relations for a matter of time. Consider a future X having mid
quote price MXt at time t. Let us consider two windows of sizes tw and 5tw .
Within each window, we take the average of the trading prices to get mean prices
APXtw and APX5tw .

(T Pi 1i∈[t −k,t ] )
P
APXk = P − 9
(1i∈[t −k,t ] )
where 1 is the indicator function which checks if a trading price belongs to
window of size k at time t and TP represents the trading price.

If APXtw < APX5tw , then the mid quote is in a downward trend. Otherwise,
mid quote demonstrates an upward profile. If we depict these values on a chart,
we get two line plots. The points of intersection of these two lines provide
indication of taking long/short positions in X. If APXtw < APX5tw before the
point of intersection, it is wise to buy the future at the current timestamp.
The future should be shorted if APXtw > APX5tw before the convergence point.
The point of crossing over suggests that average price movement over the two
windows have converged and depending on their magnitudes before this point,
the trend(up/down) reverses.

Now, taking into account the correlation between futures A and B, some con-
clusions can be made regarding trading decisions. There are two possible cases:
one when A(leader) has already crossed the intersection point and started an
uphill trend while B reaches the same type(upward trend after the point) of
crossing point and second when A has not surpassed such a point while B has
arrived at the point. If B had not crossed over(leading to upward pattern) when
A arrived at the intersection, we long the future of A. In the first case, we should
buy future of B(considering upward profile) while in the second case, we should
apply Strategy 2(pairs trading). The justification for the trading action in first
case is that since A has already crossed the point and B has reached it, due to

7
high correlation between them B will rise over the point just like A if predicted
mid quote of B(MB t+τ )(using Strategy 1) is greater than current mid quote of
B(MB t ). In second case, the correlation falters as A does not tend to lead B.
Thus, pairs trading can be used to maximize profit from both ends(A & B).

6 Strategy-5(Momentum Oscillators)
Lagging indicators follow price movement while leading indicators predict price
movement. While we have seen many lagging indicators(like moving averages),
let us now turn to a leading indicator, namely, momentum oscillator(MO) which
measures the rate-of-change of a future’s price over a given period of time. Unlike
many other indicators, it identifies the strength of price movement. As the price
of future rises, momentum rises. The faster the future rises, the larger the
increase in momentum. When the rise begins to slow, momentum will also slow
down. The momentum oscillator is calculated using the equation given below.
CP
MO = ∗ 100 − 10
PP

where CP represents the price of the current period while PP refers to the price
of a previous period. This indicator will oscillate around 100. Values more than
100 indicate positive momentum/increasing price while the reverse indicates
negative momentum/falling price.

When MO reaches extremely high or low values, we can assume that the current
trend will continue. The MO is an unbound oscillator. There are no limits to it’s
upward/downward movement. Thus, there is a need of another indicator which
can guide us about the boundary limits of MO. The use of lead/lag relations
provides just that.

We can use relate the case of MO with that of pivot points, resistance and
support levels. Here, 100 mark acts as a pivot point while levels 120 and 140
tend to imitate R1 and R2 . Similarly, levels 80 and 60 will be analogous to S1
and S2 . We can now use Strategy-3 for trading. For our case, we can use lag
offset to compute speculative price(MB t ) of B(lagger) in near future and use it
to confirm price movement. Let us consider periods of size tw for MO calculation.
MO at time t would be the ratio,
MBt − MBt−tw
M Ot = ∗ 100 − 11
MBt−tw − MBt−2tw

Let us assume that predicted price of B at time t+τ is MBt+τ . If MBt+τ > MBt ,
M Ot > 100 and M Ot is rising, it is advisable to buy future of B at present
time and sell it later. If MBt+τ < MBt , M Ot > 100 and M Ot is slowing down,
sell the future of B. Similarly, we can trade accordingly for the other two cases.
Even though MO(when above 100) slows down, it may again rise which will
be predicted by the forecasted price of B(MBt ). Extreme values of MO signal
overbought/oversold futures. If MO takes positive extreme and MBt comes
down, it hints that the future is overbought and hence, we should short it if we
have a long position. If MO dives into negative extreme and MBt goes up, the

8
message conveyed is that the future is oversold and thus, it is better to buy it at
this stage.

7 Correlation Results
The correlation results(tables/plots) along with observations/analysis can be
found at this link:

https://docs.google.com/presentation/d/1ZiVyK7XCXRrC7wucfompxep7-5zV_
awF0Xpc_TWC1XA/edit#slide=id.g825b85e829_0_109

You might also like