- Two players (SB and BB)
- SB posts and BB
- SB acts first and is forced to go allin or fold
- BB can call or fold when facing an allin

This game has practical use in short-stack blind-war spots, which often occur in tournaments. The solution of this game cannot be considered the solution of the real spot, though. Forcing the small blind to play push or fold leaves out of the analysis other lines such as limping or raising, and their postflop play involved, which might lead to balanced lines with higher expected value. However, the push/fold approach is a good approximation, especially with very short stacks.

A key concept we must handle before solving the game is *maximally exploitative strategy* (MES). Suppose you know exactly how your opponent plays; this means you know the frequency of each action he will take with every single hand. With such information, you can compute the equity of your legal actions and select the most valued one. Let us illustrate this process with a toy example where both players play with an effective stack of and are dealt only with , , .

The player in the SB knows that the player in the BB calls with , and folds with . We know that the reward when he folds is , as he loses the small blind posted to play the hand; the reward when he pushes and the BB folds is , as he wins the big blind the opponent posted to play the hand; the reward when he pushes and gets called is the expected value (EV) of his hand against the range of hands he gets called. What is the MES with ?

We know by enumerating the outcome in all the combinations of boards that wins 59.13%, ties 0.19% and loses 40.49% when facing , yielding an EV of . Hence:

Pushing is more profitable than folding, so our MES pushes that hand all the time. Repeating this process for the remaining two hands, we get for , and for . Therefore, our MES against that opponent’s strategy consists in pushing and , and folding . Notice that MESs are always pure strategies (i.e., always performing the same action in a certain spot).

How do we find the optimal play? There are several methods that find Nash equilibria. The one chosen for this work is called *Fictitious play* (George W. Brown, 1951). The learning process of this method begins with any arbitrary strategy for each player. Then, it performs an iterative process where each step consists in finding the pure maximally exploitative strategy against the opponent’s strategy and mixing it with its current strategy. Several mixing functions can be used, but only the harmonic series has been proven to converge.

```
sb = init_strategy(random)
bb = init_strategy(random)
n = 2
do
sb_max = maximally_exploitative(bb)
sb_max = maximally_exploitative(sb)
weigth = 1 / n
sb = (1 - weight) * sb + weight * sb_max
bb = (1 - weight) * bb + weight * bb_max
n = n + 1
until(convergence_criterion)
```

Each iteration yields a -potentially- mixed strategy. The process finishes once a pre-established convergence criterion is met. The charts below depict the optimal play for both the SB and the BB when playing stacks up to . This kind of chart shows all starting hands grouped into offsuited and suited. Hands over the major diagonal are suited whereas hands below are offsuited. The chart for the SB specifies the largest stack each hand must be pushed with; the chart for the BB the largest stack each hand must be called with.

For instance, suppose we are in the SB dealt with and the effective stack is . What should be our move? Our hand is offsuited, so we should look at the row and column under the major diagonal that matches our hand: the cell placed at column *J* and row *6* rules that we should fold as this hand must be pushed only when the effective stack is lower than .

Similarly, if we are in the BB and dealt with the same hand, we should call as long as the effective stack is under .

The actual optimal play is not as simple as a unique threshold for each hand; things are a bit more complex. However, the solution presented in these charts makes it easily readable for humans and therefore of practical use.

A key property of algorithms that finds out Nash equilibria is convergence speed. The more complex the game the more computations are required. This is a game easy to solve, but convergence speed becomes a major concern on more complex games, such as real poker, where the remaining preflop lines and their postflop game involved are considered. By way of illustration, I have plotted the convergence dynamics of fictitious play while building the optimal strategy for the SB and the BB playing with an effective stack of . A few thousand iterations are enough for most hands to converge.

I have released three applications:

**Equity builder**: The core of this app is a hand evaluator. It generates the preflop equity of any hand versus any hand.**Heads-up push fold solver**: Finds the Nash equilibrium of the heads-up push/fold game by applying fictitious play. It leverages the precomputed equity written by Equity builder to speed up the computations.**Plotter**: Plots the push and call charts and the convergence dynamics.

*Equity builder* and *Heads-up push fold solver* were written in C for performance purposes, and *Plotter* was written in Python. They are available for download at my GitHub optimal play repository

