Categories
Forex Educational Library

The Trading Record

Introduction

Traders want to win. Nothing else matters to them; and they think and believe the most important question is timing the entry. Exits don’t matter at all, because if they time the entry, they could easily get out long before a retracement erases their profit. O so they believe.

That’s the reason there are thousands of books about Technical Analysis, Indicators, Elliott Wave Forecasting, and so on, and just a handful of books on psychology, statistical methods, and trading methodology.

The problem lies within us, not in the market. The truth is not out there. It is in here.

There are a lot of psychological problems that infest most of the traders. One of the most dangerous is the need to be right. They hate to lose, so they let their losses run hoping to cover at a market turn and cut their gains short, afraid to lose that small gain. This behavior, together with improper position sizing is the cause of failure in most of the traders.

The second one is the firm belief in the law of small numbers. This means the majority of unsuccessful traders infer long-term statistical properties based on very short-term data. When his trading system enters in a losing streak, they decide the system doesn’t work, so they look for another system which, again, is rejected when it enters in another losing sequence and so on.

There are two problems with this approach. The first one is that the trading account is constantly consumed because the trader is discarding the system when sits at its worst performance, adding negative bias to his performance every time he or she switches that way. The second one is that the wannabe trader cannot learn from the past nor he can improve it.

This article is a rough approach to the problem of establishing a trading methodology.

1.- Diversification

The first measure a trader should take is:

  1. A portfolio between 3-10 of uncorrelated and risk-adjusted assets; or
  2. A portfolio of 3 to 5 uncorrelated trading systems; or
  3. Both 1 and 2 working together.

What’s the advantage of a diversified portfolio:

The advantage of having a diversified portfolio of assets is that it smooths the equity curve and, and we get a substantial reduction in the total Drawdown. I’ve experienced myself the psychological advantage of having a large portfolio, especially if the volatility is high. Losing 10% on an asset is very hard, but if you have four winners at the same time, then that 10% is just a 2% loss in the overall account, that is compensated with, maybe, 4-6% profits on other securities. That, I can assure you, gave me the strength to follow my system!.

The advantage of three or more trading systems in tandem is twofold. It helps, also improving overall drawdown and smooth the equity curve, because we distribute the risk between the systems. It also helps to raise profits, since every system contributes to profits in good times, filling the hole the underperforming one is doing.

That doesn’t work all the time. There are days when all your assets tank, but overall a diversified portfolio together with a diversified catalog of strategies is a peacemaker for your soul.

2.- Trading Record

As we said, deciding that a Trading System has an edge isn’t a matter of evaluating the last five or ten trades. Even, evaluating the last 30 trades is not conclusive at all. And changing erratically from system to system is worse than random pick, for the reasons already discussed.

No system is perfect. At the same time, the market is dynamic. This week we may have a bull and low volatility market and next one, or next month, we are stuck in a high-volatility choppy market that threatens to deplet our account.

We, as traders need to adapt the system as much as is healthy. But we need to know what to adjust and by how much.

To gather information to make a proper analysis, we need to collect data. As much as possible. Thus, which kind of data do we need?

To answer this, we need to, first look at which kind of information do we really need. As traders, we would like to data about timing our entries, our exits, and our stop-loss levels. As for the entries we’d like to know if we are entering too early or too late. We’d like to know that also for the profit-taking. Finally, we’d like to optimize the distance between entry and stop loss.

To gather data to answer the timing questions and the stop loss optimum distance the data that we need to collect is:

  • Entry type (long or short)
  • Entry Date and time,
  • Entry Price
  • Planned Target price
  • Effective exit price
  • Exit date and time
  • Maximum Adverse Excursion (MAE)
  • Maximum Favourable Excursion(MFE)

All the above concepts are well known to most investors, except, maybe, the two bottom ones. So, let me focus this article a bit on them, since they are quite significant and useful, but not too well known.

MAE is the maximum adverse price movement against the direction of the trend before resuming a positive movement, excluding stops. I mean, We take stops out of this equation. We register the level at which a market turn to the side of our trade.

MFE is the maximum favourable price movement we get on a trade excluding targets. We register the maximum movement a trade delivers in our favour. We observe, also, that the red, losing trades don’t travel too much to the upside.

 

Having registered all these information, we can get the statistical evidence about how accurate our entry timing is, by analysing the average distance our profitable trades has to move in the red before moving to profitability.

If we pull the trigger too early, we will observe an increase in the magnitude of that mean distance together with a drop in the percent of gainers. If we enter too late, we may experience a very tiny average MAE but we are hurting our average MFE. Therefore, a tiny average MAE together with a lousy average MFE shows we need to reconsider earlier entries.

