Drawdown and Drawup of Bi-Directional Grid Constrained Stochastic Processes

Corresponding Author: Aldo Taranto School of Sciences, University of Southern Queensland, Toowoomba, QLD 4350, Australia Email: Aldo.Taranto@usq.edu.au Aldo.Taranto@credience.com Abstract: The Grid Trading Problem (GTP) of mathematical finance, used in portfolio loss minimization, generalized dynamic hedging and algorithmic trading, is researched by examining the impact of the drawdown and drawup of discrete random walks and of Itô diffusions on the Bi-Directional Grid Constrained (BGC) stochastic process for profit Pt and equity Et over time. A comprehensive Discrete Difference Equation (DDE) and a continuous Stochastic Differential Equation (SDE) are derived and proved for the GTP. This allows fund managers and traders the ability to better stress test the impact of volatility to reduce risk and generate positive returns. These theorems are then simulated to complement the theoretical models with charts. Not only does this research extend a rich mathematical problem that can be further researched in its own right, but it also extends the applications into the above areas of finance.


Introduction
Grid trading involves the simultaneous going long and going short at the current price rate Rt (instantly creating a hedged position(s)) and also at fixed width g multiples above and below Rt. As the price rate propagates through 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, but also studied here as a continuous Brownian motion, then the system will close many profitable trades at the next nearest grid level whilst carrying the losing trades open. These open losing trades will eventually be either closed individually when in profit, closed as a system of losing trades when the system is back in profit, or closed as a system of losing trades if the losses grow too large. If the system is not closed in time, it can suddenly lose all or more than the initial equity E0, in which case the system is said to be ruined. This is known as the Grid Trading Problem (GTP), emerging from finance and researched here mathematically as a constrained stochastic process. 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, as shown in Fig. 1.
Let Rt = R(t) be an Itô diffusion given by: (1.1) which can be simplified for the discrete parts of this paper to: where, W(t), t  [0, T] is a standard Wiener process, m  is the drift (which effects the direction or trend) and s ,   0 is the diffusion (which effects the volatility) parameter over a standard filtered probability . This continuous formulation will be followed as much as possible and for our discrete formulations, set  = 0 and  = 1.
The drawdown Dt is defined as the difference between the maximum rate of R(s) and the current rate R(t) at time t as: and has been rigorously researched (Graversen and Shiryaev, 2000) and the references therein. This is shown diagrammatically within our discrete binomial lattice model framework in Fig. 2. 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

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 defined as the difference between the minimum rate of R(s) and the current rate R(t) at time t as: and is shown in Fig. 3.
The maximal (maximum) drawdown t D is commonly used in mathematical finance as an indicator and measure of risk for a stock that follows a particular random process is defined (Magdon-Ismail et al., 2004) as: Note that the corresponding maximal (maximum) drawup Ūt can be expressed as:

185
The relationship between the maximal drawup Ūt and the maximal drawdown t D is shown in Fig. 4. Informally, the maximal drawdown is the largest drop from a peak to a trough and the maximal drawup is the largest rise from a trough to a peak. It is identified that there is a research gap in the Maximal Drawdown literature as it has only been applied to the trading and investing of 'naked' instruments such as shares, stocks, commodities, which ultimately do not involve derivative instruments. This is where one can only profit from going long, such as watching the shares of IBM go up and down and making a profit when the price Rt rises above the initial purchase price R0. In contrast to this, the use of more sophisticated trading and investment strategies, in particular the trading of derivative instruments such as Foreign exchange (FX), Contracts For Difference (CFDs), futures, options and many more exotic combinations of these derivatives, means that one can profit from both going long and going short. Bi-Directional grid trading involves this second class of instruments and the maximal drawdown and maximal drawup interrelationship is shown in Fig. 4.
From Fig. 4, it is noted that t D does not usually equal Ūt but they can be equal in some scenarios or sample paths. This paper leverages the properties of drawdown, drawup (and the maximum of these to a lesser extent) to develop a Discrete Difference Equation (DDE) theorem and a Stochastic Differential Equation (SDE) theorem of how the GTP evolves over time, along with their corresponding proofs.