Stock indices exhibit trending behaviours in any timeframe, and a trend following strategy tries to capture those trending movements as much as possible. The asset selected for this study is the Spanish IBEX-35 index, in the timeframe M1, which provides a large number of trading signals making it possible to reach statistical significance.

Crossovers mostly occur once a trending movement has unfolded a not negligible stretch. Thus, it seems expectable that being able to get the trading signal before the crossover actually occurs would capture, on average, a greater portion of the movement, therefore increasing the strategy expectation. This was confirmed by a simulation which yielded the following results:The blue line depicts the baseline, which is the gross cumulative return of the crossover strategy over the whole data sample. If we were able to correctly predict 100% of the crossovers just one sample before it occurs, the expectation of the strategy increases an astonishing 100% (orange line). Earlier predictions (green and red lines) yield higher expectation, but this also makes the prediction much harder. All the results presented hereinafter are based on predictions at distance 1.

The proposal is to predict crossovers based on the previous behaviour of the moving averages. In this study, moving averages, of periods and at the sample , are defined based solely on the closing price as follows:

The number of previous moving average values becomes a hyperparameter of the estimator. We call it delay (). Notice that it actually turns out in predicting whether the price of the next sample will be higher or lower than a threshold (i.e. the price that makes ). Given the previous definitions, and solving for , this threshold is:

Raw data to work with are the historical quotes of the asset analyzed. Each sample includes the following fields:

The first step is computing the and for each sample from the raw data. Then, it is key to extract relative price movements from the absolute values of computed moving averages in order to **properly reflect price behaviour**. That is:

where

Since we want to reveal the moving average behaviour with respect to each other, each single value is first scaled within the range of each estimator sample, and then feature reduction is applied by substracting each pair:

This transformation also ensures every single estimator input is within the range .

Finally, because this problem suffers from **class imbalance** (just 5.65% of the total samples are crossovers, and they are the key class), the estimators build biased models. Given the huge dataset available, larger than 2.2M samples, among the repertory of techniques to deal with this issue, **undersampling** was applied by removing ∼90% randomly selected non-crossovers samples.

Two different estimators were evaluated: multilayer perceptron (MLP) and support vector machine (SVM) with the following setup:

- Binary classificator
- Prediction distance: 1
- Delay: 5
- Training period: [00/02, 12/06]: 239,910 samples (70%)
- Test period: [12/07, 17/12]: 101,961 samples (30%)

Due to the nature of this problem, *hits* are defined as those predicted crossovers that actually were, and *misses* as those predicted crossovers that actually were not. That is, we neither include non-crossovers correctly predicted as hits nor crossovers that were not predicted as misses. Both estimators, MLP and SVM, performed really similarly, reaching hit rates of [0.88, 0.89] and almost equalling the number of actual crossovers in their inferences.

Hit rate is a valuable metric, but, in order to evaluate the prediction model, **it is essential to verify how predictions translate into expectation**. The following chart shows the cumulative return along the training period normalized to the maximum reached in the baseline case (no prediction).An ideal prediction in this subset would increase the cumulative return by a factor of 1.90. Both estimators, MLP and SVM, outperform the baseline by 1.55.In the test subset, an ideal prediction would increase cumulative return by 2.37, whereas MLP does by 1.89, and SVM by 1.95. In summary, the prediction model is able to perform ∼61% the oracle in the training subset and ∼82% in the test subset.

The results presented so far were obtained with the classifier threshold set to 0.5. Keeping in mind that the objetive is to enhance a trading strategy, does it make sense to move that threshold? We can face different scenarios when aiming to improve such strategy depending on how our baseline strategy performs. If it is already a winner, then we should explore tradeoffs between expectation and volume of signals generated. On the contrary, if it is not even able to overcome the operational costs, increasing expectation becomes mandatory.

According to the results, the prediction model still has room for improvement as it performs ∼30% under the oracle. It seems expectable that selecting a more restrictive classifier threshold would yield higher accuracy, and therefore higher expectation, at the expense of decreasing the trading signals.