We can, then, set the invalidation level that defines our stop loss at a statistically significant level instead of at a level that is visible for any smart market participant. We should remember that the market is an adaptive creature. Our actions change it. It’s a typical case of the scientist influencing the results of the experiment by the mere fact of taking measurements.

Let’s have a look at a MAE graph of the same system after setting a proper stop loss:

Now All losing trades are mostly cut at 1.2% loss about the level we set as the optimum in our previous graph (Fig 2).  When this happens, we suffer a slight drop in the percent of gainers, but it should be tiny because most of the trades beyond MAE are losers. In this case, we went from 37.9% winners down to 37.08% but the Reward risk ratio of the system went from results 1.7 to 1.83, and the average trade went from $12.01 to $16.5.

In the same way, we could do an optimization analysis of our targets:

We observed that most of the trades were within a 2% excursion before dropping, so we set that target level. The result overall result was rather tiny. The Reward-to-risk ratio went to 1.84, and the average trade to 16.7

These are a few observations that help us fine-tune our system using the statistical properties of our trades, together with a visual inspection of the latest entries and exits in comparison with the actual price action.

Other statistical data can be extracted from the tracking record to assess the quality of the system and evaluate possible actions to correct its behaviour and assess essential trading parameters. Such as Maximum Drawdown of the system, which is very important to optimize our position size, or the trade statistics over time, which shows of the profitability of the system shrinks, stays stable or grows with time.

This kind of graph can be easily made on a spreadsheet. This case shows 12 years of trading history as I took it from a MACD trading system study as an example.

Of course, we could use the track record to compute derived and valuable information, to estimate the behaviour of the system under several position sizes, and calculate its weekly or monthly results based in the estimation, along with the different drawdown profiles shaped. Then, the trader could decide, based upon his personal tolerance for drawdown, which combination of Returns/drawdown fit his or her style and psychological tastes.

The point is, to get the information we must collect data. And we need information, a lot of it, to avoid falling into the “law of small numbers” fallacy, and also to optimize the system and our risk management.

Note: All images were produced using Multicharts 11 Trading Platform’s backtesting capabilities.

Categories
Forex Educational Library

Designing a Trading System (V) – Testing Exits and Stops

The importance of exits

It’s not possible to create a system based only on almost perfect entries and using random exits and stops. As we could observe in the entry testing example, the percent profitability of an entry signal is very close to 50%; a coin flip would reach that score. The real money is made directing our efforts into proper risk control, money management, and adequate exits.

Test methods for exits and stops

Testing exits independently are much more difficult than testing entries. Sometimes the entry and the exit is mingled together in a way that’s difficult to separate, for example, when trading support-resistance levels. If that’s the case, the best way is to test the entire system at once.

When it’s possible to evaluate exits by themselves Kevin J. Davey proposes two approaches:

  • Test with one or several similar entries
  • Random entry

The ideas by LeBeau and Lucas move near the same path: Their method of testing exits is to create a very generic entry signal to feed the exit method. If each exit method is tested using identical entries, it should be possible to make valid conclusions about their relative value. Not all exits work equally well with different entries, but if the entry is generic enough, we may get some feeling for the relative effectiveness of a set of exits.

Their method of testing exits is a general approach that encompasses both ways enumerated by Kevin J, Davey.  Nothing is more generic than a random entry, and a non-random entry is improved if we make it close to the type of entry we intended for our system.

Test with similar entries

The fundamental idea behind testing exits, is, of course, to see if it has an edge over a random exit or a benchmark exit. A reliable exit should make a wrong or random entry into a profitable system, and for sure, it should not make an entry system worse.

To create a generic entry signal similar to the one we have in mind for a new system, we need to classify that system. Usually, new systems fall into two categories: Trend following and return to the mean, or counter-trend.

For trend-following systems, Kevin uses an N-bar breakout entry, while for counter-trend systems he uses a relative strength index entry. An exit strategy that works well in similar entry types should work equally well with the intended entry.

Random Entry

The Idea of a random entry is to see if the exit shows an edge by itself. The way to do that is to use a random entry as the optimising parameter with more than 100 runs while keeping the exit fixed and observe what percent of the optimisations are profitable. A very successful exit might have a high percentage of successful series. That is, in my opinion, the best criteria to know if an idea for an exit is valid and has an edge.

Fig. 1 shows the EasyLanguage code for a random entry. This code is a modified version of the one that Bill Brower has explained in his book EasyLanguage Learning-by-Example Workbook. This piece of code can easily be transposed to MQL or another language.

  • Fakecount is used to iterate the optimiser to get several random entry results
  • Initbars is the minimum number of bars the system wait till a new entry signal can be triggered.
  • Randvar is the maximum of bars a random generator can deliver, and it’s added to initbars.
  • BuySell is used to test long and short positions separately 1 for longs -1 for shorts