Literature Review
To the best of the authors' knowledge, there is no formal academic definition, other than our own (Taranto and Khan, 2020a;2020b), of the GTP available within all the references on the subject matter; (Mitchell, 2018;DuPloy, 2008;Harris, 1998;King, 2010;2015;AdmiralMarkets, 2017;Work, 2018). Note that these are not rigorous peer reviewed journal papers but instead informal blog posts or software user manuals. Even if there were any academic worthy results found on grid trading, there is a general reluctance for traders to publish any trading innovation that will help other traders and potentially erode their own trading edge.
Despite this, grid trading can be expressed academically as a form of Dynamic Mean-Variance Hedging (Duffie and Richardson, 1991;Černý and Kallsen, 2007). There are many reasons why a firm would undertake a hedge, ranging from minimizing the market risk exposure to one of its client's trades by trading in the opposite direction (Haigh and Holt, 2000), through to minimizing the loss on a wrong trade by correcting the new trade's direction whilst keeping the old trade still open until a more opportune time (Stulz, 2013). In the case of grid trading, it can be considered as a generalized form of hedging of multiple positions simultaneously over time, for the generation of trading profits.
Another academic framework for grid trading is the consideration of the series of open losing trades in a grid system as a portfolio of stocks in the context of Mean-Variance Potfolio Optimization problem (Schweizer, 2010;Biagini et al., 2000;Thomson, 2005). This is because a grid trading session involves a basket of winning and losing trades that can be likened to a portfolio of winning and losing shares or stocks. The Merton problem, a question about optimal portfolio selection and consumption in continuous time, is indeed ubiquitous throughout the mathematical finance literature. Since Merton's seminal paper (Merton, 1971), many variants of the original problem have been put forward and have been extensively studied to address various issues arising from economics and finance. For example, (Fleming and Hern´andez-Hern´andez, 2003) considered the case of optimal investment in the presence of stochastic volatility. Davis and Norman (1990;Dumas and Luciano, 1991) and more recently (Czichowsky et al., 2012;Guasoni and Muhle-Karbe, 2013;Muhle-Karbe and Liu, 2012) addressed optimal portfolio selection under transaction costs. Rogers and Stapleton (2002) considered optimal investment under time-lagged trading. Vila and Zariphopoulou (1997) studied optimal consumption and portfolio choice with borrowing constraints.
Turning now to the maximal drawdown of random walks, the research dates back to (Feller, 1951). One of the most comprehensive and mathematically rigorous reviews and advances in the field is due to (Magdon-Ismail et al., 2004)  . This was then extended to random walks on supercritical Galton-Watson trees (Hu et al., 2015). The formulas above are relisted into the following, as this paper is mainly interested in when there is no drift, yielding: Neal (2013) proved the formulas for the averages of the maximum height and the minimum height of a random walk attained before n downward movements occur. Finally, (Hu et al., 2015) also computed the exact value of a negative moment of the maximal drawdown of the standard Brownian motion.

Methodology
Having introduced the GTP, its profit or loss accumulation process, drawdown, drawup and the maximal of these, together with their associated literature, it is noted that in BGC trading, one needs to know the values of Dt, Ut at every point in time tT, as shown in Fig. 5.
Having analysed this is detail, one can now formulate the total losses Lt at any time 1 knowing just Dt and Ut: (3.2) has been plotted in Fig. 6 for the first 10 g  and first 10 g  grid levels, about the discrete Rt level. From Fig. 6, the Rt random walk is hence constrained by grid trading to result in the corresponding profit Pt and equity Et random walks, where the total loss Lt is greatest when the linear combination of Dt and Ut are the greatest. Having found the dynamics of Lt, one can now derive the Discrete Difference Equation (DDE) of GTP.
1 Note that the losses

Derivation of BGC DDE of GTP Theorem 3.1 For a Bi-Directional Grid Constrained random walk
Rt with a value v per grid width, then the change in equity E over time t is given by the following Discrete Difference Equation (DDE):

Proof
In this discrete time framework t   of our binomial lattice model, one can see that the equity Et at any time t is comprised of the initial equity E0, plus the sum of all the winning trades Wt, minus the sum of all the losing trades Lt, hence Et = E0 + Pt where the total profit Pt = Wt-Lt. One can now derive the general formula for Et, giving: For simplicity, one wishes to substitute Dt and Ut with a formulation that captures the underlying randomness of Rt in terms of the generalized 1-Dimensional discrete random walk, where: and:  .
At this stage, two key Lemmas are noted, the proof of which is left to the interested reader to derive:

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 Substituting (3.8) and (3.9) into (3.7) gives: which completes the proof. This is further illustrated in the following footnote 2 , which agrees with the values in Fig. 5. As will also be seen in the Results section, this formula captures all the sees that Et = -10. Notice that E0 = 0 has been set for theoretical purposes, so as to not make the example specific to any particular initial equity and that Et  0  E = 0. key discrete characteristics of GTP. Before progressing this, recall Doob's Martingale Inequality as it will help simplify our subsequent continuous time version of (3.3).

