Vladimir R. Evstigneev Slide 1 Support and Resistance Levels as Parameters of a Flexible Boundaries Problem in the Calculus of Variations Slide 2 A couple of two interchangeable problems appears: 1. Direct problem - once we've got an instantaneous drift function and an instantaneous diffusion function, construct a probability density function with required properties. 2. Inverse problem - having constructed a probability dinsity function with required properties, find the drift term and the instantaneous diffusion term in order to estimate the spectrum. Solution to the latter problem permits to build a vehicle for the PDF to evolve in time, either in terms of a series decomposition as a solution to the corresponding Fokker - Planck equation, or in terms of (a Mercer theorem-based approximation to) the kernel of an integral transform, once we might prefer a sourcewise representation as our basic tool to make the PDF evolve in time. A solution with flexible boundaries is an alternative approach to the extreme values problem, and therefore allows to determine certain critical values of "abnormal prices". Slide 3 We shall follow the two strings of inference, respectively. Let's embark on solving the direct problem first. Recall that the "twin functions", i.e. the instantaneous drift term μ (x) and the instantaneous diffusion term σ (x) define a Fokker - Planck equation d p ( xt) dt d 2 2 ( ( x) p ( xt) ) dx d ( ( x) p ( xt) ) dx for the PDF p(x,t) and an equation of motion d x( t) dt ( x) for the mean value. Slide 4 Consider the simplest mean-reverting Uhlenbeck - Ornstein process. ( x) m x ( x) s 2 The stationary solution to the corresponding Fokker - Planck equation is the famous normal distribution. Ne N d ( x) ( x) dx ( x) dx N e ( m x) 2 s 2 2 1 s 2 The arbitrary constant is normalized with regard to the entire real axis. Slide 5 Consider now a more complicated family of equations of motion. Each of them is related to a problem in the calculus of variations. ( x) 1 ( 1) 1 x 2 2 2 2 6 x 3 x 2 x 3 x 2 x 1 ( 1) 1 x ( 1) x ( 1) 3 The above-given drift term, e.g., is related to the following variational problem. F( P( x) p ( x) u( x) ( x) x) 2 3 2 p ( x) ln( p ( x) ) x p ( x) x p ( x) x p ( x) ( x) ( x ( x) u( x) ) u( x) p ( x) Here F( P(x) p (x) u( x) ( x) x) is a functional the definite integral of which is to be minimized, U(x) is the utility function meeting the Stiglitz condition, i.e. the Epstein - Zin utility, u ( x) ( x) dU( x) dx d 2 2 U( x) dx 1 1 u ( x) an auxiliary function ( x) is a functional Lagrange multiplier, 1 c pertains to a stochastic pricing kernel that guarantees fair (equilibtium) pricing, ρ is the zero-coupon rate and c is the known marginal utility of the present value of the investment portfolio; x is the portfolio value bounded within the interval [0, 2]. The Greek scalars are the parameters to be estimamted via maximum likelihood. 1 1 u( x) x p ( x) 1 c Slide 6 We are especially interested in solving a variational problem with the following functional, 2 F( P( x) p ( x) m( x) ( x) x) 3 p ( x) ln( p ( x) ) x p ( x) x p ( x) x p ( x) ( x m( x) ) p ( x) ( x) p ( x) where m(x) is the "local center" function with flexible left and right boundaries, ξ and ζ . This problem is solved by a PDF p(x) and m(x) and a third function, f(x), as shown below; n=ln(N). p ( x) N exp ( 1) x 3 2 m( x) 3 n f ( x) n 3 2 2 3 ( 1) x 3 ( 1) [ 2 ( ) ] 2 n n x 3 3 3 3 2 2 2 3 ( 1) [ 2 ( ) ] 2 x 3 2 2 3 x x 2 n x 3 2 2 The function f(x) defines the instantaneous drift and diffusion terms as follows. ( x) d ( x) ( x) f ( x) dx ( x) f ( x) 2 2 3 ( ) 3 2 n 3 ( ) 2 x Slide 7 Recall that the idea of a "local center" stems from behavioral finance and is dated back to Herbert Simon's famous writings on suboptimal decision making. The boundary functions that determine the transversality conditions are assumed to be as simple as possible, so they are set linear with ι as "leap back" parameter to be determined via maximum likelihood as well. At the left boundary... ( x) x At the right boundary... ( x) x Transversality conditions imply, as x approaches ξ ... 2 3 p ( x) ln( p ( x) ) x x d ( x) ( x) x x dx 0 Transversality conditions imply, as x approaches ζ ... 2 3 p ( x) ln( p ( x) ) x x d ( x) ( x) x x dx 0 Meeting the transversality conditions requires that the two parameters, α and β , be expressed in terms of the flexible boundaries regarded as parameters, too. Slide 8 Consider a time series of monthly S&P500 quotes since January, 1990, up to March, 2014. Regard the flexible boundaries as natural baundaries of the domain for the PDF. These boundaries may as well be regarded as "natural" support and resistance levels. The trading rule may, thus, read as follows: long if the last price was below the lower boundary (therefore, disobeying the "core" distribution) plus two times ι ; short if the last price was above the upper boundary plus two times ι . The performance of a back testing portfolio is presented below. M is the naive buy-and-hold portfolio and G is a time track of the support-resistence boundaries-based portfolio. The length of the moving period ("window") equals 25 observation. 10 10 8 8 6 6 G M 4 4 2 2 0 2 0 100 200 0 300 Slide 9 Consider now hourly quotes of the EUR/USD exchange rates. Select randomly a sample set, say, since 19 October to 3 December 2012. The trading rule is almost the same safe that the position sign is multiplied by the sign of the difference betwen the last quote and the first momet of the PDF estimated over the corresponding moving period. Here again, M is the porfolio mimicking the market and G is the rule-based portfolio. A few words must be said as concerns the second string of inference, i.e. the inverse problem. As one starts with a variational problem, the drift term, μ (x), can be easily expressed in terms of σ (x) and f(x). It is nor an easy task to find σ (x), however. 2 0 1 1 2M G 3 0 4 2.710 4 4 2.7210 2.7410 4 4 2.7610 Slide 10 Define the three parameterizing functions and a Sturm - Liouville equation, as usual. P0( x) ( x) P1( x) 2 d ( x) ( x) dx d P2( x) 2 2 dx P0( x) d 2 2 dx ( x) d ( x) dx u ( x) P1( x) d u ( x) P2( x) u ( x) dx 0 Now turn to the inhomogeneous form of the latter equation. Slide 11 2d 3 f ( x) Let the right-hand part look like ( x) f ( x) f ( x) dx . Then... 2 2 d f ( x) k ( x) 2 k f ( x) ( x) Let the right-hand side be mean reverting, dx . Now... ( x) 2 k ( x) Once we've got a σ (x), we are welcome to proceed directly to μ (x), i.e. the right-hand part of an equation of motion. d x( t) dt ( x) Speaking of the two examples given in the above, in the first instance the right-hand part of the equation of motion would look like this... d x( t) dt 2 f ( x) 3 d f ( x) f ( x) dx ...while in the second instance - like this... d x( t) dt 2 k ( x ) f ( x) k ( x) 2 It is terribly tempting to solve these non-linear equations in order to find their equilibrium points. Slide 12 Or alternatively, one may consider a normal form of the Sturm - Liouville equation, with ω (x) instead of u(x) as its solutions (the mapping from u to ω is homeomorphic and easily attainable). d 2 2 ( x) h ( x) ( x) 0 dx h ( x) P2( x) P0( x) P1( x) 2 1 d P1( x) 4 P0( x) 2 dx P0( x) 1 Then the specific form of σ (x) depends upon the appropriate form of the normal equivalent equation. One may consider various specifications of h(x), the simplest one shown below. h ( x) d 2 2 dx ( x) 2 d ( x) f ( x) d ( x) 1 f ( x) 2 d f ( x) ( x) 2 2 ( x) dx dx dx 1 1 0 The Form of σ (x) is determined by the considerations of convineience as concerns solving the Sturm - Liouville equation. We obtain, eventually, a family of equations of motion corresponding to one and the same PDF (which is a challengong problem itself).