Fig. 2 shows the 3D graph of a trail-stop exit. We observe that around 0.15%, there is the sweet spot in all random iterations (50 in this example).

In this case, at 0.15% trail stop, the number of profitable iterations were more than 30 out of 50, that is, 60% were positive.

Evaluation criteria

Besides profitability, it’s good to assess the quality of an exit signal based on Maximum Favourable Excursion (MFE) and Maximum Adverse Excursion (MAE) standards.

Those two concepts, developed by John Sweeney, define the maximum adverse excursion (MAE) that a sound signal reaches before it proceeds to run in our favour.

Fig. 3 Show a trading system without stops. We observe that there is a drawdown level beyond which there is almost no winner and mostly are losers. That level defines the MAE optimal stop.

The maximum favourable excursion is the profit level that maximises the result on average of a trading system before it starts to fade and lose profits. MFE is the complementary concept to MAE, but it is a bit harder to visualise.

In Fig. 4 we observe that for the trade in the circle the actual run-up was 0.54% while the real close was 0.3%, the difference is a substantive profit left on the table. The goal of the exit is, on average, to make that distance as short as possible. That means the trading points should be, on average, closer to the upper line, as Fig. 4 shows.

Those two concepts applied to exits mean that the exit must avoid levels beyond MAE, and it should not give back too many profits and get close to the maximum possible excursion.

Total testing

Once we have assessed the goodness of an entry system and have a collection of useful exits to compliment it, we need to test them together and see how entries and exits interact.

The main rule at this point is getting profitability in the majority of combinations of entry and exit signals. For example, if we have ten parameter values on entries and ten on the exits, we would like positive results on more than fifty. Also, I love to see smoothness on the 3D surface. Too many peaks and valleys are a sign of randomness, and it’s not good for the future behaviour of the system, as in Fig. 5

 

Then, we choose a point on the hill that’s surrounded by a convex and smooth surface with similar profitability. That way we are trying to prevent a change in the character of the market which would spoil the system too soon.

Fig. 6  and 7 shows the equity curve and drawdown of a mean-reverting system, and its summary report after having passed the different stages up to the final testing and selection.

With that final assessment, we have achieved the limited testing stage. Therefore, this strategy has passed the test and is a candidate to further forward analyses and optimisations.

 

 

Further readings from this series:

Forex Designing a Trading System (I) – Introduction to Systematic Trading

Designing a Trading System (II) – The Toolbox Part 1

Designing a Trading System (III) – The Toolbox Part 2

Designing a Trading System (IV) – Testing Entries


 

References:

Building Winning Algorithmic Trading Systems, Kevin J. Davey

Campaign Trading, John Sweeney

Computer Analysis of the Futures Markets, Charles LeBeau, George Lucas

Images were taken with permission from Multicharts 11, trading platform.

 ©Forex.Academy
Categories
Forex Educational Library

Maximum Adverse Excursion

INTRODUCTION

What is the MAE

Maximum Adverse Excursion (MAE) is a method of analysis for automatic or discretionary trading systems that allow us to objectively improve the overall operating result by positioning stops based on the statistical analysis of the development of operations from its inception to its closure.

When we study a trading system, we often find losses. Sometimes these losses are recurrent and lead us to reject a system or some of its rules. Here, the proposal is that instead of doing this, we approach the problem in another way.

As a method of improving results, John Sweeney proposes a statistical system rather than a technical one. We will not rely on indicators or the behavior of complicated logarithms, but on the statistical study differentiated from winning and losing operations. If our entry method is good, the course of price in winning trades is different from the behavior of the price of losing trades. We will not rely on indicators or the behavior of complicated logarithms, but on the statistical study differentiated from winning and losing operations.

Let’s analyze the winning trades and, above all, those that ended in losses. Are there any common features in them? Can we detect any pattern that makes us think we are in front of something usable?

There is a truth that in any trading system we must accept inescapably. At some point, we have to cut our losses. Of the many methods used for this purpose, the most common of all is price action when it distances itself from the meaning of our trade.

THE METHOD

We will track the price path during positive trades and along those that end in losses. The idea is to check the typical route of each of them and in this way, find the best way to place the system stop to achieve a better risk to reward ratio.

We will call “excursion” to the price range traveled by the price from our entrance to its end. We will distinguish the two possible directions:

Maximum Favorable Excursion: (MFE) It is the biggest advance of the price from our entrance to the exit.

Maximum Adverse Excursion: (MAE) It is the maximum retreat of the price from our entrance until the closing.

