Journal of Mathematics and Statistics

Original Research Paper Drawdown and Drawup of Bi-Directional Grid Constrained Stochastic Processes

Aldo Taranto and Shahjahan Khan

School of Sciences, University of Southern Queensland, Toowoomba, QLD 4350, Australia

Article history Abstract: The Grid Trading Problem (GTP) of , used Received: 14-05-2020 in portfolio loss minimization, generalized dynamic hedging and algorithmic Revised: 04-09-2020 trading, is researched by examining the impact of the drawdown and drawup Accepted: 14-09-2020 of discrete random walks and of Itô diffusions on the Bi-Directional Grid

Constrained (BGC) for profit P and equity E over time. Corresponding Author: t t Aldo Taranto A comprehensive Discrete Difference Equation (DDE) and a continuous School of Sciences, University Stochastic Differential Equation (SDE) are derived and proved for the of Southern Queensland, GTP. This allows fund managers and traders the ability to better stress test Toowoomba, QLD 4350, the impact of volatility to reduce and generate positive returns. These Australia theorems are then simulated to complement the theoretical models with Email: [email protected] charts. Not only does this research extend a rich mathematical problem [email protected] that can be further researched in its own right, but it also extends the applications into the above areas of finance.

Keywords: Grid Trading Problem (GTP), Bi-Directional Grid Constrained (BGC), Random Walks, Itô Diffusions, Probability of Ruin, Maximal Drawdown, Maximal Drawup, Discrete Difference Equation (DDE), Stochastic Differential Equation (SDE)

Introduction dR tX  t dtX ,,, t dWt     (1.1) Grid trading involves the simultaneous going long and which can be simplified for the discrete parts of this going short at the current price rate R (instantly creating a t paper to: hedged position(s)) and also at fixed width g multiples above and below R . As the price rate propagates through t RttWt , (1.2) these grid levels which effectively traverses a binomial     lattice model over time, assumed to be a discrete 1- Dimensional random walk without any loss in generality, where, W(t), t  [0, T] is a standard Wiener process, m but also studied here as a continuous Brownian motion,  is the drift (which effects the direction or trend) and then the system will close many profitable trades at the s ,   0 is the diffusion (which effects the next nearest grid level whilst carrying the losing trades volatility) parameter over a standard filtered probability open. These open losing trades will eventually be either space ,,F  . This continuous formulation will be closed individually when in profit, closed as a system of followed as much as possible and for our discrete losing trades when the system is back in profit, or closed formulations, set  = 0 and  = 1. as a system of losing trades if the losses grow too large. If The drawdown D is defined as the difference the system is not closed in time, it can suddenly lose all or t between the maximum rate of R(s) and the current rate more than the initial equity E , in which case the system is 0 R(t) at time t as: said to be ruined. This is known as the Grid Trading Problem (GTP), emerging from finance and researched DRt  sRsup, t      (1.3) here mathematically as a constrained stochastic process. st0,  Note that the winning trades accumulate linearly over time regardless of the trend or lack of trend, whilst the losing and has been rigorously researched (Graversen and trades accumulate via the triangular number series as a Shiryaev, 2000) and the references therein. This is trend grows linearly over time, as shown in Fig. 1. shown diagrammatically within our discrete binomial Let Rt = R(t) be an Itô diffusion given by: lattice model framework in Fig. 2.

© 2020 Aldo Taranto and Shahjahan Khan. This open access article is distributed under a Creative Commons Attribution (CC-BY) 3.0 license

Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

R R R

T T T 1 2 3 1 2 3 1 2 3

T = 2, W = 2, L = 1, P = 1, E = 1 T = 2, W = 2, L = 3, P = -1, E = 0 T = 3, W = 3, L = 6, P = -3, E = 0

(a) (b) (c)

Fig. 1: GTP and its Profit/Loss Accumulation Process (a). Small Profit (b). Small Loss (c). Larger Loss; R = Rate, t[0, T] = Time, W = Winning trades, L = Losing trades, P = Profit, E = Equity, noting that P  0  E = 0. Dotted lines depict trades closed out in profit at their Take Profit (TP). Solid lines depict open trades in loss that are held until they reach their TP, closed down when the system is back in profit, closed down when loss becomes ‘too large’ or finally if an account is ruined. Note that the winning trades accumulate linearly over time regardless of the trend or lack of trend, whilst the losing trades accumulate via the triangular number series as a trend grows linearly over time

R sup Rs  st0, 

Dt

T

Rt

Fig. 2: Drawdown Dt of a 1-dimensional discrete random walk as time increases, the previous supremum grows as new maxima are formed

A concept that is often ignored, the drawup Ut, is of risk for a stock that follows a particular random process defined as the difference between the minimum rate of is defined (Magdon-Ismail et al., 2004) as: R(s) and the current rate R(t) at time t as:  DDRttsupsup sR t  sup.      (1.5) t0,0,0, Tt T s t    URt  tR s inf,    (1.4)  st0,  Note that the corresponding maximal (maximum) and is shown in Fig. 3. drawup Ūt can be expressed as:

The maximal (maximum) drawdown Dt is commonly  Uttsup U  sup R t  inf R s . (1.6) used in mathematical finance as an indicator and measure t0, T t 0, Tst0, 

183 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

R sup Rs  st0, 

Dt

T

Rt

Ut

in f Rs  st0, 

Fig. 3: Drawdown Dt and Drawup Ut of a 1-dimensional discrete random walk

R

Rt Dt

Ūt

T

(a)

R

T

Rt Ūt

(b)

Fig. 4: Maximal Drawdown Dt and Maximal Drawup Ūt of two 1-Dimensional Discrete Random Walks (a). Scenario 1: < Ūt;

(b). Scenario 2: > Ūt

184 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

The relationship between the maximal drawup Ūt and open until a more opportune time (Stulz, 2013). In the the maximal drawdown Dt is shown in Fig. 4. case of grid trading, it can be considered as a generalized Informally, the maximal drawdown is the largest drop form of hedging of multiple positions simultaneously from a peak to a trough and the maximal drawup is the over time, for the generation of trading profits. largest rise from a trough to a peak. It is identified that Another academic framework for grid trading is the there is a research gap in the Maximal Drawdown consideration of the series of open losing trades in a grid literature as it has only been applied to the trading and system as a portfolio of stocks in the context of Mean- investing of ‘naked’ instruments such as shares, stocks, Variance Potfolio Optimization problem (Schweizer, commodities, which ultimately do not involve derivative 2010; Biagini et al., 2000; Thomson, 2005). This is instruments. This is where one can only profit from because a grid trading session involves a basket of going long, such as watching the shares of IBM go up winning and losing trades that can be likened to a portfolio of winning and losing shares or stocks. The Merton and down and making a profit when the price Rt rises problem, a question about optimal portfolio selection and above the initial purchase price R0. In contrast to this, the use of more sophisticated trading and investment consumption in continuous time, is indeed ubiquitous strategies, in particular the trading of derivative throughout the mathematical finance literature. Since instruments such as Foreign exchange (FX), Contracts Merton’s seminal paper (Merton, 1971), many variants of For Difference (CFDs), futures, options and many more the original problem have been put forward and have been exotic combinations of these derivatives, means that one extensively studied to address various issues arising from can profit from both going long and going short. Bi- economics and finance. For example, (Fleming and Directional grid trading involves this second class of Hern´andez–Hern´andez, 2003) considered the case of instruments and the maximal drawdown and maximal optimal investment in the presence of stochastic volatility. drawup interrelationship is shown in Fig. 4. Davis and Norman (1990; Dumas and Luciano, 1991) and From Fig. 4, it is noted that D does not usually more recently (Czichowsky et al., 2012; Guasoni and t Muhle-Karbe, 2013; Muhle-Karbe and Liu, 2012) equal Ūt but they can be equal in some scenarios or addressed optimal portfolio selection under transaction sample paths. This paper leverages the properties of costs. Rogers and Stapleton (2002) considered optimal drawdown, drawup (and the maximum of these to a investment under time-lagged trading. Vila and lesser extent) to develop a Discrete Difference Equation Zariphopoulou (1997) studied optimal consumption and (DDE) theorem and a Stochastic Differential Equation portfolio choice with borrowing constraints. (SDE) theorem of how the GTP evolves over time, along Turning now to the maximal drawdown of random with their corresponding proofs. walks, the research dates back to (Feller, 1951). One of the most comprehensive and mathematically rigorous Literature Review reviews and advances in the field is due to To the best of the authors’ knowledge, there is no (Magdon-Ismail et al., 2004) and the references within, formal academic definition, other than our own where they denote the distribution function for D by G Dh (Taranto and Khan, 2020a; 2020b), of the GTP D (h) = . It was found that (h) is given by: available within all the references on the subject matter; (Mitchell, 2018; DuPloy, 2008; 2010; Harris, 1998; hT22T 2  n  nnsin  222 King, 2010; 2015; AdmiralMarkets, 2017; Work, GheeeL21, 4 22h D    n1 4 22 22    hh 2018). Note that these are not rigorous peer reviewed  n   journal papers but instead informal blog posts or software user manuals. Even if there were any where, n are the positive solutions of the eigenvalue academic worthy results found on grid trading, there is  2 condition, tan(n) =  and L is given by: a general reluctance for traders to publish any trading h n innovation that will help other traders and potentially erode their own trading edge. Despite this, grid trading can be expressed   2  academically as a form of Dynamic Mean-Variance 0,   Hedging (Duffie and Richardson, 1991; Černý and  h   2T Kallsen, 2007). There are many reasons why a firm would  2 3 2  Lc 1 2 ,  , undertake a , ranging from minimizing the market ch risk exposure to one of its client’s trades by trading in the    h  22 opposite direction (Haigh and Holt, 2000), through to  4 2  2T T   2 2  sinh  e 22  minimizing the loss on a wrong trade by correcting the  1,ee22 h   4  2  2hh 2  2  h new trade’s direction whilst keeping the old trade still   