This chart reveals that distribution both for MLP and SVM estimators. The ocurrence ratio is calculated for each class given a threshold of 0.5. Most non-crossover predictions are gathered on the first decile while most crossovers are on the last decile. Hence, no heavy changes are expected unless changes on the threshold exclude the first and/or the last decile. We can also see how similar both estimators are, so for the rest of the analysis only SVM is explored.

A first approach where higher expectation is desired sets the classifier threshold beyond 0.5. The following table summarizes all the scenarios focusing on the three key metrics. E*xpectation* and *#signals* are normalized to a baseline case where no predictions are made, whereas the baseline for *prediction hit rate* is the ideal prediction, as making no predictions does not apply.

This study reports interesting insights. On one hand, the metrics *#signals* and *hit rate* behave as expected: the higher the threshold the higher the hit rate at the expense of losing signals. On the other hand, ** expectation does not match hit rate trend** as it worsens as the threshold increases. Let us find out how hit rate and expectation correlate over the whole probability space.

These charts plot three components. First, the lower and upper dashed red lines point out the expectation of the baseline (making no predictions), and the expectation of the oracle (ideal prediction), respectively. Second, bars measure the weighing of each decile over the whole probability space. And third, the violet squares illustrate the expectation for each classifier-probability decile. Correlation between the hit rate and expectation observed in the first half of deciles, no longer remains in the second half, specially in the last decile, which also turns out to be the one that gathers the greatest number of crossover predictions.

Recalling what we stated at the beginning of this section, a look at these analysis reveals different opportunities to optimally set our estimators. For instance, strategies that are strong enough at any point above the lower red line, may benefit from setting a lower classifier threshold, as more profitable signals would be provided, turning out, more likely, in a longer time-in-market. On the contrary, those strategies demanding more expectation, may consider excluding predictions coming from the last decile, as long as losing its remarkable volume of signals is acceptable.

]]>Successful poker players are good at finding opponent’s weaknesses (also called leaks) and designing profitable strategies against those weaknesses. So far so good, but, what is actually a weakness? A weakness is an unbalanced strategy, therefore, exploitable. Optimal play is precisely built on balanced strategies, therefore, unexploitable. Thus, as you can guess, the key to identify leaks relies on knowing the optimal play.

As a final remark, notice that balanced play only applies to games with hidden information. Balanced play in fact protects you from the potential advantage that hidden information provides (your hole cards in poker). In games with complete information, such as chess or go, you do not have to balance your play. Instead, you should always play the movement with highest value.

Consider the following toy game:

- Two players (P
_{1}and P_{2}) - The deck is only composed of aces, kings and queens
- Limit betting
- The pot is P bets
- P
_{1}acts first and is forced to check - P
_{2}can bet or check - If P
_{2}bets, P_{1}can call or fold

Before analyzing the optimal strategy for this game, we first introduce the concept of *domination*.

A strategy dominates a strategy if

That is, a strategic action for a given player dominates another strategic action if its expectation *isn’t worse against any possible opponent’s response*, and it *is better against at least one* of these responses.

The most intuitive example of domination is value betting when holding the nuts and being last to act (or raising if facing a bet), but other spots also include dominated strategies as we will see later.

* P _{1}‘s strategy*

When being first to act, P

P_{1} must make P_{2} indifferent from betting to checking his bluffs:

Making we find the P_{1}‘s optimal call frequency when holding kings

Hence, the balanced strategy for P_{1} is built as: calling all his aces, calling of his kings, and folding all his queens.

* P _{2}‘s strategy *

P

P_{2} must make P_{1} indifferent from calling to folding his bluffs catchers:

Making we find the P_{2}‘s optimal bet frequency when holding queens

Summing up, the balanced strategy for P_{2} is built as: betting all his aces, checking all his kings, and betting of his queens.

* Moving to unbalance *

Now we know how both players should play in order to be unexploitable. But, what happens when a player decides to play unbalanced?

I wrote a simulator for this game that plots the variation of the expectation for several P_{2}‘s strategies and P_{1}‘s responses. The graph below represents the expectation for several bluffing frequencies and calling frequencies on a spot where the pot is 4.