Lemma 3.3. (Doob's Martingale Inequality)
Let X be a submartingale taking real values, either in discrete or continuous time. That is, for all times s and t with s < t: |.  189 grid width, drift t and diffusion t and Wiener process Wt for the rate Rt, then the change in equity Et over time t is:

Proof
In the corresponding continuous time framework t   of Fig. 4, one can see that the equity Et at any time t is comprised of the initial equity E0, plus the sum of all the winning trades Wt, minus the sum of all the losing trades Lt. From (3.1), one can now derive the general formula for Et, giving: where, Dt and Ut are the drawdown and drawup of the price Rt at time t. However, the markets do not trend indefinitely and so Lt in (3.12) needs to be replaced with a stochastic process, in this setting, a 1-Dimensional continuous In this continuous time stochastic framework, (3.12) scaled down by the count of grid widths g traversed becomes: where, Et = E0 at t = 0 as an initial condition. Note that (3.14) is essentially a non-standard Geometric Brownian Motion (GBM). The reason why this was not expressed as an Arithmetic Brownian Motion (ABM) is that the equity random walk Et is required to be modelled as products of random factors and not as sums of random terms. GBM involves independently and identically distributed ratios between successive factors. Furthermore, one requires 0, t t dE t E     as trading systems seek to exponentially compound E over time and an Et = 0 equates to ruin or bankruptcy 3 . In fact, since our t and t terms are non-constant over time, then our nonstandard GBM is actually a form of the more generalized Itô Processes. Finally, note that (3.14) does not appear at first glance to be a standard GBM as it does not exhibit an explicit dWt term, even though it is implied due to the subsequent use of (3.16).
Substituting (3.13) into (3.14) gives: It is well known (Øksendal, 1995;Shreve, 2004) that in the limit dt  0, the terms (dt) 2 and dtdWt tend to zero faster than (dWt) 2 , which is O(dt). Setting the (dt) 2 and dtdWt terms to zero, substituting dt for (dWt) 2 (due to the quadratic variance of a Wiener process) and collecting the dt and dWt terms, one obtains from (3.17): Et has a tendency to almost surely approach 0 over time (subject to certain drift and diffusion conditions set out in the Results section).

Solution of SDE of GTP Theorem 3.5
For a Bi-Directional Grid Constrained Brownian motion with a given grid width g, value v per grid width, drift t, diffusion t and Wiener process Wt for the rate Rt, then the equity Et over time t has the solution:

Mean and Variance of SDE of GTP
It is worthwhile noting that the interrelationship between drift and diffusion will determine Et, as shown in Fig. 7.
Now let X N (0,1) and  1. Note that this preserves the known property that the variance of GBM starts at 0 and then grows exponentially. This means that the swings up and down become larger and larger over time and further supports why grid trading systems can suddenly lead to ruin or bankruptcy.

Results and Discussion
Having derived both a DDE model and a SDE model for the GTP, one can now revert to the numerical methods of Monte Carlo Simulation and Brute Force Combinatorial Enumeration to complement the derived theoretical framework.

Simulation of BGC DDE of GTP
The simulation of the discrete model is shown in Fig. 8.
From Fig. 8, one sees that Rt trending for too long in one direction leads to large losses in Et, whereas Rt range bound (non-trending) leads to large gains in Et. This further highlights the sensitivity of Et to small changes in

Rt.
The key benefit of the discrete model is that fund managers and investors alike can anticipate the growth and decline in Et in relation to the underlying Rt by monitoring Dt and Ut and take then various money management measures and strategies to maximize Et.
To further help visualize the DDE theorem of the GTP, one can now simulate the discrete distribution for Rt for t  [0, 20] using brute force combinatorial enumeration. Since   1,1 i  R , there are 2 20 = 1,048,576 possible paths to simulate. To expand this over a greater time period would not reveal any possible additional 'hidden' distribution properties and so the comprehensive distribution is shown in Fig. 9. Figure 9 shows the typical distribution of a standard diffusion process for a discrete random walk, albeit over a binomial lattice model, hence the 'holes' on the surface. It is understood that as the lattice mesh width becomes infinitesimally smaller, then this distribution approaches the Gaussian distribution and that these 'holes' disappear.
By implementing (3.7), one is able to Fig. 10, the constraining impact of the Bi-Directional Grid Constraining on Et from the underlying Rt distribution. Figure 10 shows that as time increases, there are many more profitable trades that occur, resulting in a greater accumulation of positive profit t P   . What is not so apparent is that there are numerous smaller occurrences of very negative profits t P   that can, at times, outweigh the positive profits and lead to ruin. Also note that these ruin events accumulate in smaller parallel distributions alongside the main positive distribution density.  . 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)  -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18   196 Finally, note that the equity Et acts as an absorption barrier at Pt = 0 since Pt  0  Et = 0, as shown in Fig. 11. From Fig. 11, the absorption barrier at Pt = 0 effectively maps the distribution of Rt: t  (-, 0)  Et = 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 opportunities to generate positive profits, but also provides fewer opportunities to wipe out any possible gain and indeed one's initial capital E0.

Simulation of BGC SDE of GTP
To complement these discrete results, one can simulate numerous sample paths for various parameters of the continuous model in Fig. 12.
From Fig. 12, notice that the three Rt scenarios all look similar, however, the resulting Bi-Directional Grid 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.

Conclusion
This paper has extended the previous research on Maximal Drawdown for Long-only trading and investment strategies such as shares and extended the research by incorporating the Drawdown and Drawup for Long and Short (Bi-Directional) Grid Constrained (BGC) trading and investment strategies such as Foreign Exchange (FX) and other types of derivative instruments. Both the discrete properties of random walks and the continuous properties of Itô diffusion (collectively stochastic processes) were examined as they traverse a BGC binomial lattice model. Novel theorems for a Discrete Difference Equation (DDE) and a continuous Stochastic Differential Equation (SDE) model of Et were derived and proved for the Grid Trading Problem (GTP).
This constrained environment forms a rich framework to further study such stochastic processes in their own right, but can also lead to further applications in quantitative finance, funds management, investment analysis and banking risk management. In particular, this can lead to optimized risk management of hedging and optimized profit growth strategies.