I am writing this post to tell friends about my increasing persecution again. I mentioned that I used to buy 5 Liter Nestle water bottles but Nestle bottles that were manufactured in May 2021 were not good and I survived for a long time by buying 5L Nestle water bottles that had been lying in stores from April 2021 and earlier. A few weeks ago heat really increased and all older 5L Nestle water bottles were gone. Then I survived for a week or so by buying another water from Dunkin Donuts that was reasonable but that water was quickly drugged at all Dunkin Donut stores by mind control agencies. Luckily, in the meantime, Nestle 1.5 L water bottles became good and new 1.5 L water that came out in June was good. For past few (2) weeks I have survived by drinking Nestle 1.5 L water. But since past two days, they have started drugging Nestle 1.5 L Water in the adjacent areas of Lahore city where I live. Day before yesterday they drugged some water in nearby markets and yesterday I went to areas a bit farther to avoid drugged water and was reasonably successful but today I found that 1.5 L water bottles on shelves in a lot of areas even away were drugged. Mind control agencies are actively drugging water in adjacent areas of the city again to control me so I would not be able to do any productive work. I want to request good Americans and good people all over the world to please do anything you can to stop mind control agencies from drugging water in Lahore city.

Friends, I wanted to share the analytics for multidimensional monte carlo simulations of the kind we have in equity basket pricing where each of the N SDEs in the basket of N assets is largely single-dimensional but their driving brownian motions are correlated.

I suppose that we have already done cholesky decomposition or SVD decomposition of the correlation matrix and we have written each of the N SDEs with their volatility coefficients explicitly stated after cholesky or SVD. I will just write one of the N SDEs in the basket as

[$]dX_1 = \mu_1 \, {X_1}^{\beta_1} \, dt + \sum_{n=1}^{N} \, \sigma_{1n} \, {X_1}^{\gamma_1} \, dZ_n[$]

In particular we want to notice that [$]\sum_{n=1}^{N} \, {\sigma_{1n}}^2 \, = \, {\sigma_1}^2 [$]

Please note that after cholesky or SVD, all of the above brownian motions [$]Z_n[$] are orthogonal.

Since I am playing with only one SDE, I will drop the subscript "1" from the bottom of each variable since it is unnecessary in case we are dealing with one SDE only.

expanding the above SDE as we have previously done, we write the equation after applying repeated Ito as

[$]dX = \mu \, {X}^{\beta} \, \int_0^t ds + \, {X}^{\gamma} \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t dZ_n(s) [$]

[$]+(\mu \, \beta {X}^{\beta-1} ) \, (\mu \, {X}^{\beta}) \, \int_0^t \int_0^s dv \, ds[$]

[$]+(\mu \, \beta {X}^{\beta-1} ) \, ({X}^{\gamma} ) \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_n(v) ds[$]

[$]+.5 (\mu \, \beta \, (\beta-1) \, {X}^{\beta-2} ) \, ({X}^{2 \gamma} ) \, \sum_{n=1}^{N} \, {\sigma_{1n}}^2 \, \int_0^t \int_0^s dv \, ds[$]

[$]+(\gamma {X}^{\gamma-1} ) \, (\mu \, {X}^{\beta}) \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dv \, dZ_n(s)[$]

[$]+(\gamma {X}^{\gamma-1} ) \, ({X}^{\gamma}) \, \sum_{n=1}^{N} \, \sum_{m=1}^{N} \, \sigma_{1m} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_m(v) \, dZ_n(s)[$]

[$]+.5 (\gamma (\gamma-1) \, {X}^{\gamma-2} ) \, ({X}^{2 \gamma}) \, \sum_{n=1}^{N} \, \sum_{m=1}^{N} \, {\sigma_{1m}}^2 \, \sigma_{1n} \, \int_0^t \int_0^s dv \, dZ_n(s)[$]

since in quadratic variations, [$]\sum_{n=1}^{N} \, {\sigma_{1n}}^2 \, = \, {\sigma_1}^2 [$], we can slightly simplify the above equations by using this identity that changes double summations in quadratic variations to single summations and write the above equation again as

[$]dX = \mu \, {X}^{\beta} \, \int_0^t ds +\, {X}^{\gamma} \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t dZ_n(s) [$]

[$]+(\mu \, \beta {X}^{\beta-1} ) \, (\mu \, {X}^{\beta}) \, \int_0^t \int_0^s dv \, ds[$]

[$]+(\mu \, \beta {X}^{\beta-1} ) \, ({X}^{\gamma} ) \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_n(v) ds[$]

[$]+.5 (\mu \, \beta \, (\beta-1) \, {X}^{\beta-2} ) \, ({X}^{2 \gamma} ) \, {\sigma_1}^2 \, \int_0^t \int_0^s dv \, ds[$]

[$]+(\gamma {X}^{\gamma-1} ) \, (\mu \, {X}^{\beta}) \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dv \, dZ_n(s)[$]

[$]+(\gamma {X}^{\gamma-1} ) \, ({X}^{\gamma}) \, \sum_{n=1}^{N} \, \sum_{m=1}^{N} \, \sigma_{1m} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_m(v) \, dZ_n(s)[$]

[$]+.5 (\gamma (\gamma-1) \, {X}^{\gamma-2} ) \, ({X}^{2 \gamma}) \, {\sigma_1}^2\, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dv \, dZ_n(s)[$]

We can solve all of the above integrals analytically.

[$]\int_0^t \int_0^s dZ_n(v) ds= \frac{1}{\sqrt{3}} t Z_n(t)[$]

[$]\int_0^t \int_0^s dZ_n(v) dZ_n(s)= \frac{1}{2} ({Z_n(t)}^2-t)=H_2(Z_n(t))[$]

only difficult integral is

[$]\int_0^t \int_0^s dZ_m(v) dZ_n(s)= Z_n(t) \sqrt{[{Z_m(t)}^2-t] (1-\frac{\sqrt{2}}{2}) +\frac{t}{2} }[$]

where we get this integral from Ito Isometry as

[$]\int_0^t \int_0^s dZ_m(v) dZ_n(s)[$]

[$]=\int_0^t Z_m(s) dZ_n(s)[$]

and its variance is given as

[$]=\int_0^t {Z_m(s)}^2 ds[$]

[$]=\int_0^t d[{Z_m(s)}^2 s]-\int_0^t s d[{Z_m(s)}^2][$]

[$]= t \, {Z_m(t)}^2 - \int_0^t 2 s \, Z_m(s) \, dZ_m(s)- \int_0^t s \, ds [$]

[$]= t \, H_2(Z_m(t)) (1-\frac{\sqrt{2}}{2}) + t^2/2[$]

its representation will be given as

[$] \sqrt{(H_2(Z_m(t)) (1-\frac{\sqrt{2}}{2}) + t/2)} \, \sqrt{t} \, N_n[$]

where [$]N_n[$] is standard normal associated with brownian motion [$]Z_n[$]

writing [$]\sqrt{t} \, N_n = Z_n(t)[$] in the above equation we get

[$] \sqrt{(H_2(Z_m(t)) (1-\frac{\sqrt{2}}{2}) + t/2)} \, Z_n(t)[$]

[$]= Z_n(t) \sqrt{[{Z_m(t)}^2-t] (1-\frac{\sqrt{2}}{2}) +\frac{t}{2} }[$]

So we can write the integral as

[$]\int_0^t \int_0^s dZ_m(v) dZ_n(s)= Z_n(t) \sqrt{[{Z_m(t)}^2-t] (1-\frac{\sqrt{2}}{2}) +\frac{t}{2} }[$]

We can now solve all the integrals and easily simulate a basket option to 2nd expansion order of Ito-Taylor expansion.