You can see **three** noticeable results. **First**, when P_{2} plays balanced, the EV remains constant for any P_{1}‘s call frequency, which is consistent with P_{2}‘s motivation of making P_{1} indifferent from calling or folding. **Second**, once P_{2} plays unbalanced, P_{1} can improve (and also worsen!) his expectation by uniliterally changing his strategy; when P_{2} moves from equilibrium by underbluffing, the more P_{1} decreases his call frequency the more he increases his expectation, and, when P_{2} moves from equilibrium by overbluffing, the more P_{1} increases his call frequency the more he increases his expectation. And **third**, the structural asymmetry of this spot because P_{1} is not allowed to value bet or bluff, and because of the P_{2}‘s positional advantage.

Fixed-limit was quite popular in early 2000’s, but it was massively displaced by the no-limit variant where the players can size their bets as large as their whole remaining stack. This turns out in a funnier game, but it also increases the complexity of the game by introducing another decision to make. Let’s analyze how the balanced play for the AKQ game presented before is affected by this variant. In order to make calculus clearer, we normalize the pot, in such a way that the pot is 1, and is ratio of the pot.

* P _{1}‘s strategy *

The strategy when holding aces and queens is exactly the same as in the limit version reasoned above. With kings is as follows:

P_{1} must make P_{2} indifferent from betting to checking his bluffs:

Making we find the P_{1}‘s optimal call frequency when holding kings

* P _{2}‘s strategy *

The strategy when holding aces and kings is exactly the same as in the limit version reasoned above. When holding queen is as follows:

P_{2} must make P_{1} indifferent from calling to folding his bluffs catchers:

Making we find the P_{2}‘s optimal bet frequency when holding queens

* Optimal bet size *

We have defined the optimal frequencies both for P_{1} and P_{2}. However, P_{2} still has another decision to make: the size of his bets (value bets and bluffs). Let’s find out the P_{2}‘s expected value analyzing what happens in each possible hand dealing according to the frequencies obtained before.

**{card matchup}**: ∑(reward·ocurrence)

**{AK}**: 0

**{AQ}**: -α·b_{P2}

**{KA}**: 1·(1 – c_{P1}) + (α + 1)·c_{P1}

**{KQ}**: -α·b_{P2}c_{P1} + 1·b_{P2}(1 – c_{P1})

**{QA}**: 1

**{QK}**: 1

Being

We can find its maximum by equaling its derivative to zero

Solving we find that

Hence, the balanced strategy for P_{1} is built as: calling all his aces, calling of his kings, and folding all his queens. P_{2} should bet all his aces with a sizing of , check all his kings, and bet of his queens with a sizing of

This last graph shows the expectation of P_{2} as a function of the size of his bets, and how both the bluff and bluff catching frequencies are affected also by the P_{2}‘s bet size. Notice the bigger P_{2}‘s bets the more should bluff, whereas P_{1} should decrease his bluffcacthing frequency, to the point of always folding if P_{2}‘s bets are pot sized. I also wrote a simulator for this game that is available for download here, where you can play with the strategies parameters.

The next article in this series will get a little closer to real poker strategies by introducing more strategic options in the AKQ game, such as allowing P_{1} both to value bet and bluff, or allowing both players to raise when facing a bet.

Despite selecting the best parameters should not only consider the return but also the variance and the stability to small parameters variations, in order to simplify we assume the optimal corresponds to the absolute maximum of the return curve.

Given a profitable entry setup, and if we fix the stop loss level, the expected value as a function of the take profit level follows a kind of bell curve. On the other side, the variance tends to increase the farther is the target. The graph below illustrate this behavior on a setup where the take profit/stop loss is ranging from a ratio of 2:1 up to 60:1. Note that this focuses on the expected value per trade, which is not the metric we should optimize as we will see.

Trades are not independent events in a strategy because of their relationship with the money management. They freeze funds while alive, preventing from opening new positions or forcing to set lower sizes, and their lifetime does not scale as their EV. This is depicted in the graph below, where the metrics EV per trade, cumulative return, and number of trades, have been scaled to [0, 1]. For this example, we can see that the cumulative return reaches its optimal point with the EV per trade still a 15.03% under its top. The reason is that, the number of trades when setting the take profit target for the optimal point of the metric EV per trade, is a 20.97% lower than when setting the target according to a suboptimal EV per trade.

I have simulated a strategy based on the data presented before with the following setups:

