“Gambler’s ruin problem and bi-directional grid constrained trading and investment strategies”

Bi-Directional Grid Constrained (BGC) trading strategies have never been studied academically until now, are relatively new in the world of financial markets and have the ability to out-perform many other trading algorithms in the short term but will almost surely ruin an investment account in the long term. Whilst the Gambler’s Ruin Problem (GRP) is based on martingales and the established probability theory proves that the GRP is a doomed strategy, this research details how the semimartingale framework is required to solve the grid trading problem (GTP), i.e. a form of BGC financial markets strategies, and how it can deliver greater return on investment (ROI) for the same level of risk. A novel theorem of GTP is derived, proving that grid trading, whilst still subject to the risk of ruin, has the ability to generate significantly more profitable returns in the short term. This is also supported by extensive simulation and distribu- tional analysis. These results not only can be studied within mathematics and statistics in their own right, but also have applications into finance such as multivariate dynamic hedging, investment funds, trading, portfolio risk optimization and algorithmic loss recovery. In today’s uncertain and volatile times, investment returns are between 2%- 5% per annum, barely keeping up with inflation, putting people’s retirement at risk. BGC and GTP are thus a rich source of innovation potential for improved trading and investing. these and many other strategies is the so-called (Bi-Directional) grid trading strategy (or grid trading for short) that can start to generate large profits quickly, but can also lead to sudden ruin, a problem which is referred to as GTP. However, to dismiss grid trading as a doomed GRP strategy with no benefit would be a gross over-simplification of the resulting stochastic system. A novel theorem and resulting methodology are developed to estimate and quantify this risk of ruin for grid trading systems, which are related to hedging and portfolio optimization. This paper shows that GTP is more complex and yet more profitable than GRP. The defined formally in the involves one of popular the so-called Martingale (not to be confused with of from ca-©


INTRODUCTION
There are numerous tales and claims from gamblers (or traders) with an "infallible" strategy that will beat the house (or market) and guarantee riches. However, one rarely sees long-term independently audited evidence of these people making positive net profits from the strategy itself but instead from examples such as selling copies of their books or courses. One trading strategy that is entirely different to these and many other strategies is the so-called (Bi-Directional) grid trading strategy (or grid trading for short) that can start to generate large profits quickly, but can also lead to sudden ruin, a problem which is referred to as GTP. However, to dismiss grid trading as a doomed GRP strategy with no benefit would be a gross over-simplification of the resulting stochastic system. A novel theorem and resulting methodology are developed to estimate and quantify this risk of ruin for grid trading systems, which are related to hedging and portfolio optimization. This paper shows that GTP is more complex and yet more profitable than GRP.
The GRP, defined formally in the Literature Review section, involves one of the most popular betting strategies, the so-called Martingale Strategy (not to be confused with Martingales of Probability Theory). In its simplest form, this involves the gambler winning $1 from the ca-sino if a coin is facing up (U) and loses $1 if the coin is facing down (D). When the gambler is faced with one or more consecutive losing moves, they double their bet, 2 n as shown in Figure 1.
It is clear that such a strategy would eventually work if a fair coin was involved as sooner or later, one's coin side would come up, depending on the size of one's bankroll and the casino's betting limits, otherwise ruin is inevitable.
The GTP, on the other hand, in its simplest form, involves the simultaneous placement of long and short orders at equally spaced horizontal grid levels. Trades are closed at the next nearest grid level when they are in profit. This means that no matter where the market price moves to, it will trigger two new trades that form a hedge, close down a previous trade now in profit, and carry its losing trades(s) as shown in Figures 2 and 9.
Given that financial markets are range bound (horizontally) most of the time, around 70%-80% of the time (Pukthuanthong-Le, Levich, & Thomas, 2007 and the references within), then grid trading will work most of the time. Periods of an initial trend that reverts back to the mean (i.e. exhibiting mean reversion) also plays to the strengths of grid trading, as it can also be considered as a form of ranging (albeit on a diagonal range).
Grid trading is referred to as GTP because its weaknesses are revealed when markets have explosive strong trends, in which the losing trades grow faster than the winning trades and can lead to ruin if some of the trades are not closed down in time. Likewise, momentum strategies take advantage of how a trend tends to 'run out of steam' towards the end of its run. Whilst the start and end of a trend cannot be predicted consistently over time, GTP can benefit from momentum indicators as an early warning sign as to when a trend is about to end and therefore serves as a trigger to commence grid trading.

LITERATURE REVIEW
To the best of the authors' knowledge, there are only informal definitions of grid trading available within all the references on the subject matter (DuPloy, 2008(DuPloy, , 2010Harris, 1998;King, 2010King, , 2015Admiral Markets, 2017;ForexStrategiesWork.com, 2018). These are not rigorous academic 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. 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. The Merton problem -a question about optimal portfolio selection and consumption in continuous time -is indeed ubiquitous throughout the mathematical finance, economics and econometric literature. Since Merton's seminal paper in 1971 (Merton, 1971), many variants of the original problem have been put forward and extensively studied to address various issues arising from economics. For example, Fleming and Hernández Hernández (2003) considered the case of optimal investment in the presence of stochastic volatility. This paper examines the concept that certain losing trades should be closed at certain points in time to optionally grow the portfolio (Davis, Norman, 1990;Dumas & Luciano, 1991), and more recently Guasoni and Muhle-Karbe (2012) and 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.
Having reviewed the literature on the GTP and noting that GRP is a reasonable (albeit naive) base case for GTP, the literature for GRP are now reviewed. Originating from correspondence of Pascal and Fermat in 1656 (Edwards, 1983), the GRP regards the game of two players engaging in a series of independent and identical bets up until one of them goes bankrupt, i.e. ruined.
The general gambler's ruin formula, which regards the chances of each player winning, was shown by Abraham De Moivre (1712). A derivation of this formula may be found in Feller (1968). Different formulae for this were obtained afterward by Montmort, Nicolaus Bernoulli, as well as Joseph-Louis Lagrange. Many 1-Dimensional generalizations of the GRP have also been researched. For example, Lefebvre (2008) studied the case of some specific sequences, later this was extended to any sequences in El-Shehawey (2009). Variations of classical problem with ties allowed were considered in, for example, Lengyel (2009aLengyel ( , 2009b. Some of the articles studied both the ruin probability and duration of the game, whereas most papers studied only duration of the game. Some generalizations to a higher dimension were studied in Rocha and Stern (2004), Kmet and Petkovssek (2002). In the GTP context, Player A (or gambler) is the Trader, and Player B (or casino) is the Brokerage firm.
It is even more clear that the gambler is more likely to win in the long term if the coin is biased towards their chosen coin side. However, since the gambler does not have access to infinite capital and that the casino has a betting limit, ruin is almost surely inevitable (De Moivre, 1712; Shoesmith, 1986). It is an example of what has recently become known as the Taleb Distribution (Wolf, 2008), i.e. a strategy that appears to be lowrisk in the short term, bringing in small profits, but which will periodically experience extreme losses. When one does encounter a series of losses, doubling the bet each time, one's final bet will be far greater than the small wins one would obtain when the system works in one's favor.

METHODS
The Binomial Lattice Model (BLM) will now be formalized as a basis for GRP ( Figure 1) and GTP ( Figure 2). Without any loss in generality, only discrete one-dimensional simple random walks (SRW) on the lattice are used, as illustrated in Figure 1.
The reader interested in the proof of this theorem is invited to read the above reference or any of the many proofs available on GRP. Essentially, it consists of equating all of Player A's moves against Player B's moves in terms of the Up and Down probabilities.
To examine this in further detail, (1) has been plotted in Figure 3 for various values of ( )  sino (or brokerage firm). Even if a multi Billionaire (in USD) Trader wants to trade with a Brokerage with a net capital of $200 Million (USD), the Billionaire will only be allowed to trade the maximum lot size, which is numerous multiples less than what the brokerage can support without going bankrupt, even though in rare cases, broker bankruptcy is possible and/or inevitable (Ahmed, 2017). It is thus assumed without any loss of generality that the trader has finite funds and that the broker has infinite funds. The impossibility of the gambler winning over the long run is certain, given a limit of the size of bets or a limit in the size of one's bankroll or the unavailability of a line of credit (Mitzenmacher & Upfal, 2005).

Grid Trading Problem (GTP) methodology
GTP involves the linear increase in profitable trades over time and the triangular number growth sequence in losing trades as and when each further grid level is reached (see Figure 2). We are interested in deriving the Probability of the trader winning the GTP. We are now in a position to postulate the corresponding theorem for GTP.

Theorem 2. Grid Trading Problem (GTP).
A grid Trader A and a Broker B have a total of n coins between them. Trader A starts with i-coins, 1 ≤ i ≤ n-1, and makes a series of independent 1 coin bets each having probability P of winning φ coins and Q of losing φ coins. Let Q = 1 -P. The trading game ends when Trader A loses all of their coins or when their goal of winning n coins is reached. The objective is to determine A's ruin probability, that is, the chance of reaching state 0 assuming Trader A begins with i coins.
The proof of this theorem is beyond the scope of this journal, but essentially involves noticing from Figure 2 that GTP losses accumulate via the triangular number series. No matter whether the strong trend is bullish or bearish, substituting the triangular number series allows the GRP theorem to be adapted to the GTP theorem. x are graphed in Figure 4. Figure 4 shows that as the trader reaches further and further grid levels, the probability of winning the trading game suddenly decays to zero, resulting in ruin. The sudden risk of ruin is mainly due to the triangular number series accumulation of losses with each further grid level reached, and so occurs later, since one can afford to keep trad-ing to further grid levels, the more equity one has. Hence, Figure 4 is only to be used as a base or reference case for what would happen at further grid levels.
however, the use of limits is required to show this as , x →∞ which can easily be verified.
This was further illustrated in Figure 9 in the results.

RESULTS
Having taken a theoretical approach in the above Methodology section, this study intends to complement this with results from an algorithmic Monte Carlo simulation approach.

GRP simulations
The GRP was implemented in the R programming language with two simulations shown in Figure 5.  Note: For the same starting balance of $10,000 and the same number of 1,000 tosses, GRP can produce a spectrum of results, ranging from an ROI of +600% in (a), to an ROI of -100% in (b).   Figure 6 to further analyze the nature of the average path amongst multiple paths (in bold red), together with the resulting distribution. Figure 6 and Figure 5 show that GRP results in a high frequency of linear balance growth paths that decay to zero (ruin), as per the distribution peak at Balance = 0. Whilst the average of these paths (shown in bold red in Figure 6(a)) also grows linear-ly, there are many paths that suddenly result in ruin or near ruin. For the near ruin cases, there is enough capital remaining for the balance to sometimes recover back to the initial balance and go on to make significant returns.

GTP simulations
The GTP Theorem 2 was also implemented in the R programming language with two simulations shown in Figure 7.
From Figure 7, both simulations begin with the same $10,000 starting balance as in GRP, but both (a) and (b) grow much higher than is typical for the GRP.  is overlaid with the density of GRP, showing that GTP has most of its simulations around the initial deposit amount, whereas GRP has most of its simulations around the 0 (ruin).
To further illustrate the financial growth potential of BGC strategies and GTP, they were coded into the popular MetaTrader 4.0 (MT4) trading platform, and a simulation was run on the EUR/USD currency pair over a one-year timeframe, as shown in Figure 9. This shows how BGC strategies work over time and how they can weather the volatility shocks over a reasonably significant period of time.
The other significant and original contribution of the results is that not only has GTP's superiority been proven via theorems, but is now shown heuristically via the simulations that grid trading is not a doomed GRP strategy, and that it is a rich baseline to be of real value to investment firms and traders alike. By adding some refinements to the strategy, such as researching when to optimally close out losing trades, the strategy can become even more profitable without increasing the risk.

DISCUSSION
There are many reasons why grid trading is far more complex and profitable than the GRP.
1. The GRP involves a martingale framework of fair coin flips, where each outcome has a probability of 1/2. In financial markets such as Foreign Exchange (FX) trade transactions, the more general semimartingale framework is required for GTP as each outcome (U = Up, D = Down) does not have a probability of 1/2 and also because this probability changes over time, due to numerous economic and financial drivers such as gross domestic product (GDP), quantitative easing (QA) and unemployment rates.
2. GRP involves doubling each wrong bet until the next outcome is in one's favor, where losses double at a rate of 2 n in which n is the count of wrong bets in a losing streak. To contrast this, GTP experiencing a long trend with little volatility grows at the significantly slower Triangular number series n(n+1)/2 rate and hence has a slower risk progression.
3. Unlike in GRP, in FX markets, central banks and regulators will enact monetary policy, which equates to trends having a bias to either last longer or shorter than what would be expected from a random (martingale) framework.
4. The supply and demand dynamics formed by the buying and selling of financial assets by traders means that as a trend emerges, more traders are likely to buy (or sell) into the up (or down) trend respectively. Consequently, the trend is likely to continue for a longer period of time. Eventually, the traders will start to sell (or buy) respectively to exit their positions either to take profit and get out and/or because they think that the trend has run out of momentum or that the trend has ended. Traders that entered too late in the trend will sell (or buy) respectively to minimize their losses, and this forces the price rate to adjust to a new equilibrium point.

GTP involves something not available in the GRP:
a. the ability to close down some or all trades when the system is in profit, and then start the grid system again, forming a favorable positive cash-flow cycle; b. closing down one or a small number of losing trade(s) at any time to minimize the risk that some trade(s) become too big; c. adjusting one's trading volume or trade size to 'scale in' or 'scale out' of a trade so that effectively one can increase (or decrease) one's profit without increasing one's risk any further over time.
The results not only support the theorem that GTP can be very profitable, they also provide practical applications, such as simulating when GTP is starting to get too risky, so that the system can be shut down in profit, or various trades can be closed to more likely avoid ruin. Such an 'early warning' simulation system can give portfolio managers and quants a way of simulating fewer discrete scenarios, whereas other strategies simply have too many continuous parameter combinations to be able to be of practical use.
http://dx.doi.org/10.21511/imfi.17 (3).2020.05 Note: As the system is closed down at the end, then all losing trades cause the exponentially growing balance to become reduced to where the equity. This is in {\it now way} a ruin event but instead shows a CAGR of 52%.