I suppose that we have already done cholesky decomposition or SVD decomposition of the correlation matrix and we have written each of the N SDEs with their volatility coefficients explicitly stated after cholesky or SVD. I will just write one of the N SDEs in the basket as

[$]dX_1 = \mu_1 \, {X_1}^{\beta_1} \, dt + \sum_{n=1}^{N} \, \sigma_{1n} \, {X_1}^{\gamma_1} \, dZ_n[$]

In particular we want to notice that [$]\sum_{n=1}^{N} \, {\sigma_{1n}}^2 \, = \, {\sigma_1}^2 [$]

Please note that after cholesky or SVD, all of the above brownian motions [$]Z_n[$] are orthogonal.

Since I am playing with only one SDE, I will drop the subscript "1" from the bottom of each variable since it is unnecessary in case we are dealing with one SDE only.

expanding the above SDE as we have previously done, we write the equation after applying repeated Ito as

[$]dX = \mu \, {X}^{\beta} \, \int_0^t ds + \, {X}^{\gamma} \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t dZ_n(s) [$]

[$]+(\mu \, \beta {X}^{\beta-1} ) \, (\mu \, {X}^{\beta}) \, \int_0^t \int_0^s dv \, ds[$]

[$]+(\mu \, \beta {X}^{\beta-1} ) \, ({X}^{\gamma} ) \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_n(v) ds[$]

[$]+.5 (\mu \, \beta \, (\beta-1) \, {X}^{\beta-2} ) \, ({X}^{2 \gamma} ) \, \sum_{n=1}^{N} \, {\sigma_{1n}}^2 \, \int_0^t \int_0^s dv \, ds[$]

[$]+(\gamma {X}^{\gamma-1} ) \, (\mu \, {X}^{\beta}) \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dv \, dZ_n(s)[$]

[$]+(\gamma {X}^{\gamma-1} ) \, ({X}^{\gamma}) \, \sum_{n=1}^{N} \, \sum_{m=1}^{N} \, \sigma_{1m} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_m(v) \, dZ_n(s)[$]

[$]+.5 (\gamma (\gamma-1) \, {X}^{\gamma-2} ) \, ({X}^{2 \gamma}) \, \sum_{n=1}^{N} \, \sum_{m=1}^{N} \, {\sigma_{1m}}^2 \, \sigma_{1n} \, \int_0^t \int_0^s dv \, dZ_n(s)[$]

since in quadratic variations, [$]\sum_{n=1}^{N} \, {\sigma_{1n}}^2 \, = \, {\sigma_1}^2 [$], we can slightly simplify the above equations by using this identity that changes double summations in quadratic variations to single summations and write the above equation again as

[$]dX = \mu \, {X}^{\beta} \, \int_0^t ds +\, {X}^{\gamma} \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t dZ_n(s) [$]

[$]+(\mu \, \beta {X}^{\beta-1} ) \, (\mu \, {X}^{\beta}) \, \int_0^t \int_0^s dv \, ds[$]

[$]+(\mu \, \beta {X}^{\beta-1} ) \, ({X}^{\gamma} ) \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_n(v) ds[$]

[$]+.5 (\mu \, \beta \, (\beta-1) \, {X}^{\beta-2} ) \, ({X}^{2 \gamma} ) \, {\sigma_1}^2 \, \int_0^t \int_0^s dv \, ds[$]

[$]+(\gamma {X}^{\gamma-1} ) \, (\mu \, {X}^{\beta}) \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dv \, dZ_n(s)[$]

[$]+(\gamma {X}^{\gamma-1} ) \, ({X}^{\gamma}) \, \sum_{n=1}^{N} \, \sum_{m=1}^{N} \, \sigma_{1m} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_m(v) \, dZ_n(s)[$]

[$]+.5 (\gamma (\gamma-1) \, {X}^{\gamma-2} ) \, ({X}^{2 \gamma}) \, {\sigma_1}^2\, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dv \, dZ_n(s)[$]

We can solve all of the above integrals analytically.

[$]\int_0^t \int_0^s dZ_n(v) ds= \frac{1}{\sqrt{3}} t Z_n(t)[$]

[$]\int_0^t \int_0^s dZ_n(v) dZ_n(s)= \frac{1}{2} ({Z_n(t)}^2-t)=H_2(Z_n(t))[$]

only difficult integral is

[$]\int_0^t \int_0^s dZ_m(v) dZ_n(s)= Z_n(t) \sqrt{[{Z_m(t)}^2-t] (1-\frac{\sqrt{2}}{2}) +\frac{t}{2} }[$]

where we get this integral from Ito Isometry as

[$]\int_0^t \int_0^s dZ_m(v) dZ_n(s)[$]

[$]=\int_0^t Z_m(s) dZ_n(s)[$]

and its variance is given as

[$]=\int_0^t {Z_m(s)}^2 ds[$]

[$]=\int_0^t d[{Z_m(s)}^2 s]-\int_0^t s d[{Z_m(s)}^2][$]

[$]= t \, {Z_m(t)}^2 - \int_0^t 2 s \, Z_m(s) \, dZ_m(s)- \int_0^t s \, ds [$]

[$]= t \, H_2(Z_m(t)) (1-\frac{\sqrt{2}}{2}) + t^2/2[$]

its representation will be given as

[$] \sqrt{(H_2(Z_m(t)) (1-\frac{\sqrt{2}}{2}) + t/2)} \, \sqrt{t} \, N_n[$]

where [$]N_n[$] is standard normal associated with brownian motion [$]Z_n[$]

writing [$]\sqrt{t} \, N_n = Z_n(t)[$] in the above equation we get

[$] \sqrt{(H_2(Z_m(t)) (1-\frac{\sqrt{2}}{2}) + t/2)} \, Z_n(t)[$]

[$]= Z_n(t) \sqrt{[{Z_m(t)}^2-t] (1-\frac{\sqrt{2}}{2}) +\frac{t}{2} }[$]

So we can write the integral as

[$]\int_0^t \int_0^s dZ_m(v) dZ_n(s)= Z_n(t) \sqrt{[{Z_m(t)}^2-t] (1-\frac{\sqrt{2}}{2}) +\frac{t}{2} }[$]

We can now solve all the integrals and easily simulate a basket option to 2nd expansion order of Ito-Taylor expansion.

Friends, we do not need the Ito-isometry of the difficult integral as I did in the last post. Above I have copied the expansion term that we need to deal with. All terms in the above expansion are very similar to single dimensional SDEs except the term I am copying down here.

[$]dX = \mu \, {X}^{\beta} \, \int_0^t ds +\, {X}^{\gamma} \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t dZ_n(s) [$]

[$]+(\mu \, \beta {X}^{\beta-1} ) \, (\mu \, {X}^{\beta}) \, \int_0^t \int_0^s dv \, ds[$]

[$]+(\mu \, \beta {X}^{\beta-1} ) \, ({X}^{\gamma} ) \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_n(v) ds[$]

[$]+.5 (\mu \, \beta \, (\beta-1) \, {X}^{\beta-2} ) \, ({X}^{2 \gamma} ) \, {\sigma_1}^2 \, \int_0^t \int_0^s dv \, ds[$]

[$]+(\gamma {X}^{\gamma-1} ) \, (\mu \, {X}^{\beta}) \, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dv \, dZ_n(s)[$]

[$]+(\gamma {X}^{\gamma-1} ) \, ({X}^{\gamma}) \, \sum_{n=1}^{N} \, \sum_{m=1}^{N} \, \sigma_{1m} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_m(v) \, dZ_n(s)[$]

[$]+.5 (\gamma (\gamma-1) \, {X}^{\gamma-2} ) \, ({X}^{2 \gamma}) \, {\sigma_1}^2\, \sum_{n=1}^{N} \, \sigma_{1n} \, \int_0^t \int_0^s dv \, dZ_n(s)[$]