- Taking full profits at the optimal target according to the cumulative return curve (green line)
- Taking 50% at the optimal, and 50% at a slightly suboptimal target (orange line)
- Taking 50% at the optimal, and 50% at a notably suboptimal target (red line)

Have a look at the results. Taking partial profits when the targets are in the surroundings of the optimal area has a minor effect. In fact, in this case study even outperforms the strategy taking full profits, but just as a consequence of variance. However, be careful if your closest target is too conservative (far from the optimal area), since the effect on the performance could be drastic. This is relevant because the use of this technique comes from the hand of not having a backtest where the design space is properly explored, and it is likely to set targets that ensure a high hit rate to create the deception of being doing well.

Finally, do not ignore the potential impact on the operational cost that this technique may cause in some cases. For example, in those rates consisting in a fixed amount and a variable amount depending on the trade size, or also when it forces to use more expensive products in order to increase the granularity.

]]>Para simplificar, a efectos de cálculo consideramos los tipos impositivos actuales para todos los periodos impositivos analizados, se ignoran reducciones de la base imponible, y no se contempla el efecto de la inflación.

Supongamos tres sujetos trabajadores por cuenta ajena. El primero percibe un salario constante en los últimos cuatro ejercicios. El segundo parte de una renta más baja, pero en los dos últimos periodos ésta se ve notablemente incrementada. El tercero gozaba de una renta cuantiosa en los dos primeros periodos, pero en los dos últimos no percibe renta alguna. Hay multitud de situaciones que dan lugar a estos escenarios, por ejemplo: el primer sujeto podría haber mantenido su puesto de trabajo en los últimos cuatro años, el segundo haber cambiado de trabajo o sufrido un ascenso en el tercer periodo, y el tercero haber perdido su puesto de trabajo en 2014.

Si bien los ingresos brutos de los tres sujetos son exactamente los mismos, no sucede lo mismo con el IRPF satisfecho. Éste se ve incrementado en las distribuciones en las que, en algún momento, parte de la renta tributa a tipos marginales que distribuciones más homogéneas nunca alcanzan. En el caso B se soporta un carga fiscal un 4,4% superior a la del caso A. En el caso C esta diferencia se incrementa hasta un 27,3%. Si bien las diferencias pueden llegar a ser notables, esta casuística es la que se ve afectada en menor medida por la distribución de las rentas a lo largo de los periodos impositivos puesto que no es posible obtener rendimientos negativos.

De todos los rendimientos que se incluyen en esta categoría, evaluamos rendimientos derivados de la renta variable, donde la volatilidad y los rendimientos negativos juegan un papel destacado. La caracterización del rendimiento de cualquier estrategia sobre un subyacente bursátil se puede aproximar por *N*(μ, σ). La realidad es que la inmensa mayoría de especuladores son perdedores a largo plazo (μ < 0). Sin embargo, incluso estrategias perdedoras pueden arrojar beneficios en ciertos periodos impositivos. La gráfica bajo estas líneas muestra cinco simulaciones del rendimiento a lo largo del tiempo de una estrategia perdedora. La línea punteada es el comportamiento esperado al que se tenderá en el largo plazo, y el resto de líneas son instancias de esa estrategia. La varianza es responsable de que la distribución de ejercicios en pérdidas o ganancias varíe de un sujeto a otro, pese a que todos utilicen estrategias que en el largo plazo converjan al mismo rendimiento.

Fijémonos, por ejemplo, en la simulación coloreada en gris. Este sujeto, pese a estar abocado a perder en el largo plazo, tuvo la varianza a favor en 2013, y comenzó su andadura bursátil con beneficios por los que debió tributar. A partir de entonces las pérdidas se imponen, de manera que en las declaraciones de 2014, 2015, y 2016 declarará rendimientos negativos que le habilitarán un crédito fiscal que, muy probablemente, nunca podrá llegar a materializar. Estamos ante un caso en el que el contribuyente **acaba pagando impuestos por perder**.