Steps

  1. Define our input and output rules.
  2. Record how much the price has moved from our entry to our departure both for and against the trade.
  3. Separate the winning trader’s data from losers into a table.
  4. Order the losers for lost categories.
  5. Check which patterns follow the price on losing trades and learn to recognize it.
  6. Set the stop according to the recognized pattern. If it behaves like a loser trade, acknowledge that we have been wrong and assume the losses.

Let’s see an example of how this methodology works.

Graph of a system without stops that operates on the DAX

In the vertical axis, we can see the maximum gap of each trade before its closure (MFE). The horizontal displacement represents the maximum adverse excursion (MAE) produced before its closing.

Given the graph, it appears as relevant the level of 0.15% – 0.20% as a limit. This translates into losing trades less than 0.15% -0.20% before ending losses. We can then cut losses at 0.28% (X-axis). It is also appreciated that the vast majority of winning trades retraced less than 0.10%.

The statistics of this system before making changes are as follows.

Based on the above results, we set the stop at 0.105% of retraction, and now it looks like this.

The statistics are as follows:

Statistics have improved. First, the maximum loss has been reduced from -1425 € to -237 € as well as the average loss from -195.47 to -167.24, and the profit-loss ratio has improved from 1.81 to 2.13.

By applying a trailing stop to the system, we can improve some statistical data that will help in the general computation. The use of this type of stop is delicate because it is very easy to be touched by a momentary price retreat. However, its use at a sufficiently loose distance can prevent a trade that is very advanced from becoming lost. In our case, the average loss on the losing trades improve from 167 to 158, and the percentage of winning trades increases slightly in both the long and short sides. It would read as follows:

Now to advance the robustness of the system, let’s look at the Maximum Favorable Excursion (MFE) by looking at the following graph.

We see the effect of the Trailing Stop. The trades advance far beyond the point at which they finally close. This is normal using this type of stop. Adjusting them further usually leads to a worsening of the final result of the set.

In the following chart, we see the effect of setting the Trailing Stop 50% closer.

Although it seems better, the total gain is worse, and the drawdown increases.

You can then compare the two options statistics, which leave no doubt.

Statistics with optimal Trailing stop:

Statistics with Trailing stop a 50% more adjusted

Maximum Favorable Excursion

The MFE is found by monitoring the maximum reached during positive operations. Often, we find that our trades end very far from this point. Obviously, our goal must be to get them to stop as close as possible to the MFE. In each particular case, we cannot expect to always close at the absolute maximum. In this case, the methods of traditional technical analysis based on indicators often betray us by getting us out of the market ahead of time or, on the contrary, keeping us while the point of maximum profit goes away.

By searching the MFE, we can detect the most likely area that the winning trades will reach. In this way, we should place our profit target at a point that’s the most probable, statistically speaking. This won’t make our system jump to an absolute possible maximum profit. However, it simplifies the system and makes it more robust by shortening the exposure time to the market.

Finally, a sample of the effect of adding a profit target, taking as reference the MFE. In this case, we separate the behavior of the MFE in the bearish bullish trades since, in the case of indexes and stocks, the market does not usually show symmetry. Experience tells us that there are different characteristics between bull markets and bear markets, although there are authors who question it.

We put a TP (Take Profit) of 27 on bullish and 33 points for the bearish.

What you see is a performance improvement. Although the improvement in net profit does not seem too important, the maximum streak of losses decreases a lot. This procedure reduces the capital necessary for its implementation, and therefore, there is a substantial improvement in percentage profitability. It also increases the net profit and especially the Profit Factor.

Minimum Favorable Excursion

Another concept to evaluate is the Minimum Favorable Excursion. It is to detect the minimum point of advance from which it is unlikely that the price returns on our entrance. This will allow us to move our stops to break even, upon reaching this area and prevent it from ending up in losses.

Conclusion

The statistical method proposed by the MAE and MFE study is revealed as a fully valid system for the study and improvement of any trading system. The use of Maximum Favorable Excursion charts gives us a way to distinguish winning trades from losing trades since they behave differently.

We can see very quickly if there are exploitable behaviors. The behavior of losing trades has its own patterns. It just advances a tiny amount in favor of the entry and then moves against it, and this allows to act consequently by cutting the losses at the right spot where statistically winning trades didn’t reach.

On the other hand, the traditional use of pivots as a reference to locate stops usually leads to losses, since it is the first place where the market seeks liquidity as it minimally weakens a trend.

Finally, the MFE allows us to put the trade into break-even at the right time or even add positions in a favorable environment. It also facilitates the tracking of profit targets. In any case, it is a highly recommended study method to improve automatic or manual systems.

 ©Forex.Academy