[$]+(\gamma {X}^{\gamma-1} ) \, ({X}^{\gamma}) \, \sum_{n=1}^{N} \, \sum_{m=1}^{N} \, \sigma_{1m} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_m(v) \, dZ_n(s)[$]

Diagonal terms in above are similar to one dimensional SDEs. We notice that non-diagonal terms appear in pairs of integrals with common coefficients and each pair of integrals can be seen as a integral of complete differential of product of two brownian motions. For example we have pair of terms like

[$]\sigma_{1m} \, \sigma_{1n} \, \int_0^t \int_0^s dZ_m(v) \, dZ_n(s)+\sigma_{1n} \, \sigma_{1m} \, \int_0^t \int_0^s dZ_n(v) \, dZ_m(s)[$]

which can be written as

[$]=\sigma_{1m} \, \sigma_{1n} \, \int_0^t Z_m(s) \, dZ_n(s)+\sigma_{1n} \, \sigma_{1m} \, \int_0^t Z_n(s) \, dZ_m(s)[$]

[$]=\sigma_{1m} \, \sigma_{1n} \, \Big[ \int_0^t Z_m(s) \, dZ_n(s)+ \, \int_0^t Z_n(s) \, dZ_m(s) \Big][$]

We notice that terms in large brackets are integral of a complete differential as

[$]=\sigma_{1m} \, \sigma_{1n} \, \int_0^t d \big[Z_m(s) \, Z_n(s) \big] [$]

[$]=\sigma_{1m} \, \sigma_{1n} \, Z_m(t) \, Z_n(t) [$]

So we do not need any special treatment for the cross-volatility terms and we simply need to take pairs of cross-volatility terms and join them in the form of product of driving brownian increments multiplied by common volatility product coefficients. rest of the integrals are the same as in single dimensional SDEs.

Friends, my current post is about market trading and it has to be seen in context of the following previous posts.

https://forum.wilmott.com/viewtopic.php?f=4&t=99702&start=1140#p866202

https://forum.wilmott.com/viewtopic.php?f=4&t=99702&start=1140#p866241

https://forum.wilmott.com/viewtopic.php?f=4&t=99702&start=1155#p866316

I am copying the most relevant post about filtering mean-reversion coefficient here

..

I believe trading is about relative value and in "market" we have to put dynamics of every financial asset in context relative to each other or relative to a common market. Though there are several ways of describing a market, one good way would be to describe it in reasonably large number of independent orthogonal factors. Again there could be several ways of finding orthogonal factors but (as a start) one good way is through principle component analysis(PCA) of matrix of covariance of logarithmic returns of various financial assets traded in the market.

In what follows I am dealing with logarithmic returns and their orthogonal factors and PCA where all terms can be linearly added.

Again (as a start) we suppose that price of an asset when described in terms of orthogonal factors or principle components represents its theoretical projected price(or theoretical projected return) once the factor returns have been known. I write the accumulated theoretical projected return of one single stock, after T periods have elapsed from a benchmark starting time zero, in terms of realization of M orthogonal factors over the span of T periods as

Theoretical Projected Price[$]= \sum_{t=0}^{T} \, \Big[ c_1 \, r_{1,t} + c_2 \, r_{2,t} +\, ....\, + c_M \, r_{M,t} \Big] =\sum_{t=0}^{T} \sum_{m=1}^{M} \, c_m \, r_{m,t}[$]

where [$]c_m[$] is eigenvector coefficient for the stock for mth factor and [$] r_{m,t} [$] is return of the mth orthogonal factor in t-th time interval.

But in general the realized return of the stock after (accumulation over) T intervals R(T) would not be equal to theoretical projected return calculated from orthogonal factor returns due to factor misspecification or due to idiosyncratic factors. Usually many stocks would remain within a very small error limit from the theoretical projected returns but some few stocks would seriously start to diverge from the theoretical projected returns. And that is precisely what we want to find. We want to find the dynamics of stocks that are diverging from the theoretical projected returns(in either direction) and try to capture the dynamics of this divergence of returns.

We can postulate that accumulated stock returns R(t) (over a period of t intervals starting from a chosen benchmark time zero) usually mean-revert to their (accumulated) theoretical projected returns and write the stochastic differential equation for (accumulated over T periods) returns denoted as R as

[$] dR(t)= \kappa(t) \Big[ \sum_{s=0}^{t} \sum_{m=1}^{M} \, c_m \, r_{m,s} -R(t) \Big] + \sigma_{R} \, dz(t)[$]

while [$]\kappa[$] is modelled as a slowly moving hidden parameter that has its own dynamics given as

[$]\kappa(t+1)= \, \kappa(t)+ \, \sigma_{\kappa} \, dw(t)[$]

Now magnitude and sign of filtered value of hidden parameter [$]\kappa[$] would tell us how fast and in which direction accumulated return on stock in question is changing as compared to theoretical return. Is it converging towards theoretical value or diverging? At the same time we also know how much the stock return has diverged from theoretical return over the benchmark period and this is calculated as[$]\Big[ \sum_{t=0}^{T} \sum_{m=1}^{M} \, c_m \, r_{m,t} -R(T) \Big][$] and with combined knowledge of total divergence of stock return from its theoretical value over a period and rate of this divergence, we can construct a large number of very successful trading strategies.

We can have a multivariate version of the above equation and that can be successfully used towards algorithmic trading.

We can also apply this modeling on a time frame of days or weeks in addition to my intention of applying it to intraday trading.

For friends who are working on option pricing with stochastic volatility, I want to mention that I am dividing my time between algorithmic trading and SV option pricing. I would continue to post code on option pricing. For algorithmic trading I am working with my cousin who is (assistant) professor at a university in New York state. I would not be posting my code on algorithmic trading but I will regularly share any insights that I can think of. I think I will make a new different thread for algorithmic trading work and copy some of these posts there.

I also want to take this opportunity to thank those kind Americans who tried to save me from persecution and torture when times were extremely tough and I was able to survive because there was a large decrease in my persecution due to pressure on mind control agencies from good people. If I have been able to do any decent and original research work, I owe it to those good and kind Americans who helped me when it was difficult for me to survive. I am very grateful to those kind and good natured American friends who helped me in difficult times. I truly want to thank them for their favors. I also want to thank people of other countries who wished me well when I was facing difficulties.

https://forum.wilmott.com/viewtopic.php?f=4&t=99702&start=1140#p866202

https://forum.wilmott.com/viewtopic.php?f=4&t=99702&start=1140#p866241

https://forum.wilmott.com/viewtopic.php?f=4&t=99702&start=1155#p866316

I am copying the most relevant post about filtering mean-reversion coefficient here

.For pairs trading and many fixed income relative value trades, it would be more interesting to have simple mean-reversion type models where mean reversion is a slowly changing stochastic parameter and find it using Kalman filtering. In that case our simple SDEs for Kalman filtering would be usually simpler since we would not need the stochastic mean as a hidden variable(though sometimes you would still need both a stochastic mean and stochastic mean-reversion)