La tabla anterior detalla dos casos en los que se obtiene los mismos rendimientos brutos, con la diferencia de que en el primer caso se comienza perdiendo y se acaba ganando, y en el segundo caso se comienza ganando y se acaba perdiendo. Nótese que en el segundo caso, queda disponible un crédito fiscal, si bien éste en muchos casos puede no ser utilizado, ya sea por cese de la actividad o por no lograr rendimientos que lo neutralicen. Además, este crédito fiscal está sujeto a restricciones, tanto en tiempo como en cuantía.

Mención especial para el tratamiento de los dividendos. La compraventa de acciones y derivados no está sujeta a retención, y sin embargo la liquidación de dividendos sí lo está. Esto es un error, puesto que percibir un dividendo no es sinónimo de materializar una plusvalía. Un dividendo no es mas que la liquidación parcial del activo que lo abona, puesto que su importe se deduce de su cotización el mismo día en el que se hace efectivo. Consideremos la siguiente operación sobre Repsol:

Adquirimos títulos en Mayo de 2013 a 18,5€, y en Marzo de 2016 liquidamos el total de la posición a 10,8€. A pesar de que en ningún momento hemos obtenido plusvalías, ni siquiera latentes, nos hemos visto obligados a tributar por los dividendos percibidos como si de plusvalías se tratasen. Si tras liquidar la posición decidimos no realizar más operaciones, o, aun realizándolas, no recuperamos las minusvalías brutas de esta operación (-32,9%), **habremos tributado por perdidas**.

Para este escenario consideramos rentas derivadas del juego online. La tributación del juego online es especialmente aberrante, puesto que ni siquiera incluye la deficiente compensación de pérdidas aplicable a los rendimientos del ahorro. Supongamos de nuevo tres casos: los dos primeros se corresponden con jugadores ganadores (de manera consistente, no solo ocasionalmente), mientras que el último caso se ajusta a un jugador perdedor consistente al que el azar le otorga suculentas ganancias en un periodo impositivo. Un perfil como este lo podemos encontrar entre los jugadores recreacionales de torneos multimesa de poker, o modalidades recientes como los *Spin&Go*. Estos torneos son eventos donde su desequilibrada estructura de premios habilita ROIs estratosféricos ocasionalmente, incluso para jugadores con estrategia perdedora, gracias a la varianza extrema de estas modalidades. Las abultadas pérdidas subsiguientes encajan, por ejemplo, con un *affair* con las mesas regulares de límites altos.

En los dos primeros casos los sujetos obtienen las mismas ganancias brutas en los cuatro años, y de nuevo tributan de manera sensiblemente diferente. La diferencia en este caso con respecto a los escenarios expuestos anteriormente es que los sujetos que cierren periodos impositivos con pérdidas son fuertemente penalizados desde el punto de vista fiscal. El sujeto del caso B soporta una factura fiscal un 28,19% superior a la del sujeto del caso A, principalmente por haber incurrido en pérdidas en uno de los cuatro periodos.

Especialmente sangrante es el caso del jugador recreacional. Su actividad en el juego online le ha reportado una renta de 23.000€, por la que ha tenido que liquidar 26.901,5€ en concepto de IRPF. Esta situación contraviene el principio de no confiscatoriedad, e incluso se puede agravar si el sujeto continúa arrojando periodos negativos, hasta el punto de, una vez más, **pagar impuestos por perder**.

Un modelo fiscal justo no puede obviar la historia fiscal del contribuyente. El modelo actual infravalora, o incluso obvia, la variable tiempo, tratando cada periodo impositivo de manera aislada. La tabla siguiente reformula la tributación vista en el primer escenario considerando la historia fiscal. En cada periodo impositivo se liquida la diferencia entre lo tributado hasta la fecha y lo correspondiente en base a la renta promedio del contribuyente.

El efecto estabilizador de este modelo toma especial relevancia en aquellas actividades que puedan aflorar pérdidas (escenarios 2 y 3), donde el sistema vigente de compensación de pérdidas exclusivamente con ganancias futuras deriva en potentes discrepancias fiscales. La gráfica final muestra el tipo marginal efectivo de cada modelo sobre la renta bruta a lo largo de su actividad.

]]>

- Lack of stop loss
- Lack of a well defined signals
- Vague knowledge about money management