185 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197 where,  is the unique positive solution of tanh() = Derivation of BGC DDE of GTP  2  and L has three expressions, depending on whether Theorem 3.1 h  2 For a Bi-Directional Grid Constrained random walk  < ,  = or  > . This was then extended to h Rt with a value v per grid width, then the change in equity E over time t is given by the following Discrete random walks on supercritical Galton-Watson trees (Hu et al., 2015). The formulas above are relisted into Difference Equation (DDE): the following, as this paper is mainly interested in when 2 t there is no drift, yielding: EEvtv max R ti0  tT0,  i0  (3.3) ttt 2 2T 2max,vvRRR   tT0,  iii000 iii    3 2 GxLc 2,1. 2 D  c  where, R 1, 1 . i   Neal (2013) proved the formulas for the averages of Proof the maximum height and the minimum height of a random walk attained before n downward movements In this discrete time framework t  of our occur. Finally, (Hu et al., 2015) also computed the exact binomial lattice model, one can see that the equity Et at value of a negative moment of the maximal drawdown of any time t is comprised of the initial equity E0, plus the the standard Brownian motion. sum of all the winning trades Wt, minus the sum of all the losing trades Lt, hence Et = E0 + Pt where the total Methodology profit Pt = Wt-Lt. One can now derive the general formula for E , giving: Having introduced the GTP, its profit or loss t accumulation process, drawdown, drawup and the maximal of these, together with their associated nEE0,, 00 literature, it is noted that in BGC trading, one needs to nEEv1,, vE  100 know the values of Dt, Ut at every point in time tT, as (3.4) shown in Fig. 5. tt Dtttt DU11 U   Having analysed this is detail, one can now n tEEvivvEvP,   1 ti00 formulate the total losses Lt at any time knowing just ii0022 L Dt and Ut: Wt t v 22 EvtDDUU0  tttt . 2 DDUUt t11 t t  LLL    t DU tt 22 (3.2) For simplicity, one wishes to substitute Dt and Ut 1 22 DDUUt  t  t  t . with a formulation that captures the underlying 2 randomness of Rt in terms of the generalized 1- Dimensional discrete random walk, where: (3.2) has been plotted in Fig. 6 for the first 10 g  and t first 10 g  grid levels, about the discrete Rt level. Rti R , (3.5) From Fig. 6, the Rt random walk is hence i0 constrained by grid trading to result in the corresponding profit Pt and equity Et random walks, and: where the total loss Lt is greatest when the linear tt combination of Dt and Ut are the greatest. Having Dvmax, RR tii  tT0,  ii00  found the dynamics of Lt, one can now derive the (3.6) tt Discrete Difference Equation (DDE) of GTP. UvRRmin, tii ii00tT0,   

1Note that the losses LLL as: DUDUt t t t where, Ri  1,1 noting that the more general case of

R ,     i   results in R , but is not considered further DUDUt t   t  t  1 LLLDU    tt. (3.1) DUDUt t2 t t in this study. Substituting (3.6) into (3.4) gives:

186 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

vv At this stage, two key Lemmas are noted, the proof EEvtDDUUttttt0  11   22 of which is left to the interested reader to derive: 2 v  tt Et max RR 0  tT0,  ii00ii  2  tt tt  XXii    0. (3.8) max RR (3.7) ii00  tT0,  ii00ii  2 tt RRmin ii00iitT0,    tt minmax. XXii    (3.9) tt tT0,  tT0,  RRmin.  ii00 ii00iitT0,   

R s u p Rs  st0, 

Dt

T

Rt

Ut

inf Rs  st0, 

(a)

R sup Rs  st0,1 

Dt+1

T

Rt+1

Ut+1

inf Rs  st0,1 

(b)