[$]dX(t)=\, \kappa(t) \, (\theta \, - \,X(t) \, dt+\sigma \, dz(t)[$]

and simple mean reversion sde could be written as

[$]\kappa(t+1)= \, \kappa(t)+ \, \sigma_{\kappa} \, dv(t)[$]

We suppose that theta is approximately known and we have done some research about it though a robust model may not greatly depend on mean reversion target and stochastic kappa would adjust for minor changes in it. So in pairs trading and relative value trades, when kappa is significantly positive, we will know that our pair is converging towards the specified mean reversion target and when kappa is significantly negative, we will know that our pair is diverging away from the mean reversion target. And we would be able to finesse our strategies according to prevailing mean-reversion speed, kappa.

In large fixed income relative value portfolios, we could easily do a high dimensional kalman filter of rates with proper specification of covariances and appropriate calibration and that would greatly help in understanding how rates are changing and we could calculate sensitivities of portfolio with respect to stochastic mean reversion and use that information for trading decision making and risk management. It would also be very useful information in interest options, swaptions and exotic interest derivatives risk management.

..

I believe trading is about relative value and in "market" we have to put dynamics of every financial asset in context relative to each other or relative to a common market. Though there are several ways of describing a market, one good way would be to describe it in reasonably large number of independent orthogonal factors. Again there could be several ways of finding orthogonal factors but (as a start) one good way is through principle component analysis(PCA) of matrix of covariance of logarithmic returns of various financial assets traded in the market.

In what follows I am dealing with logarithmic returns and their orthogonal factors and PCA where all terms can be linearly added.

Again (as a start) we suppose that price of an asset when described in terms of orthogonal factors or principle components represents its theoretical projected price(or theoretical projected return) once the factor returns have been known. I write the accumulated theoretical projected return of one single stock, after T periods have elapsed from a benchmark starting time zero, in terms of realization of M orthogonal factors over the span of T periods as

Theoretical Projected Price[$]= \sum_{t=0}^{T} \, \Big[ c_1 \, r_{1,t} + c_2 \, r_{2,t} +\, ....\, + c_M \, r_{M,t} \Big] =\sum_{t=0}^{T} \sum_{m=1}^{M} \, c_m \, r_{m,t}[$]

where [$]c_m[$] is eigenvector coefficient for the stock for mth factor and [$] r_{m,t} [$] is return of the mth orthogonal factor in t-th time interval.

But in general the realized return of the stock after (accumulation over) T intervals R(T) would not be equal to theoretical projected return calculated from orthogonal factor returns due to factor misspecification or due to idiosyncratic factors. Usually many stocks would remain within a very small error limit from the theoretical projected returns but some few stocks would seriously start to diverge from the theoretical projected returns. And that is precisely what we want to find. We want to find the dynamics of stocks that are diverging from the theoretical projected returns(in either direction) and try to capture the dynamics of this divergence of returns.

We can postulate that accumulated stock returns R(t) (over a period of t intervals starting from a chosen benchmark time zero) usually mean-revert to their (accumulated) theoretical projected returns and write the stochastic differential equation for (accumulated over T periods) returns denoted as R as

[$] dR(t)= \kappa(t) \Big[ \sum_{s=0}^{t} \sum_{m=1}^{M} \, c_m \, r_{m,s} -R(t) \Big] + \sigma_{R} \, dz(t)[$]

while [$]\kappa[$] is modelled as a slowly moving hidden parameter that has its own dynamics given as

[$]\kappa(t+1)= \, \kappa(t)+ \, \sigma_{\kappa} \, dw(t)[$]

Now magnitude and sign of filtered value of hidden parameter [$]\kappa[$] would tell us how fast and in which direction accumulated return on stock in question is changing as compared to theoretical return. Is it converging towards theoretical value or diverging? At the same time we also know how much the stock return has diverged from theoretical return over the benchmark period and this is calculated as[$]\Big[ \sum_{t=0}^{T} \sum_{m=1}^{M} \, c_m \, r_{m,t} -R(T) \Big][$] and with combined knowledge of total divergence of stock return from its theoretical value over a period and rate of this divergence, we can construct a large number of very successful trading strategies.

We can have a multivariate version of the above equation and that can be successfully used towards algorithmic trading.

We can also apply this modeling on a time frame of days or weeks in addition to my intention of applying it to intraday trading.

For friends who are working on option pricing with stochastic volatility, I want to mention that I am dividing my time between algorithmic trading and SV option pricing. I would continue to post code on option pricing. For algorithmic trading I am working with my cousin who is (assistant) professor at a university in New York state. I would not be posting my code on algorithmic trading but I will regularly share any insights that I can think of. I think I will make a new different thread for algorithmic trading work and copy some of these posts there.

I also want to take this opportunity to thank those kind Americans who tried to save me from persecution and torture when times were extremely tough and I was able to survive because there was a large decrease in my persecution due to pressure on mind control agencies from good people. If I have been able to do any decent and original research work, I owe it to those good and kind Americans who helped me when it was difficult for me to survive. I am very grateful to those kind and good natured American friends who helped me in difficult times. I truly want to thank them for their favors. I also want to thank people of other countries who wished me well when I was facing difficulties.

What I have suggested in previous post has been reviewed in slightly different mathematical framework especially by Dr. Marco Avellaneda in one of his papers on pairs trading. I have not read his paper for years but I think when I was brainstorming with pairs trading with klamn filtering, many of the ideas I learnt in his paper were getting processed in back of my brain. Here is link to his paper that where he gives the concept of eigenportfolio returns which I have called theoretical expected return in previous post: https://www.math.nyu.edu/~avellane/AvellanedaLeeStatArb071108.pdf

I think my contribution is that I presented mean-reversion in a kalman filtering framework. I think uses of this Kalman filtering application to find dynamics of divergence between eigenportfolio returns and actual realized return go beyond pairs trading and can be used in many other types of algorithmic trading strategies. And it is also not limited to equities.

I think my contribution is that I presented mean-reversion in a kalman filtering framework. I think uses of this Kalman filtering application to find dynamics of divergence between eigenportfolio returns and actual realized return go beyond pairs trading and can be used in many other types of algorithmic trading strategies. And it is also not limited to equities.

Friends, many times in mathematical modelling of financial assets, we have a time changing drift in prices of financial assets due to changing supply and demand imbalance pressure on the asset prices but on the longer run we have a mean-reversion towards a theoretical target price which can be itself time dependent. This theoretical target price could be an interpolated value with respect to other assets with similar financial characteristic, or some regression on suitably chosen factors, some eigenportfolio or some other suitably chosen time dependent target value around which asset price is supposed to mean-revert. In such cases, we can model the changing drift due to supply and demand imbalance as a hidden variable whose dynamics are given by another SDE. We suppose that we know the mean reversion parameter [$]\kappa[$]'s value and it is not modelled as a hidden variable and rather its value is a locally constant parameter and is found (like other unknown parameters) by optimization of the likelihood function of the filtering equations. So we propose a model in which [$]\mu(t)[$] is a hidden variable with its own SDE while mean-reversion rate [$]\kappa[$] is a locally constant parameter as (in below lowercase are vectors and uppercase are matrices)

[$]\boldsymbol{dx(t)} \, = \, \boldsymbol{\mu(t)} \, dt \, + \boldsymbol{\kappa} \, \Big[\boldsymbol{\theta(t) \, - \, x(t) } \Big] \, + \, \boldsymbol{\Sigma \, dz(t)} [$]

[$]\boldsymbol{\mu(t+1)}=\boldsymbol{\mu(t)} \, - \boldsymbol{\Theta \, \mu(t) }\, dt+ \boldsymbol{\sigma_{\mu} \, dw(t)}[$]

The values of coefficients [$]\boldsymbol{\kappa} [$] , [$]\boldsymbol{\Sigma}[$] , [$]\boldsymbol{\Theta} [$] , [$]\boldsymbol{\sigma_{\mu}}[$] would have to be found by optimization of the likelihood function of the local data after filtering. The above SDEs can easily be written in the form of a multivariate Kalman filter where hidden parameter [$]\boldsymbol{\mu(t)}[$] is being filtered. For assets that actually have mean-reversion dynamics, the filtering equation of drift in above SDEs are likely to be far more accurate as compared to modelling approaches in which we do not explicitly include mean-reversion. Since our dynamics of drift are multivariate, we would be collecting a lot of information about drift of a particular asset from cross-section of market drift of other correlated financial assets. Again [$]\boldsymbol{\kappa} [$] would also be slowly changing with time but we do not give it any hidden dynamics and only change its value when we recalibrate/re-optimize the model possibly after every few hours.

We can have several variations on the theme on lines of the previous post https://forum.wilmott.com/viewtopic.php?f=4&t=99702&start=1170#p866859 where we can replace mean-reversion term

[$]\boldsymbol{\kappa} \, \Big[\boldsymbol{\theta(t) \, - \, x(t) } \Big] \,[$]

by

[$]\boldsymbol{\kappa \,\Big[ \sum_{t=0}^{T} \sum_{m=1}^{M} \, c_m \, r_{m,t} -\sum_{t=0}^{T} dx(t) \Big] }[$]

and try a lot of other such interesting possibilities.

[$]\boldsymbol{dx(t)} \, = \, \boldsymbol{\mu(t)} \, dt \, + \boldsymbol{\kappa} \, \Big[\boldsymbol{\theta(t) \, - \, x(t) } \Big] \, + \, \boldsymbol{\Sigma \, dz(t)} [$]

[$]\boldsymbol{\mu(t+1)}=\boldsymbol{\mu(t)} \, - \boldsymbol{\Theta \, \mu(t) }\, dt+ \boldsymbol{\sigma_{\mu} \, dw(t)}[$]

The values of coefficients [$]\boldsymbol{\kappa} [$] , [$]\boldsymbol{\Sigma}[$] , [$]\boldsymbol{\Theta} [$] , [$]\boldsymbol{\sigma_{\mu}}[$] would have to be found by optimization of the likelihood function of the local data after filtering. The above SDEs can easily be written in the form of a multivariate Kalman filter where hidden parameter [$]\boldsymbol{\mu(t)}[$] is being filtered. For assets that actually have mean-reversion dynamics, the filtering equation of drift in above SDEs are likely to be far more accurate as compared to modelling approaches in which we do not explicitly include mean-reversion. Since our dynamics of drift are multivariate, we would be collecting a lot of information about drift of a particular asset from cross-section of market drift of other correlated financial assets. Again [$]\boldsymbol{\kappa} [$] would also be slowly changing with time but we do not give it any hidden dynamics and only change its value when we recalibrate/re-optimize the model possibly after every few hours.

We can have several variations on the theme on lines of the previous post https://forum.wilmott.com/viewtopic.php?f=4&t=99702&start=1170#p866859 where we can replace mean-reversion term

[$]\boldsymbol{\kappa} \, \Big[\boldsymbol{\theta(t) \, - \, x(t) } \Big] \,[$]

by

[$]\boldsymbol{\kappa \,\Big[ \sum_{t=0}^{T} \sum_{m=1}^{M} \, c_m \, r_{m,t} -\sum_{t=0}^{T} dx(t) \Big] }[$]

and try a lot of other such interesting possibilities.

https://forum.wilmott.com/viewtopic.php?f=15&t=94796&p=866997#p866997

I mentioned on this forum that mind control crooks had stolen my phone about a month ago and I had to cancel the sim and get a different phone. Now they have stolen my phone again. Stealing my stuff is one thing in which proud American army crooks excel at. A week ago they stole some of my boxer shorts from my room but I did not write here. Not that army army crooks have some psychological disease to steal boxer shorts, it just happened that I had bought some new cotton boxers that were thick and sturdy and mind control does not work properly unless our private body parts are properly charged so american army crooks love stealing such things so that they could continue mind control.

Last night after writing my post on technical forum, I went out on my car and crooks stole my phone again since I forgot it at my home and did not take it with me. It seems that venom-filled American army agents have run out of all justifications to continue to persecute me and now they want to use my phone to concoct some justification to retard me by using my phone. When they stole my previous phone a month ago, I made a warning to all friends that my phone had been stolen and anything said out of my phone did not belong to me and that machinatory American army crooks might use my phone to create a justification to continue my persecution. Basically purpose of my writing this post is to tell good people that my phone has been stolen by crooks and therefore please do not believe in anything said out of it. (After killing a million people in Iraq due to their venom, American army crooks were innocently claiming that an Iraqi chemistry professor had fooled us. How innocent. So they might innocently say something out of my phone and then start innocently claiming that we were led by things said out of his phone. Not a new thing for these crooks)

As I had told friends that mind control crooks are assisted by several mathematical finance experts and these experts continue to brief the crooks about how good my ideas are about my work. So after I made my last post on technical forum, mind control crook who was speaking in my brain became stayed and started to chew words and was thoroughly annoyed.

After I came back to home from outside, and came to know that my phone had been stolen from my home, I did not work and decided to sleep. I just woke up in the middle of the night at (2:00 am) because there was an extreme amount of foreign substance that had been forced into my mouth (that settles on the tongue and upper jaw where we have most taste buds) that felt extremely bitter and I woke up in the middle of my sleep to brush my mouth to clear the chemical substance forced into my mouth( I had complained about it several times on this forum but to no avail).

I mentioned on this forum that mind control crooks had stolen my phone about a month ago and I had to cancel the sim and get a different phone. Now they have stolen my phone again. Stealing my stuff is one thing in which proud American army crooks excel at. A week ago they stole some of my boxer shorts from my room but I did not write here. Not that army army crooks have some psychological disease to steal boxer shorts, it just happened that I had bought some new cotton boxers that were thick and sturdy and mind control does not work properly unless our private body parts are properly charged so american army crooks love stealing such things so that they could continue mind control.

Last night after writing my post on technical forum, I went out on my car and crooks stole my phone again since I forgot it at my home and did not take it with me. It seems that venom-filled American army agents have run out of all justifications to continue to persecute me and now they want to use my phone to concoct some justification to retard me by using my phone. When they stole my previous phone a month ago, I made a warning to all friends that my phone had been stolen and anything said out of my phone did not belong to me and that machinatory American army crooks might use my phone to create a justification to continue my persecution. Basically purpose of my writing this post is to tell good people that my phone has been stolen by crooks and therefore please do not believe in anything said out of it. (After killing a million people in Iraq due to their venom, American army crooks were innocently claiming that an Iraqi chemistry professor had fooled us. How innocent. So they might innocently say something out of my phone and then start innocently claiming that we were led by things said out of his phone. Not a new thing for these crooks)

As I had told friends that mind control crooks are assisted by several mathematical finance experts and these experts continue to brief the crooks about how good my ideas are about my work. So after I made my last post on technical forum, mind control crook who was speaking in my brain became stayed and started to chew words and was thoroughly annoyed.

After I came back to home from outside, and came to know that my phone had been stolen from my home, I did not work and decided to sleep. I just woke up in the middle of the night at (2:00 am) because there was an extreme amount of foreign substance that had been forced into my mouth (that settles on the tongue and upper jaw where we have most taste buds) that felt extremely bitter and I woke up in the middle of my sleep to brush my mouth to clear the chemical substance forced into my mouth( I had complained about it several times on this forum but to no avail).

For the context of my persecution, please see

In this thread I have given some account of my persecution spread over past 23 years.

My Letter to HRW About My Human Rights Abuse : https://forum.wilmott.com/viewtopic.php?f=15&t=102298

In the thread below I have given some discrete hints about why American defense is so rabid to persecute me and other muslims like me(and blacks) (and why no president finds it politically expedient to end mind control on innocent human beings.)

Muslims, mind control, Muslim-Jewish relationship and American defense: https://forum.wilmott.com/viewtopic.php?f=15&t=101453

In the thread below I tried in vain to request prime minister of my country to end mind control here but he is helpless before crook generals in Pakistan army who take hundreds of millions of dollars in bribes from CIA.

My Open Letter to Prime Minister of Pakistan, Imran Khan, to Intervene In Order to Protect the Interests of Pakistan https://forum.wilmott.com/viewtopic.php?f=15&t=94796&start=1125#p858119

In this thread I have given some account of my persecution spread over past 23 years.

My Letter to HRW About My Human Rights Abuse : https://forum.wilmott.com/viewtopic.php?f=15&t=102298

In the thread below I have given some discrete hints about why American defense is so rabid to persecute me and other muslims like me(and blacks) (and why no president finds it politically expedient to end mind control on innocent human beings.)

Muslims, mind control, Muslim-Jewish relationship and American defense: https://forum.wilmott.com/viewtopic.php?f=15&t=101453

In the thread below I tried in vain to request prime minister of my country to end mind control here but he is helpless before crook generals in Pakistan army who take hundreds of millions of dollars in bribes from CIA.

My Open Letter to Prime Minister of Pakistan, Imran Khan, to Intervene In Order to Protect the Interests of Pakistan https://forum.wilmott.com/viewtopic.php?f=15&t=94796&start=1125#p858119

Here are some more relevant posts for American readers

Barack Obama and Mind Control: https://forum.wilmott.com/viewtopic.php?f=15&p=864314#p864253

and finally appeal to new president Joe Biden to end mind control

https://forum.wilmott.com/viewtopic.php?f=15&p=864314#p864314

Barack Obama and Mind Control: https://forum.wilmott.com/viewtopic.php?f=15&p=864314#p864253

and finally appeal to new president Joe Biden to end mind control

https://forum.wilmott.com/viewtopic.php?f=15&p=864314#p864314

I had told friends that American army mind control crooks have control over my computer. Just two or three days ago I noticed in my activity that there were two posts they had liked out of my account. I just "unliked" the posts and did not make a deal about it. But tonight, they liked another two posts from my account and I had to unlike the posts again and then decided to write this post.

My phone(that I mentioned was stolen) was returned in the morning after the night I wrote the post. When I woke up, my mother told me that my phone was lying in the drawing room. Before sleeping I had checked the drawing room very carefully several times and also rang my phone several times from my mother's phone and there was no sound there. They simply returned the phone to my mother and asked her to give it to me.

I might have not written but I do not believe in religion and they like deeply religious posts out of my linkedin account.

Machinations of spiteful and malicious mind control crooks of American army are simply not ending.

My phone(that I mentioned was stolen) was returned in the morning after the night I wrote the post. When I woke up, my mother told me that my phone was lying in the drawing room. Before sleeping I had checked the drawing room very carefully several times and also rang my phone several times from my mother's phone and there was no sound there. They simply returned the phone to my mother and asked her to give it to me.

I might have not written but I do not believe in religion and they like deeply religious posts out of my linkedin account.

Machinations of spiteful and malicious mind control crooks of American army are simply not ending.

Friends, sorry about my past few posts. If my persecution were not steadily increasing, I would not have cared but I really had to say something here to force mind control agency to decrease my mind control.

Back to business now. I had written a simple univariate Kalman filter routine with fixed variances. It was a very simple filter. (My real idea about Kalman filtering was to do a properly calibrated multivariate filter to interpolate the drift in returns from multivariate data. ) Anyway, when I was playing with univariate filter, I tried some other ideas that I want to share with friends.

First I want to show friends a graph of filtered logarithmic returns and filtered logarithmic prices(generated from putting together filtered returns) VS original returns and original logarithmic prices. This is "MSFT" stock data on "14\04\2021"

I have subtracted starting Log price from the log price graphs so that graphs remain visible on the same scale.

I want to mention for friends again that blue graphs has been constructed from red returns and magenta graph has been constructed from filtered green returns. Please notice how closely blue and magenta graphs follow each other.

Then I had the idea to try regression for auto-correlation on filtered returns VS regression for auto-correlation on original returns. The underlying idea is that in original returns there is extreme noise in both the variable being regressed and also in the explanatory variable and that strongly spoils explanatory power of regression. I regressed the filtered returns and original returns (on previous values) after every hundred instances of data(we have 1560 data points in total during the day at an interval of fifteen seconds).

I am copying a typical matlab regression diagnostics for auto-correlation on filtered returns and auto-correlation on original returns data.

Following is diagnostics for auto-correlation on filtered returns.

mdl =

Linear regression model:

y ~ 1 + x1

Estimated Coefficients:

Estimate SE tStat pValue

_____________________ ____________________ __________________ _____________________

(Intercept) -1.08931289638274e-06 2.49865366333489e-06 -0.435959938092766 0.66293315332688

x1 0.643305860461598 0.0204953915720911 31.3878297079036 4.18295581915735e-164

Number of observations: 1399, Error degrees of freedom: 1397

Root Mean Squared Error: 9.34e-05

R-squared: 0.414, Adjusted R-Squared 0.413

F-statistic vs. constant model: 985, p-value = 4.18e-164

Following is diagnostics for auto-correlation on original non-filtered returns.

md2 =

Linear regression model:

y ~ 1 + x1

Estimated Coefficients:

Estimate SE tStat pValue

_____________________ ____________________ __________________ _________________

(Intercept) -3.02773437841068e-06 6.66354594477685e-06 -0.454372852457622 0.649631076236237

x1 0.00509943026632265 0.026769288642365 0.19049554638715 0.848948510416014

Number of observations: 1399, Error degrees of freedom: 1397

Root Mean Squared Error: 0.000249

R-squared: 2.6e-05, Adjusted R-Squared -0.00069

F-statistic vs. constant model: 0.0363, p-value = 0.849

Interesting thing is that autocorrelation coefficient on filtered returns is 0.643305860461598 with R-squared: 0.414

while autocorrelation coefficient on original returns is 0.00509943026632265 with R-squared: 2.6e-05

while we notice that both filtered price(reconstructed from filtered returns) and original price follow each other very faithfully.

SO we probably need to slightly smooth the financial data before we use for regressions, artificial intelligence and other statistical calculations to get meaningful results because mostly in financial calculations both the input data and resultant data re too noisy which causes all sort of noise in the inference process.

Tomorrow, I will be posting my programs used to generate these simple results.

Back to business now. I had written a simple univariate Kalman filter routine with fixed variances. It was a very simple filter. (My real idea about Kalman filtering was to do a properly calibrated multivariate filter to interpolate the drift in returns from multivariate data. ) Anyway, when I was playing with univariate filter, I tried some other ideas that I want to share with friends.

First I want to show friends a graph of filtered logarithmic returns and filtered logarithmic prices(generated from putting together filtered returns) VS original returns and original logarithmic prices. This is "MSFT" stock data on "14\04\2021"

I have subtracted starting Log price from the log price graphs so that graphs remain visible on the same scale.

I want to mention for friends again that blue graphs has been constructed from red returns and magenta graph has been constructed from filtered green returns. Please notice how closely blue and magenta graphs follow each other.

Then I had the idea to try regression for auto-correlation on filtered returns VS regression for auto-correlation on original returns. The underlying idea is that in original returns there is extreme noise in both the variable being regressed and also in the explanatory variable and that strongly spoils explanatory power of regression. I regressed the filtered returns and original returns (on previous values) after every hundred instances of data(we have 1560 data points in total during the day at an interval of fifteen seconds).

I am copying a typical matlab regression diagnostics for auto-correlation on filtered returns and auto-correlation on original returns data.

Following is diagnostics for auto-correlation on filtered returns.

mdl =

Linear regression model:

y ~ 1 + x1

Estimated Coefficients:

Estimate SE tStat pValue

_____________________ ____________________ __________________ _____________________

(Intercept) -1.08931289638274e-06 2.49865366333489e-06 -0.435959938092766 0.66293315332688

x1 0.643305860461598 0.0204953915720911 31.3878297079036 4.18295581915735e-164

Number of observations: 1399, Error degrees of freedom: 1397

Root Mean Squared Error: 9.34e-05

R-squared: 0.414, Adjusted R-Squared 0.413

F-statistic vs. constant model: 985, p-value = 4.18e-164

Following is diagnostics for auto-correlation on original non-filtered returns.

md2 =

Linear regression model:

y ~ 1 + x1

Estimated Coefficients:

Estimate SE tStat pValue

_____________________ ____________________ __________________ _________________

(Intercept) -3.02773437841068e-06 6.66354594477685e-06 -0.454372852457622 0.649631076236237

x1 0.00509943026632265 0.026769288642365 0.19049554638715 0.848948510416014

Number of observations: 1399, Error degrees of freedom: 1397

Root Mean Squared Error: 0.000249

R-squared: 2.6e-05, Adjusted R-Squared -0.00069

F-statistic vs. constant model: 0.0363, p-value = 0.849

Interesting thing is that autocorrelation coefficient on filtered returns is 0.643305860461598 with R-squared: 0.414

while autocorrelation coefficient on original returns is 0.00509943026632265 with R-squared: 2.6e-05

while we notice that both filtered price(reconstructed from filtered returns) and original price follow each other very faithfully.

SO we probably need to slightly smooth the financial data before we use for regressions, artificial intelligence and other statistical calculations to get meaningful results because mostly in financial calculations both the input data and resultant data re too noisy which causes all sort of noise in the inference process.

Tomorrow, I will be posting my programs used to generate these simple results.

Friends, I have decided to go to China and find work in some good financial firm there. I love my country and wanted to live here for the rest of my life but my life is no more than a joke in hands of American mind control crooks. In last few days, I had worked out some strategies that were working on some stocks with certain characteristics. In very raw form the strategies were generating .5% to 4% on an average of 100-300 trades a day without including transaction costs irrespective of whether the stock went up or down. I was a bit excited and continued to play with the models for several days. But this morning when I wanted to try my ideas to improve the models and I ran my programs, I was surprised to find that there were miniscule profits and all losses. I looked at my programs very carefully. It was not a big program rather very small matlab files. And there were not a large amount of data. I had tried my programs on four very liquid stocks on two months of data. I had large tick data files and I had converted (two months of) them to data on fifteen seconds grid so I can experiment with this and then go to full scale data later. I tried everything and even undid all of the small changes since yesterday using the undo button on editor but nothing worked. Mind control crooks used to change my program very frequently before 2016 and I have very bitter memories of that time. They can especially change output in matlab. Now mind control crooks will give my programs to black sheep of my old university (who were behind instigating my persecution) who will make profits from my program and in turn support American mind control crooks in Pakistan who would swindle several tens of millions of dollars and this symbiotic relationship between black sheep and mind control crooks would continue to my peril. I am sick of being manipulated and abused for a large portion of my adult life and therefore I have finally decided that may be I should leave my country and go to China and try to work with some good financial firm and try to find some peace in my life out of the reach of American mind control crooks.

Now I am afraid that lowly and machinatory American mind control crooks would start blocking my emails and linkedin messages to Chinese friends with request for employment. I want to request all good Americans and good people of all other countries to please force these machinatory crooks to let me restart my life peacefully in China where I could live a free life without any mind control torture and forced abuse for the rest of my life.

Now I am afraid that lowly and machinatory American mind control crooks would start blocking my emails and linkedin messages to Chinese friends with request for employment. I want to request all good Americans and good people of all other countries to please force these machinatory crooks to let me restart my life peacefully in China where I could live a free life without any mind control torture and forced abuse for the rest of my life.

Friends, I want to share my "little secret algorithm" that I used to make money as I mentioned in the previous post (If it were in my powers, I would give everyone money equal to Jeff Bezos' wealth)

First some background. I have been of the view that there are three types of markets

a. market that hovers around in a certain band. A much better and scientific definition of this market is that it has negative auto-correlation between logarithmic stock returns (log price differences).

b. Positive autocorrelation with positive drift.

c. Positive autocorrelation with negative drift.

I was able to handle the markets where autocorrelation between returns is negative with a very simple algorithm. You do not need very high negative correlation for the algorithm to work. It would work great when market has autocorrelation coefficient on regression lesser than -.025. For autocorrelation coefficients on regression below -.05, the method would work wonders. For this you do not use autocorrelation on filtered returns but on realized returns.

I took trading signals from Kalman filtered returns and not from realized returns even though autocorrelation was measured on realized returns. In my filter, I had arbitrarily divided the variance between brownian motion associated with hidden process and brownian motion associated with observation process (that is realized returns). I will post my filter matlab algorithm later today or possibly tomorrow. I had noticed how you divide the variance between two brownian motions affects the quality and profits of the algorithm quite a bit.

Coming to the algorithm, when filtered value of log returns would exceed +.0001 (this can be altered but it was a great benchmark value probably since it was log difference. Please note that this value was from filtered returns and not realized returns.), I would go short and end the trade by buying when I would encounter another negative return of -.00008. And similarly when I would encounter a negative log return of value -.0001, I would buy the stock only to end the trade by selling when I encounter a return of +.00008. As long as the correlation coefficient on regression on previous values remains negative, this algorithm works wonders. Sorry I forgot to mention that all logarithmic returns are on 15 seconds interval. As long as regression coefficient on autocorrelation regression remains even mildly negative the algorithm makes good profits. I was playing with returns that are differences of log prices.

However the algorithm has pitfalls that I wanted to fix in my later research. When stock price moves consistently in a certain direction in episodes of sentiment, the algorithm loses big money. This can be fixed by making stop loss so algorithm ends the trade when stock moves significantly in a certain direction. I wanted to find out from the market cross-section about episodes of sentiment in the market to be able to trade on sentiment appropriately and differently but that is only future research. For the two month time period I had AMZN had great profits in "log difference" terms since this stock had larger negative auto-correlation between log returns during most of this period. "TSLA" was second with large profits. AAPL also had nice profits. Only "MSFT" had small profits since its autocorrelation was most positive of all four stocks and it had more bursts of sentiment and correlated activity. I still think that even MSFT can be very profitably traded but for that to do, you would need to know about intervals of sentiment in the market possibly from market cross-section data.

I will post my filter matlab algorithm later today or possibly tomorrow but I will not include the whole trade setup.

First some background. I have been of the view that there are three types of markets

a. market that hovers around in a certain band. A much better and scientific definition of this market is that it has negative auto-correlation between logarithmic stock returns (log price differences).

b. Positive autocorrelation with positive drift.

c. Positive autocorrelation with negative drift.

I was able to handle the markets where autocorrelation between returns is negative with a very simple algorithm. You do not need very high negative correlation for the algorithm to work. It would work great when market has autocorrelation coefficient on regression lesser than -.025. For autocorrelation coefficients on regression below -.05, the method would work wonders. For this you do not use autocorrelation on filtered returns but on realized returns.

I took trading signals from Kalman filtered returns and not from realized returns even though autocorrelation was measured on realized returns. In my filter, I had arbitrarily divided the variance between brownian motion associated with hidden process and brownian motion associated with observation process (that is realized returns). I will post my filter matlab algorithm later today or possibly tomorrow. I had noticed how you divide the variance between two brownian motions affects the quality and profits of the algorithm quite a bit.

Coming to the algorithm, when filtered value of log returns would exceed +.0001 (this can be altered but it was a great benchmark value probably since it was log difference. Please note that this value was from filtered returns and not realized returns.), I would go short and end the trade by buying when I would encounter another negative return of -.00008. And similarly when I would encounter a negative log return of value -.0001, I would buy the stock only to end the trade by selling when I encounter a return of +.00008. As long as the correlation coefficient on regression on previous values remains negative, this algorithm works wonders. Sorry I forgot to mention that all logarithmic returns are on 15 seconds interval. As long as regression coefficient on autocorrelation regression remains even mildly negative the algorithm makes good profits. I was playing with returns that are differences of log prices.

However the algorithm has pitfalls that I wanted to fix in my later research. When stock price moves consistently in a certain direction in episodes of sentiment, the algorithm loses big money. This can be fixed by making stop loss so algorithm ends the trade when stock moves significantly in a certain direction. I wanted to find out from the market cross-section about episodes of sentiment in the market to be able to trade on sentiment appropriately and differently but that is only future research. For the two month time period I had AMZN had great profits in "log difference" terms since this stock had larger negative auto-correlation between log returns during most of this period. "TSLA" was second with large profits. AAPL also had nice profits. Only "MSFT" had small profits since its autocorrelation was most positive of all four stocks and it had more bursts of sentiment and correlated activity. I still think that even MSFT can be very profitably traded but for that to do, you would need to know about intervals of sentiment in the market possibly from market cross-section data.

I will post my filter matlab algorithm later today or possibly tomorrow but I will not include the whole trade setup.

I forgot to mention in the previous post that in very raw form the strategies were generating .5% to 4% on an average of 100-300 trades a day without including transaction costs irrespective of whether the stock went up or down. AMZN was the nicest stock and on more than one date AMZN returned close to or more than 6% and this was without any stop-loss. AMZN easily yielded more than one percent on most of the dates and was usually close to 2% or 3%. Without stop-loss "MSFT" had several negative days and even on most positive days, it returned less than one percent.

Friends, I am writing this post to warn the friends about possibility of concocting some proof of my wrongdoing by mind control agency. They have stolen my phone twice in past 45 days and every time I had to post a warning that my phone had been stolen. I really think that purpose of stealing my phone was to say something out of it that might be possibly "terrorist-like" or possibly something that just shows malicious mentality towards good-natured American people or nice people somewhere else in the world.

Without sounding like I am giving explanations, I want to tell friends that my persecution has continued for at least 23 years now. There are times when I have been upset (in thought) at psychiatrists, mind control agency or even my family but my angry thoughts only resulted in my intention to make complaints to authority about wrongdoings of the psychiatrists, exposing the mind control agency in public and thinking of living alone when I would be financially independent of my family while still wishing genuinely good to members of my family. Despite that I would be a bit upset in thought, I would still be nice and never on a single time turned violent or lost control.

But I have this feeling now that some people in mind control agencies who are behind my persecution are losing patience and want to prove by hook or crook that I am indeed a bad or evil person and stealing of my phone again and again is expression of their desire to do something concrete once for all to end my exposing them continuously in public all over the world and also to find a valid justification of their otherwise racist crimes.

At this point I want to recall that a British bank stole my thousand pounds when I was in UK during 2010-2011. I have written about it here: https://forum.wilmott.com/viewtopic.php?f=15&t=102298#p857494

Anyway the bank had stolen my thousand pounds and had bitterly refused to make any written correspondence about it. When I went to the same branch of the bank an official there walked with me out of the bank and talked to me about the issue outside the bank building close to the entrance of the bank. I had been writing about the issue on wilmott in detail. But when the bank official told me that they would show me a video of my walking inside the bank and withdrawing money out of the bank, earth slipped beneath my feet and I realized that the bank was ready for high level technological forgery to prove me wrong. Once they would have forged a tape proving me wrong, I would have absolutely no reprieve in a foreign country and everybody would have blamed me. British secret services were already forcefully stopping me from meeting law firms to discuss my case with them. Close to British supreme court building there is a large walled compound where there are many law firms and I was asked to leave the compound after I had gotten inside through security checks at the gate by a security staff that came from behind and I was told that police would be called if I did not comply. Once I tried to approach the law firms on the main streets, British secret services were already prepared and a guy would approach me at every law firm's door and ask me that they were not willing to accept any documents from me and nobody would be willing to meet me in person and I would be told that only way to communicate with them would be through email because my emails were routinely stopped whenever mind control agencies wished to this day(even now). I was again and again told that in Britain you could not get a lawyer by yourself and you had to go to a solicitor and he would assign you a lawyer.

Anyway long story short, I knew that after high level technical forgery by the bank, there would not be any possibility for me to say that I was innocent and no expert would ever be willing to help me in proving that bank had forged the tapes and I would have to bear all the blame.

I have written about law firms and the stealing of the money by British bank in detail in the address of the post given above.

I want people to know that forging evidence is not a new things for crooks of American defense and they are experts at such things and when these hardliner crooks want bitterly to continue their racist practices, they are sure to resort to such evil practices. And the way these crooks are getting impatient, I am sure that sooner or later they would resort to their machinatory practice of forging and concocting evidence to somehow continue my persecution.

I really hope that good people would hear my argument and would be careful to believe these crooks.

Without sounding like I am giving explanations, I want to tell friends that my persecution has continued for at least 23 years now. There are times when I have been upset (in thought) at psychiatrists, mind control agency or even my family but my angry thoughts only resulted in my intention to make complaints to authority about wrongdoings of the psychiatrists, exposing the mind control agency in public and thinking of living alone when I would be financially independent of my family while still wishing genuinely good to members of my family. Despite that I would be a bit upset in thought, I would still be nice and never on a single time turned violent or lost control.

But I have this feeling now that some people in mind control agencies who are behind my persecution are losing patience and want to prove by hook or crook that I am indeed a bad or evil person and stealing of my phone again and again is expression of their desire to do something concrete once for all to end my exposing them continuously in public all over the world and also to find a valid justification of their otherwise racist crimes.

At this point I want to recall that a British bank stole my thousand pounds when I was in UK during 2010-2011. I have written about it here: https://forum.wilmott.com/viewtopic.php?f=15&t=102298#p857494

Anyway the bank had stolen my thousand pounds and had bitterly refused to make any written correspondence about it. When I went to the same branch of the bank an official there walked with me out of the bank and talked to me about the issue outside the bank building close to the entrance of the bank. I had been writing about the issue on wilmott in detail. But when the bank official told me that they would show me a video of my walking inside the bank and withdrawing money out of the bank, earth slipped beneath my feet and I realized that the bank was ready for high level technological forgery to prove me wrong. Once they would have forged a tape proving me wrong, I would have absolutely no reprieve in a foreign country and everybody would have blamed me. British secret services were already forcefully stopping me from meeting law firms to discuss my case with them. Close to British supreme court building there is a large walled compound where there are many law firms and I was asked to leave the compound after I had gotten inside through security checks at the gate by a security staff that came from behind and I was told that police would be called if I did not comply. Once I tried to approach the law firms on the main streets, British secret services were already prepared and a guy would approach me at every law firm's door and ask me that they were not willing to accept any documents from me and nobody would be willing to meet me in person and I would be told that only way to communicate with them would be through email because my emails were routinely stopped whenever mind control agencies wished to this day(even now). I was again and again told that in Britain you could not get a lawyer by yourself and you had to go to a solicitor and he would assign you a lawyer.

Anyway long story short, I knew that after high level technical forgery by the bank, there would not be any possibility for me to say that I was innocent and no expert would ever be willing to help me in proving that bank had forged the tapes and I would have to bear all the blame.

I have written about law firms and the stealing of the money by British bank in detail in the address of the post given above.

I want people to know that forging evidence is not a new things for crooks of American defense and they are experts at such things and when these hardliner crooks want bitterly to continue their racist practices, they are sure to resort to such evil practices. And the way these crooks are getting impatient, I am sure that sooner or later they would resort to their machinatory practice of forging and concocting evidence to somehow continue my persecution.

I really hope that good people would hear my argument and would be careful to believe these crooks.