At least one of these factors, if not all, are present when a trader defends this technique. I could also point out another factor which has to do with the pyschological aspect (as many things in trading!), but it actually is a consequence of the first one: the reluctance to accept losses. The trader’s mind joins new positions with the previous losser opened trades, in such a way that average price is closer to the current price. If the price later reaches this average, they feel comfortable closing all of them because they think of them as a single trade, and therefore they are not lossing.

The metric par excellence when presenting the performance of a system is cumulative profitability over the sampled data. Indeed, it should be the starting point when analyzing the validity of a strategy, but we must be careful of what conclusions we draw from it. Have a look at the graph below this lines. Which one would you choose? Probably the most repeated answer would be: “the blue one”. It reaches the largest cumulative profitabilty by far, and the curve shape looks like the other alternatives (i.e. similar variance), so it is tempting to choose it if we do not know what this metric really means and which implications may have some others factors regarding the actual performance. Let me give you some additional information…

The underlying strategy is the same in the three alternatives: Same signals, same stop loss and the take profit, and same time frame. What is the difference then? Due to the fact that trades in this strategy are independent events (i.e. neither a short trade closes a previous long nor viceversa, and new trades do not modify any previous trade parameter), multiple trades coexist (3.1±3.8). All three alternatives graphed have limited the number of coexisting trades. This restriction has the effect of discarding trades, whose outcome is known to be positive if the sample is big enough. Hence, the higher the restriction the lower the cumulative profitability.

Now the question is: how does this metric translates into the actual performance? Here is where reciprocal interactions between strategy and MM come into play.

Once we have validated our strategy through the previous simulation, it is time to analyze its behaviour regarding the MM parameters. This step is as crucial as having a good strategy; a carefully adjusted MM can **strongly** improve its performance. I compared the actual profit of the same strategy on a yearly basis limiting the spreading degree. The results are normalized to the best choice, that is no spreading, so values under 1.0 are not desirable.

The MM analyzed has the following features:

- Maximum leverage: ∼6.0
- Exposure dynamically adjusted with a trade-by-trade granularity
- Profit cashout on a yearly basis
- Longs and shorts compensate for the net exposure

Look at the table underneath; just one degree of spreading – shooting and keeping one bullet on the chamber – reduces the average yearly profit by a 61.8% (does this ratio sound familiar to you?), and the more we spread trades out the more the profit is reduced. I’d like to highlight the rightmost column, which measures the effective leverage by weightening time in market, because it is the key metric which explains the results: **The higher the spread degree the lower the effective leverage**.

The analysis presented so far revealed the big opportunity cost of spreading out trades. However, it also has a remarkable effect on the account variance, to the extent of not being feasible for certain trader’s profiles. The chart shows how drawdowns distribution vary according to the maximum number of coexisting trades. The most profitable choice entails drawdowns of 33.2%±10.9% with a peak of 62.7%. Allowing up to two coexisting trades reduces the average size of swings by ∼23% (25.2%±10.9%; 62.7%). Finally, if we allow our system to mantain up to 3 coexisting trades, drawdowns are reduced by ∼38% (20.6%±5.9%; 33.3%).

Are all traders ready to bear such big swings? Obviously not. Drawdowns as large as 60% are incompatible with risk aversion threshold of many traders; they will likely end giving up using their systems when facing such variance. This underscores how critical is to carefully make this kind of calculations in order to know what can we expect, and therefore being able to distinguish what’s normal behaviour from what is not. For those traders who can not sleep peacefully with big swings I suggest to choose more stable setups at the expense of sacrificing performance.

]]>In order to determine the trade size for your strategy, you have to take into account the following:

- Variance of your strategy
- Trade warranty required by your broker
- Number of simultaneously opened trades

The first point is often considered – despite wrongly or suboptimally in many cases -. You know your strategy has periods where it is lossing, and you must size your trade in such a way that your balance tolerates them. It is critical to have a large historical strategy backtest in order to have a confident estimation of its variance.

The second point leads to a conclusion of which most traders are not aware: your trade size also depends on your broker’s conditions! Your trade size cannot be the same when trading with futures, where warranties working with indices are usually around 10%, than when trading with CFDs, where warranties are much lower. In the first case, a trade size which would be suitable if working with CFDs might prevent you from opening a new position requested by your strategy, even when your balance perfectly affords it.