Fig. 5: Drawdown and Drawup of an Example 1-Dimensional Discrete Random Walk; For simplicity, the winning trades have not been depicted here, which grow linearly over time. It is also noted again that the losses grow via the Triangular number nn 1 sequence Tn = . Dt = sup ((R(s))-R(t), Ut = R(t)- inf ((R(s)). (a). At T = t = 18, Dt = 5, Ut = 3. E0 = 0, Wt = 18, Lt = 2 st0,  st0,  1 1 1 (5[5+1]) + (3[3+1]) = 21, Pt = -3, Et = 0; (b). At T = t +1 = 19, Dt+1 = 4, Ut+1 = 4. E0 = 0, Wt+1 = 19, Lt+1 = (4[4+1])+ 2 2 2 1 (4[4+1]) = 20, Pt+1 = -1, Et+1 = 0 2

187 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

100

t

L 50 10 0 0 5 2 Ut 4 6 8 Dt 10 0

Fig. 6: Drawdown and drawup extremes in BGC stochastic processes the greatest total loss Lt occurs when one has the greatest possible Dt and Ut. For the values shown in this surface, this occurs at Dt = 10 and Ut = 10

Substituting (3.8) and (3.9) into (3.7) gives: key discrete characteristics of GTP. Before progressing this, recall Doob’s Martingale Inequality as it will help 2 v  tt simplify our subsequent continuous time version of (3.3). EEvt max RR tii 0  tT0,  ii00  2  Lemma 3.3. (Doob’s Martingale Inequality) tt max RR  tT0,  ii00ii  Let X be a submartingale taking real values, either in 2 tt discrete or continuous time. That is, for all times s and t  RRmax ii00iitT0,     with s < t: tt  RiimaxtT 0,  R  ii00     XXsts |.F 2 (3.10) v  tt Evt max RR 0  tT0,  ii00ii  2  For a continuous-time submartingale, assume further 2 tt that the process is cádlág. Then, for any constant C  : RRmax  ii00iitT0,        2  t max,0X Evtv max R  T  0  tT0,  i0 i    sup.XCt  0tT C ttt 2 2max,vvRRR  tT0,  iii000 iii    Let B denote a canonical 1-Dimensional Brownian motion. Then: which completes the proof. This is further illustrated in the following footnote2, C 2 which agrees with the values in Fig. 5. As will also be supBC  exp  . t  seen in the Results section, this formula captures all the 0tT 2T

2 Remark 3.2. From Figure 5a, at t = 18 one sees that Rt = -2, Now, to contrast this discrete model by deriving a t t maxt[0,T] R = 3 and mint[0,T] R = -5. From (3.7), one continuous time Stochastic Differential Equation i0 i  i0 i  (SDE) of GTP. sees that Et = -30. From Figure 5b, at t =19 one sees that Rt = -1, maxt[0,T] = 3 and mint[0,T] = -5. From (3.7), one Derivation of BGC SDE of GTP sees that Et = -10. Notice that E0 = 0 has been set for theoretical Theorem 3.4. For a Bi-Directional Grid Constrained purposes, so as to not make the example specific to any particular Itô diffusion with a given grid width g  , value v per initial equity and that Et  0  E = 0. 

188 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197 grid width, drift t and diffusion t and Wiener process Wt between successive factors. Furthermore, one requires for the rate Rt, then the change in equity Et over time t is: dE t 0, t as trading systems seek to  Et 2 dEv  t t exponentially compound E over time and an Et = 0 vt dtR dt  suptT 0, i    i0  3 Egt  equates to ruin or bankruptcy . In fact, since our t and 2 ttt  t terms are non-constant over time, then our non- 2sup R dtR dtR dt (3.11) tT0,  iii000 iii         standard GBM is actually a form of the more 2 generalized Itô Processes. Finally, note that (3.14) does  22vvvttt vtdtdW t . not appear at first glance to be a standard GBM as it ggg  does not exhibit an explicit dWt term, even though it is implied due to the subsequent use of (3.16). Proof Substituting (3.13) into (3.14) gives:

In the corresponding continuous time framework dEvv 22 t of Fig. 4, one can see that the equity Et at any t   vt dtD DUtttt U Eggt 22 time t is comprised of the initial equity E0, plus the sum 2 v  tt of all the winning trades Wt, minus the sum of all the vt dtdtdt sup RR  tT0,  ii00tt   losing trades Lt. From (3.1), one can now derive the 2g   general formula for Et, giving: tt suptT 0, RRttdtdt    ii00   nEE0,, 00 2 v  tt nEEv1,, vE  100 RRdtdt inf  ii00tttT0,  (3.12) 2g    nEEvvEv2,23, 200 tt RRdtdt inf  ii00tttT0,    Dtttt DU11 U   t 2 n tEEvt,, vvEvP dt t t ti0022 i0 v Wt vt dtdt sup R  R dt  tT0,  i0 t   i0 t  Lt 2g vvtt  sup RRdtdt where, Dt and Ut are the drawdown and drawup of the price 22gg tT0,  ii00tt   Rt at time t. However, the markets do not trend indefinitely 2 tt and so Lt in (3.12) needs to be replaced with a stochastic RRdtdt sup ii00tttT0,    process, in this setting, a 1-Dimensional continuous   t v tt   RRdtdt sup Brownian motion Ri dt for R  ,, giving: tttT0,  i0 2g ii00  2 v tt t vt dtdtdt sup RR DsupRR dt , tT0,  ii00tt   t i t   tT0,  i0  2g (3.13) 2 t v tt URRinf dt , t itT0,  i RRttdtdt suptT 0, i0  2g ii00    2 v  t In this continuous time stochastic framework, (3.12) vt dtdt  suptT 0, Rt g    i0  (3.15) scaled down by the count of grid widths g traversed  tt becomes: 2 sup RRdtdt tT0,  ii00tt     t 2  dEt v v vt dt  D D 1  U U  1 ,  Rt dt . t t t t  (3.14) i0   Et 22 g g  where, Et = E0 at t = 0 as an initial condition. One can now formalize this continuous Brownian Note that (3.14) is essentially a non-standard motion by adopting the simplest of 1-Dimensional Itô Geometric Brownian Motion (GBM). The reason why Diffusion processes, where (3.5) expands to: this was not expressed as an Arithmetic Brownian 3 Motion (ABM) is that the equity random walk Et is The fact that there are rare cases, where one can loose more than 0, required to be modelled as products of random factors i.e., Et < 0, due to the Broker and/or Trader not closing down enough losing trades during a margin call, means that such scenarios will be and not as sums of random terms. GBM involves treated mathematically as if there is an Absorption Barrier (Kac, 1945) independently and identically distributed ratios at Et = 0 without any loss of generality.

189 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

t dEvvvt  22 2 RdtdtdWtittt R :. (3.16) ttt i0 vtdtdW t Eggg (3.19) t 

One now applies Doob’s Martingale Inequality  12dtdW  t , together with the Itô Isometry: 2 2vvtt 2v t TT2 where, 1 = vt  and 2 = , completing XdWXdt  2 , gg g 00ttt    the proof. It is worthwhile noting at this stage, setting aside the and (3.16) to simplify (3.15) into: constants v and g, that since 1 (t, t, t) and 2(t), then (3.19) is not a standard simple linear SDE and that 2  22 2 dEv  t t  there is some convolution of  t within the vt dtdt exp2exp Rt Egtt  22i0  t   deterministic component dt with the t within the t 2  random component dWt. This means that one would  R dt i0 t  expect to see some relatively complex interactions from    (3.17) 2 the underlying distribution samples. For example, vv222 vt dtdtdW expexp  negative t values becoming positive due to ,   ttt  gtgt22 skewing the results towards Et  0 due to the negative v 2 2 22 sign before , which supports to a certain extent why  ttttttdtdt dWdW2.  g   Et has a tendency to almost surely approach 0 over time (subject to certain drift and diffusion conditions set out It is well known (Øksendal, 1995; Shreve, 2004) that in the Results section). 2 in the limit dt  0, the terms (dt) and dtdWt tend to zero 2 2 faster than (dWt) , which is O(dt). Setting the (dt) and Solution of SDE of GTP 2 dtdWt terms to zero, substituting dt for (dWt) (due to the quadratic variance of a Wiener process) and collecting Theorem 3.5 the dt and dWt terms, one obtains from (3.17): For a Bi-Directional Grid Constrained Brownian motion with a given grid width g, value v per grid 2 22 width, drift t, diffusion t and Wiener process Wt for dEvvt 2 vt dtdtdWexpexp ttt  Egtgt 22 the rate Rt, then the equity Et over time t has the t  solution: v 2   t dt g 22 2 2 (3.18)  222vvvvtttt 222 EEvttWexp. vvv  2 tt0  2 tt  gggg  expexp vtdt  gtgtg 22

2v2 t Proof exp.dWt gt2 Recall that (3.18) is a GBM whose well known (Øksendal, 1995; Shreve, 2004) general solution is of However, most SDEs, especially nonlinear SDEs, do the form: not have analytical solutions and so one has to resort to numerical approximation schemes in order to simulate 2 t t t sample paths of solutions to the given equation. Also dln S s ds  dW 0 s  0 s  0 s s v 2 note that the term   , is constant over dt and dWt (3.20) g 2  t lnSt  ln S0   t  t  t W t and is eclipsed (become less significant) by the variable 2 terms over time. This together with the observation that:

2 2 S  2 exp lntt exp  tW    t t t lim exp 1, S0 2 t 2t    (3.21)  2 S Sexp t t  W . t0  t t t 2 simplifies (3.18) to: 

190 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

222 One is now in a position to solve the Bi-Directional t  222vvvv dEvttWln  tttt Grid Constrained SDE (3.19) by substituting  and  . 0  st  2 1 2  gggg However, due to the t term in 1, one needs to do the  222vvvv222422 substitution into (3.20) rather than in (3.21) and also tttt lnlnEEvttWtt  0   2242 make use of a change of variable s:  gggg

Evvvv  222 222 ttt ttttt 1 2 explnexp vttW   2 t dEdsdWln  ss 122 Egggg 000 2 0  2 222 2  222vvvvtttt tt2122vvvv EEexp,vttW ssss t 0  2 t vsdsdW s gggg 00gggg 2   (3.22) 222 tttt 22vvv vs dsdsdsds sss which completes the proof. 0000 ggg 2

2v t Mean and Variance of SDE of GTP  s dW . g 0 s It is worthwhile noting that the interrelationship between drift and diffusion will determine Et, as By integrating, one obtains: shown in Fig. 7.

R

T

 = 2, T = 2, W = 2, L = 3, P = -1, E = 0

(a)

R

T

 = 2, T = 10, W = 14, L = 11, P = 3, E = 3

(b)

Fig. 7: Expected Value and Variance for Rate Random Walk Rt and Bi-Directional Grid Trading Equity Et for a  (a).  is reached in the quickest time and corresponding Profit is the lowest. (b).  is reached over a longer time and the corresponding Profit is not as low

191 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

One can now elaborate this further by deriving the Note that this preserves the known property that   the variance of GBM starts at 0 and then grows expected value Et and variance Et : exponentially. This means that the swings up and EEtW  exp down become larger and larger over time and further tt012   supports why grid trading systems can suddenly lead EtWexpexp  to ruin or bankruptcy. 012    t  22vvv 222 Evttexp ttt (3.23) 0 2 Results and Discussion ggg Having derived both a DDE model and a SDE model 2v  exp. t W for the GTP, one can now revert to the numerical s g methods of Monte Carlo Simulation and Brute Force Combinatorial Enumeration to complement the derived Now let X N (0,1) and a  in the following theoretical framework. generalized Gaussian expectation: Simulation of BGC DDE of GTP

112 expaX   exp  x exp ax dx The simulation of the discrete model is shown in  2 2  Fig. 8. 1 12 1 2 exp  x  a  a From Fig. 8, one sees that Rt trending for too long in  2 22 one direction leads to large losses in Et, whereas Rt range 12  1  1 2  bound (non-trending) leads to large gains in Et. This expa  exp   x  a  22 2   further highlights the sensitivity of Et to small changes in

1 2 Rt. The key benefit of the discrete model is that fund  expa , 2 managers and investors alike can anticipate the growth and decline in Et in relation to the underlying Rt by 112 monitoring Dt and Ut and take then various money because xxa exp  is the density of a 2 2 management measures and strategies to maximize Et. N a,1 distribution. Hence: To further help visualize the DDE theorem of the GTP, one can now simulate the discrete distribution for 2 21vvv 22 22 Rt for t  [0, 20] using brute force combinatorial ttt  20 expexpexp. Wt 2 enumeration. Since R 1,1 , there are 2 = ggg 2 i     1,048,576 possible paths to simulate. To expand this Now (3.23) can be expanded: over a greater time period would not reveal any possible additional ‘hidden’ distribution properties and so the  222vvvv 22 22 2 comprehensive distribution is shown in Fig. 9. EEvttexpexp tttt t 0 22 Figure 9 shows the typical distribution of a standard  gggg (3.24) diffusion process for a discrete random walk, albeit over 222vvvv 22 22 2 Evttexp. tttt a binomial lattice model, hence the ‘holes’ on the 0 22 gggg surface. It is understood that as the lattice mesh width becomes infinitesimally smaller, then this distribution By using the exact same approach, one also finds that approaches the Gaussian distribution and that these the variance of Et, i.e., Et  is derived as follows, ‘holes’ disappear. By implementing (3.7), one is able to Fig. 10, the noting our definitions of 1 and 2: constraining impact of the Bi-Directional Grid 2 Constraining on Et from the underlying Rt distribution. Et   E0exp 2  1 t exp  2 t  1  Figure 10 shows that as time increases, there are 2 2 2 2 22vt v  t v  t many more profitable trades that occur, resulting in a E0 exp 2 vt    t g g g 2 greater accumulation of positive profit Pt   . What is 2 not so apparent is that there are numerous smaller 2v expt t 1 occurrences of very negative profits P  that can, at g t   times, outweigh the positive profits and lead to ruin. 4v 2 v 2 4 v 2  2   4 v 2  2  2vtt t t  t  t  t 22    Also note that these ruin events accumulate in smaller E2 eg gg  e   1. 0  parallel distributions alongside the main positive  distribution density.

192 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

4 4 R(t) R(t) -R(t) -R(t) 2 2

0 0

Amount ($) Amount

($) Amount -2 -2

-4 -4 5 10 15 20 5 10 15 20 Time (t) Time (t)

(a). Scenario 1 (d). Scenario 2

Rt, -Rt

10 10 0

0 -10

-20 -10 [R(t)]2 [R(t)]2  Amount ($) Amount  [Sup(R(t))] 2 ($) Amount -30 [max(R(t))] 2 Sup(R(t)) max(R(t)) -20 -[R(t)]2 -40 -[R(t)]2 -[Sup(R(t))]2+2Sup(R(t))R(t)-[R(t)]2 -[max(R(t))]2+2max(R(t))R(t)-[R(t)]2 -50 5 10 15 20 5 10 15 20 Time (t) Time (t)

(b). Scenario 1 (e). Scenario 2

(sup[B(t)])2, [B(t)]2, -(sup[B(t)])2 +2B(t)sup[B(t)]-[B(t)]2

20 R(t) R(t) 15 E(t) 0 E(t)

10

5 -10

0 -20

Amount ($) Amount -5 ($) Amount

-10 -30 -15 5 10 15 20 5 10 15 20 Time (t) Time (t)

(c). Scenario 1 (f). Scenario 2

B(t), E(t)

Fig. 8: Simulations of Discrete Difference Equation (DDE) of GTP; (a). shows Rt and -Rt, which drives (b). containing the underlying components that constrain Et in (c). Scenario 2: (d). shows a different Rt and -Rt, which drives (e). containing the underlying components that constrain Et in (f). Notice that the model for Et is sensitive to the underlying Rt volatility changes captured by Dt and Ut

193 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

1,200,000

1,000,000

800,000 F 600,000 400,000 200,000 0 2 4 6 8 T 10 12 14

16

18

20

0 1 2 3 4 5 6 7 8 9

9 8 7 6 5 4 3 2 1

------

10 11 12 13 14 15 16 17 18 19 20

20 19 18 17 16 15 14 13 12 11 10

------R

Fig. 9: Distribution of Rate Rt over time T Since Rt is discrete, so too is F(Rt). Notice that the distribution has ‘holes’ since the

discrete binomial lattice model does not permit certain paths reaching certain points (such as at t = 1, Rt  0 as Ri  1,1 )

1,200,000

1,000,000 800,000

600,000 F 400,000 200,000 0 2 4 6 8 10 T 12 14

16

18

20

0 1 2 3 4 5 6 7 8 9

9 8 7 6 5 4 3 2 1

------

10 11 12 13 14 15 16 17 18 19 20

20 19 18 17 16 15 14 13 12 11 10

------P

Fig. 10: Distribution of Profit Pt over time T Since Pt is discrete, so too is F(Pt). The distribution of Pt shows that grid trading provides many opportunities to achieve positive profits but fewer opportunities that result in much more severe negative profits (i.e., losses) that can lead to ruin. The distribution is also partitioned into sub-distributions or accumulation zones with certain profit paths and corresponding densities do not exist (either not at all or existing but statistically insignificant)

194 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

1,200,000

1,000,000

800,000 F

600,000 0 2 4 400,000 6 8 T 10 12 14 200,000 16 18 20 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 E

Fig. 11: Distribution of Equity Et over time T Since Et is discrete, so too is F(Et)

100 100 50 50 50

0 0 0

Rate (R)

Rate (R) -50 Rate (R) -50 -50 -100 -100 0 100 200 300 0 100 200 300 0 100 200 300 Time (t) Time (t) Time (t)

(a). Scenario 1 of Rt (c). Scenario 2 of Rt (e). Scenario 3 of Rt

1e+248 1e+30 1e-47

1e+120 1e+13

1e+56 1e-04 1e-177

Equity (E) Equity (E)

Equity (E) 1e+08 1e-21

1e-307 1e-38 1 2 5 10 20 50 100 200 1 2 5 10 20 50 100 200 1 2 5 10 20 50 100 200 Time (t) Time (t) Time (t)

(b). Scenario 1 of Et (d). Scenario 2 of Et (f). Scenario 3 of Et

Fig. 12: Simulations of Continuous SDE of GTP The simulations for Scenario 1, 2 and 3 (in (a)., (c)., (e). respectively) all look quite similar to the ‘naked eye’ and indeed have very similar values of t (namely 30, 35 and 40) whilst all other parameters (v, g, t) were kept constant. However, the sensitivity of Et to initial conditions is amplified due to the constraining nature of how Et (Rt) is a function of Rt. The variance t was the most sensitive parameter resulting from the sensitivity analysis and shows how increasing it from 30 to 40 can transition Et from (b). 100% highly profitable paths, (d). 50% profitable and 50% losing paths, (f). 100% highly losing paths

195 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

Finally, note that the equity Et acts as an absorption Funding Information barrier at Pt = 0 since Pt  0  Et = 0, as shown in Fig. 11. The first author was supported by an Australian From Fig. 11, the absorption barrier at Pt = 0 Government Research Training Program (RTP) effectively maps the distribution of R : t  (-, 0)  E t t Scholarship. = 0, increasing the accumulation at Et = 0. Figure 11 should thus be compared with Fig. 10 and further supports the fact that the GTP provides many Author’s Contributions opportunities to generate positive profits, but also Aldo Taranto: Conceptualization, methodology, provides fewer opportunities to wipe out any possible software, investigation, writing - original draft, writing - gain and indeed one’s initial capital E0. review and editing, formal analysis and visualization. Shahjahan Khan: Validation and supervision. Simulation of BGC SDE of GTP To complement these discrete results, one can Ethics simulate numerous sample paths for various parameters This article is original and contains unpublished of the continuous model in Fig. 12. material. The corresponding author confirms that all of From Fig. 12, notice that the three R scenarios all t the other authors have read and approved the manuscript look similar, however, the resulting Bi-Directional Grid and that there are no ethical issues involved. Constrained SDE of Et shows that it is sensitive to initial conditions (t moreso than t). Sensitivity analysis of v and g showed only a minor impact in comparison. References AdmiralMarkets. (2017). Forex grid trading strategy Conclusion explained. Biagini, F., Guasoni, P., & Pratelli, M. (2000). This paper has extended the previous research on Mean‐variance hedging for stochastic volatility Maximal Drawdown for Long-only trading and models. Mathematical Finance, 10(2), 109-123. investment strategies such as shares and extended the Černý, A., & Kallsen, J. (2007). On the structure of research by incorporating the Drawdown and Drawup for general mean-variance hedging strategies. The Long and Short (Bi-Directional) Grid Constrained Annals of probability, 35(4), 1479-1531. (BGC) trading and investment strategies such as Foreign Czichowsky, C., Muhle-Karbe, J., & Schachermayer, W. Exchange (FX) and other types of derivative (2012). Transaction costs, shadow prices and instruments. Both the discrete properties of random connections to duality. preprint, 1205. walks and the continuous properties of Itô diffusion Davis, M. H., & Norman, A. R. (1990). Portfolio (collectively stochastic processes) were examined as selection with transaction costs. Mathematics of they traverse a BGC binomial lattice model. Novel operations research, 15(4), 676-713. theorems for a Discrete Difference Equation (DDE) and Duffie, D., & Richardson, H. R. (1991). Mean-variance a continuous Stochastic Differential Equation (SDE) hedging in continuous time. The Annals of Applied model of Et were derived and proved for the Grid Probability, 1(1), 1-15. Trading Problem (GTP). Dumas, B., & Luciano, E. (1991). An exact solution This constrained environment forms a rich to a dynamic portfolio choice problem under framework to further study such stochastic processes in transactions costs. The Journal of Finance, 46(2), their own right, but can also lead to further applications 577-595. in quantitative finance, funds management, investment DuPloy, A. (2008). The expert4x, no stop, hedged, grid analysis and banking risk management. In particular, this trading system and the hedged, multi-currency, can lead to optimized risk management of hedging and forex trading system. optimized profit growth strategies. DuPloy, A. (2010). Expertgrid expert advisor user’s guide. Feller, W. (1951). The asymptotic distribution of the Acknowledgment range of sums of independent random variables. The Annals of Mathematical Statistics, 427-432. We would like to thank Prof. Martin Schweizer of Fleming, W. H., & Hernández-Hernández, D. (2003). An ETH Züurich and A/Prof. Ron Addie of University of optimal consumption model with stochastic Southern Queensland for their invaluable advice on volatility. Finance and Stochastics, 7(2), 245-262. refining this paper. We would also like to thank the Graversen, S., & Shiryaev, A. (2000). An extension of p. independent referees of this journal for their Levy’s distributional properties to the case of a endorsements and suggestions. Brownian motion with drift. Bernoulli, 6(4), 615-620.

196 Aldo Taranto and Shahjahan Khan / Journal of Mathematics and Statistics 2020, Volume 16: 182.197 DOI: 10.3844/jmssp.2020.182.197

Guasoni, P., & Muhle-Karbe, J. (2013). Portfolio choice Øksendal, B. (1995). Stochastic Differential Equations: with transaction costs: a user’s guide. In Paris- An Introduction with Applications. Springer, New Princeton Lectures on Mathematical Finance 2013 York. (pp. 169-201). Springer, Cham. Rogers, L., & Stapleton, E. (2002). Utility Haigh, M. S., & Holt, M. T. (2000). Hedging multiple maximisation with time-lagged trading. price uncertainty in international grain trade. Computational Methods in Decision-Making, American Journal of Agricultural Economics, 82(4), Economics and Finance, 249-269. 881-896. Schweizer, M. (2010). Mean–variance hedging. Harris, M. (1998). Grid hedging currency trading. Encyclopedia of quantitative finance. Hu, Y., Shi, Z., & Yor, M. (2015). The maximal Shreve, S. E. (2004). Stochastic calculus for finance II: drawdown of the Brownian meander. Electronic Continuous-time models (Vol. 11). Springer Science Communications in Probability, 20. & Business Media. Kac, M. (1945). Random walk in the presence of Stulz, R. (2013). How companies can use hedging to absorbing barriers. The Annals of Mathematical create shareholder value. Journal of Applied Statistics, 16(1), 62-67. Corporate Finance, 25(4), 21-29. King, J. (2010). ForexGridMaster v3.01 manual. Taranto, A., & Khan, S. (2020a). Bi-directional grid https://moam.info/forexgridmaster-v301-manual- absorption barrier constrained stochastic processes forexgridmastercom- with applications in finance and investment. Risk forex_59c762301723ddf980311864.html Governance and Control: Financial Markets and King, J. (2015). ForexGridMaster 5.1 advanced manual. Institutions, 10(3), 20–33. https://www.forexgridmaster.com/download/forexgr Taranto, A., & Khan, S. (2020b). Gambler’s ruin idmaster-advanced-v5-2-manual/ problem and bi-directional grid constrained Magdon-Ismail, M., Atiya, A., Pratap, A., & Abu- trading and investment strategies. Investment Mostafa, Y. (2004). On the maximum drawdown Management and Financial Innovations, 17(3), of a brownian motion. Journal of Applied 54-66. Probability, 41(1). Thomson, R. J. (2005). The pricing of liabilities in an Mitchell, C. (2018). Grid trading. Retrieved from incomplete market using dynamic mean–variance https://www.investopedia.com/terms/g/grid- hedging. Insurance: Mathematics and Economics, trading.asp 36(3), 441-455. Merton, R. (1971). Optimal consumption and portfolio Vila, J. L., & Zariphopoulou, T. (1997). Optimal rules in a continuous-time model. Journal of consumption and portfolio choice with borrowing Economic Theory, 3, 373–413. constraints. journal of economic theory, 77(2), Muhle-Karbe, J., & Liu, R. (2012). Portfolio selection 402-431. with small transaction costs and binding portfolio Work, F. S. (2018). Grid Trading Strategy. constraints. SIAM Journal on Financial https://www.valutrades.com/en/blog/how-to-trade- Mathematics, 4(1), 203-227. currency-using-a-grid-strategy Neal, D. K. (2013). Average extrema of a random walk with a negative binomial stopping time. International Journal of Pure and Applied Mathematics, 88(3), 391-405.

197