The third point is strategy and broker dependent. On one hand your trade size must allow you to open as many simultaneous trades as your strategy requires; on the other hand, your trade size must take into account whether your broker allows longs and shorts warranty compensation over the same asset.

Strategies may differ in many ways from the point of view of money management. Does your strategy require to keep long and shorts over the same asset at the same time? How many trades shall be simultaneously opened? Does it have fixed stop loss and take profit or not? Since many variables are involved, the best way to find the optimal trade size is to run simulations of your strategy with different trade sizes until the highest one which satisfies all the conditions enumerated before is found.

I made an analysis considering the following system and broker features:

- Strategy standard deviation: 1.36
- Simultaneous longs and shorts over the asset compensate for the warranty
- Net simultaneous positions (avg±std dev; peak): 10.3±10.5; 68
- Warranty: 1%
- Margin threshold: 30%

I ran simulations initiallly setting the trade size as *account balance / warranty*, and then iterating decreasing the trade size until a value satisfies the conditions along the whole simulated sample. The initial value will definitely fail in several ways since it obviously does not tolerate the system variance and it cannot support more than one net long/short, but it is just a starting point, and computations only takes a few minutes.

The graph below shows the highest trade size value which succesfully passed the test.

And this other graph shows the inmediatly higher value which fails. The square marks the point where margin falls below our threshold and therefore the simulation is aborted.

What about if we are trading with trade sizes far from the optimal? There are two scenarios:

a) *Trade sizes higher than the optimal*

The consequences in this case depend on how far from optimal the trade size is, and how we face big swings (and not only losses, we should also be concerned about huge winnings!). Trade sizes very far from the optimal will likely end busting our account. This is sadly common between amateur traders who turn leverage into a massive destruction weapon. If our trade size is just a bit far from the optimal, we will find situations where our margin does not allow us to open a trade required by our strategy. This situation is obviously much less harmful than the previous one, but it should be considered as a serious warning. We should inmediately review our money management.

b) *Trade sizes lower than the optimal*

Trades sizes lower than optimal cause a performance degradation as a result of a too conservative leverage. This conclusion is intuituve, but the quantitative aspect is not so intuitive. The last graph depicts the impact of choosing too low trade sizes. Data are normalized to the optimal value. We can see how the performance logarithmically decreases, where, for example, a trade size only a 10% lower than the optimal leads to just a 37% the performance of the system with the optimal trade size.

]]>This system has fixed both stop loss and take profit in a 1:8.5 relation. The graph below shows the impact over the EV as a result of moving the stop loss to break even after the price has reached different fractions of the take profit. For instance, a value 0.9 in the horizontal axis means that the stop loss is moved to break even after price has reached 90% of the take profit, and its corresponding vertical axis value (∼0.99) means that the system EV slightly decreases about 1%. Data are normalized to the baseline, which is the system not leveraging this strategy. Hence, values of EV lower than 1.0 are not desired. This graph shows a clear trend: the sooner the stop loss is moved to break even the more the system performance worsens.

If we are awared of price volatility, at a first glance we might be tempted to think that this profit protection technique will improve our trading if we are able to find a suitable point to apply it, but the reality is that this point does not exist. Notice that even when price has almost reached our profit target, and therefore the stop loss is far from price, this strategy also fails to improve the system performance.

“Break even is just related to risk aversion, not to price behaviour”

Another aspect of psychology that runs counter maximizing expected value is giving too relevance to the qualitative outcome while underestimating the quantitative one. In this sense, many traders usually prefer systems with high hit rates, downplaying EV. Moving stop loss to break even has the effect of increasing the hit rate, and hitting more often causes the deception of doing better. Moreover, this is specially harmful since the sooner we move the stop loss the more the hit rate increases. Note that for the evaluated system, moving the stop loss when the price has reached 10% of the target makes our system to hit four times more!

Finally, I would like to raise some questions about the fundamentals: where should i place a stop loss? Is break even point relevant? Does break even point invalidate our trading after our trade has partially succeed, instead of our initial stop loss? How should i be concerned about volatility? Try to answer these questions and you will probably conclude that break even has no relevance from the point of view of price behaviour. I encourage any trader who read this article to backtest this strategy to check out the impact over its profit.

]]>