How complex are the algorithms used by financial institutions such as Goldman Sachs and other hedge funds in their proprietary trading so…

This is an answer to a question on Quora. It got re-posted and shared across Quora users.

Answer by Laurent Bernut:

Complexity is a form of laziness
Complexity is fragile: it works until it does not

There are two types of algos: low-latency and systematic algos.

Low-latency is the realm of HFT. Those algos can be quite intense. Read dark pools or flash boys. There are now algos gaming other algos. It is a bit like the “sperm war” in the “red queen”, a book on evolutionary psychology.

At the other end of the spectrum is systematic trading. It stems of the belief that if investment is a process, then it should be automated. Those algos are conceptually easy to understand. They are not however always easy to program.

At the end of the day, algos are a reflection of the philosophy, beliefs of those who design and code them. Those who have not mastered their craft will gladly put lipstick on a pig, by adding complexity to flawed concepts.
Those who have worked a bit harder will simplify. Simplicity is not easy

Sorry for the philosophical answer

How complex are the algorithms used by financial institutions such as Goldman Sachs and other hedge funds in their proprietary trading so…

Algorithmic trading: How to get started building an algorithmic trading system?

This is an answer to a question on Quora: Algorithmic trading: How to get started building an algorithmic trading system?

Answer by Laurent Bernut:

If investment is a process, then the logical conclusion is automation.
Algorithms are nothing else than the extreme formalisation of an underlying philosophy.

This is the visual expression of a trading edge
Trading edge = Win% *Avg Win% – Loss% *Avg Loss%
It changed my life and the way I approach the markets. Visualise your distribution, always. It will help You clarify your concepts, shed light on your logical flaws, but first let’s start with philosophy and belief elicitation

1. Why is it important to clarify your beliefs ?
We trade our beliefs. More importantly, we trade our subconscious beliefs. “If You don’t know who you are, markets are an expensive place to find out”, Adam Smith
Many people do not take the time to elicit their beliefs and operate on borrowed beliefs. Unanswered questions and faulty logic is the reason why some systematic traders tweak their system around each drawdown. i used to be like that for many years.
Belief elicitation exercises:

  1. The Work by Byron Katie. After i completed a 2 beliefs a day challenge for 100 days, i could explain my style to any grandmother
  2. 5 why ? Ask yourself a question with “why” and dive deeper
  3. “I am”: beliefs about self are best elicited when we start with this sentence stem
  4. Sentence completion exercises: Nathaniel Branden in his work on self-esteem has pioneered this method. For example, “to me a robust trading is…”

Mindsets: expansive and subtractive or masala smoothie Vs band-aid
There are two types of mindset, and we need both at different times:

  1. Expansive to explore concepts, ideas, tricks etc. Expansive mindset is useful in the early stage of strategy design
  2. Subtractive: to simplify and clarify concepts. Complexity is a form of laziness. Instead of adding yet another redundant factor, try subtracting one or two. Work hard until You find an elegant and simple solution

Systematic traders who fail at being subtractive have a smoothie approach. They throw all kinds of stuff into the optimization blender and waterboard data until it confesses. Bad move: complexity is a form of laziness.
Overly subtractive systematic traders have a band aid mentality. They hard-code everything and then good luck patching
“Essentialist traders” understand that it is a dance between periods of exploration and times of hard core simplification. Simple is not easy
It has taken me 3,873 hours, and i accept it may take a lifetime

2. Exit: start with the end in mind Counter-intuitive truth
The only time when you know if a trade was profitable is after exit, right ?
So, focus on the exit logic first.
In my opinion, the main reason why people fail to automate their strategy is that they focus too  much on entry and not enough on exit.
The quality of your exits shapes your P&L distribution, see chart above
Spend enormous time on stop loss as it affects 4 components of your trading system: Win%, Loss%, Avg Loss%, trading frequency
The quality of your system will be determined by the quality of your stop loss,

3. Money is made in the money management module
Equal weight is a form of laziness. The size of your bets will determine   the shape of your returns. Understand when your strategy does not work and reduce size. Conversely, increase size when it works.
I will write more about position sizing on my website, but there are many resources across the internet

3. Last and very least, Entry
After you have watched a full season of “desperate housewives” or “breaking bad”, had some chocolate, walked the dog, fed the fish, called your mom, then it’s time to think about entry.
Read the above formula, stock picking is not a primary component. One may argue that proper stock picking may increase win%. Maybe, but it is worthless if there is neither proper exit policy, nor money management.
In probabilistic terms, after you have fixed exit, entry becomes a sliding scale probability

4. What to focus on when testing
There is no magical moving average, indicator value. When testing your system, focus on three things:

  1. False positives: they erode performance. Find simple (elegant) ways to reduce them, work on the logic
  2. periods when the strategy does not work: no strategy works all the time. Be prepared for that and prepare contingency plans in advance. Tweaking the system during a drawdown is like learning to swim in a storm
  3. Buying power and money management: this is another counter-intuitive fact. Your system may generate ideas but you do not have the buying power to execute. Please, have a look at the chart above

I build all my strategies from the short side first. The best test of robustness for a strategy is the short side:

  1. Thin volume
  2. brutally volatile: this
  3. shorter cycle: stocks go up the elevator and go out the window
  4. Borrow availability:

Platforms
I started out on WealthLab developer. It has a spectacular position sizing library. This is the only platform that allows portfolio wide backtetsing and optimisation. I test all my concepts on WLD. Highly recommend. It has one drawback, it does not connect position sizer with real live trading.

Amibroker is good too. It has an API that connects to Interactive brokers and a decent poisition sizer.

We program on Metatrader for Forex. Unfortunately, Metatrader has gone down the complexity rabbit hole. there is a vibrant community out there.

MatLab, the expensive weapon of choice for math graduates. No comment…

R: much better cost-performance than Matlab, simply because it is free

Tradestation
Perry Kaufman wrote some good books about TS. There is a vibrant community out there. It is easier than most other platforms

Final advice
If You want to learn to swim, You have to jump in the water. Many novices want to send their billion dollar ideas to some cheap programmers somewhere. It does not work like that. You need to learn the language, the logic.
Brace for a long journey

Algorithmic trading: How to get started building an algorithmic trading system?

People talk about an edge in trading yet never want to discuss what their edge is. Can you give an example of an edge that no longer work…

Answer by Laurent Bernut:

Edge can be summed up in a formula that applies to any instrument (see below). Like risk management, everyone like to talk about it, but few people actually can distinguish between sustainable, stylistic, and systemic edge

I. Examples
Let’s start with examples:
Chinese IPOs: Institutional and some retail investors participate in IPOs. Classic trade is to sell half to 100% of the allocation at the Open of the first day and book the disount. Chinese IPOs used to go up 100% in 3-4 days.
That “edge: is clearly gone now that they open 50% below and that “investors”/flippers have to keep their holdings for a certain period.
More on Chinese IPOs later when we talk about specific versus general

Stock split: there was a strange loophole in Japan, where stock split were announced 2 weeks before effective dates. So, the trade was to go Long prior, reverse the trade and go short at the close of the day before the split went ex-date.

Korean USD trading
In Korea, foreign participants had to trade in USD, while locals were allowed to trade in KRW. And then You wonder why some markets never seem to go anywhere ? Borrow availability was vastly different.

A shares B shares in China
Foreigners were not allowed to trade A shares.

Prop trading:
This is probably one of the most egregious “edges”. Prop traders were carrying their facilitation business and encouraged to hold their own book…

II Types of edge
Systemic edges:
Locals in China and Korea were legally able to milk foreigners. This had nothing to do with talent. Arguably, it might have encouraged complacency. This is systemic edge. Another example of systemic edge is Ali Baba. There is no real competition from other shopping malls.

Those edge exist as long as regulatory inefficiencies are there to protect them. They are fragile, fickle but can last for some time.
They sometimes can be double edged. In their panic moves to contain the fall, Chinese authorities have asked some brokers like CITIC to engage in price stabilisation activities.

Stylistic/cyclical edge:
Some people know how to trade GARP (growth at reasonable price). Some know how to trade value. Others know how to ride Beta.

Their edge last as long as markets reward their style. Unfortunately, investors find it difficult to distinguish between skill and style. In other words, are managers good (or bad) because of what the markets reward (or punishes), or are they good because they adapted to what the markets reward.
There has been a lot research on the topic. Quants sometimes refer to this as luck versus skill.
A simple, down to earth trick to find out is: how do those managers fare when market style changes ? Does their performance suffer much more than the markets or can they contain losses ?

Sustainable edge
The rarest form of edge and the least talked about is sustainable edge. The reason why few people talk about it is because either deep down they know they do not have anything special, or they believe their outer game constitute sufficient sustainable edge.
For example, biotech analysts clocking 2-3 baggers one after another was great until a presidential candidate stopped being supportive of the industry. Unfortunately, no bull market has ever boosted anybody’s IQ.

III. So, how do we measure trading edge ? Where do we find examples  and can it be replicated ?

A. Trading edge formula
Every trading strategy, investment method, track record that has, is and will be boils down to this formula:
Trading edge = Win% *Avg Win% – Loss% * Avg Loss%
This is also known as gain expectancy. This is just another fancy way to say average profit.
Guys studying finance have never heard of that one. They have heard a lot about efficient markets from guys with zero beginning of real track record…

Robustness of the edge can be tested via a t-stat. Van Tharp has popularized the formula by rebranding it into SQN: System Quality Number

t-stat = SQRT(trades) * Trading Edge / STDEV(Loss)

This t-stat recaptures frequency and deviation from the mean. In other words, it is OK to have a spectacular trading edge but it is quite useless if it trades every Friday 13th full moon (next one in 2017 and the after in 2023)

B. Examples of sustainable trading edges
In order to constitute a valid trading edge for any specific “investment obedience”, trading edge must be transmissible across the “trading tribe”

This immediately eliminates discretionary fundamental investing. Everyone in the fundamental analysis business likes to make reference to Warren Buffet. Yet, very few have a comparable performance.
I do not hate fundamental analysis, quite the opposite in fact. A good analogy is rock n’ roll. ELVIS and Ted Nugent are both rockers. Yet, no-one would ever dare putting The KING and that trigger happy human evolutionary challenged specimen in the same basket.

I wish I could say Value investing has some sustainable edge. Unfortunately, like fundamental analysis, the word has been perverted and used by everyone with a marketing pamphlet.
There is evidence of sustainable edge in systematic value investing.

Systematic trend following CTAs have a systematic edge. Their style has generated alpha over decades. Trading edge is transmissible: newer guys seem to fare well. (for disclosure purposes, I am not a CTA)

C. Can it be replicated ?
This is probably the most important question. No-one really cares about their neighbor  trading edge. What they really want to know is: how can i develop my own trading edge ?

This is where the conversation takes on a different perspective. There are only two types of edge: specific and general.

Systemic, stylistic/cyclical edges are specific. They focus on a particular edge over the rest of the competition.
“Stock pickers” focus on getting this or that particular stock “right”. This is extremely specific.
General edge on the other hand is about making sure the above formula has a positive sign before the number.

The reason why CTAs have a sustainable replicable edge is not because they pick better stocks. They are not trying to be right on their view about lean hogs or German bunds. They trade the same asset class across various markets. That asset class is called risk. It has a number attached to it.

They can maintain a sustainable edge not because they try to be specifically right, but because they choose to remain generally right.

In other words, this is outcome versus process thinking.
Process can be formalised and quantified. As the great motivational speaker Jack Welch used to say: everything that can be quantified can be improved.

D. How to improve your edge ?
“He who controls the past controls the future”, 1984 George Orwell

Very few market participants have the courage to keep an honest record of their past trades. We are our trading history.
For example, my trading history is part of my every day position sizing. How i size my positions today is conditioned by how well past trades have performed. If they perform poorly, then I should trade smaller so as to preserve both financial and emotional capital.

1 Know your style
The first is to build a P&L distribution of your trades and find your style. There are only two types. Please look at my blog about mean reversion and trend following. Know and understand your style.

2. Know when your style stops working
It is great to be the best figure skater, but August tends to be a bit dull.
The simplest way to improve your edge is to limit drawdowns when your style goes out of favor.
Remember this very simple truth: profits look big only to the extent that losses are kept small. hardly rocket surgery, isn’t it ?

3. Restore normal risk when your style is in favor
This one goes against mainstream that encourages You to take risk when it works. The problem with this is how much is enough ?
Kahneman says we suffer from chronic overconfidence. That means we take too much risk and then get humbled.
So, my suggestion is not to take on more risk when it works. My suggestion is to take less risk when it does not.

Conclusion
Long answer, but prosecco was good this evening

People talk about an edge in trading yet never want to discuss what their edge is. Can you give an example of an edge that no longer work…

Sharpe ratio: the right mathematical answer to the wrong question

Andrew Swanscott runs the podcast Better System Trader. This is great resource: fantastic interviews with real-life practitioners.

http://bettersystemtrader.com/032-laurent-bernut/. I made a statement that attracted a few comments from listeners: Sharpe ratio is the right mathematical answer to the wrong question. Here is the answer as Andrew kindly re-posted on his website.

Sharpe was the right answer

First, let’s start with what Sharpe does well. There are two things it does well:

  1. Cross-asset unified measure: we all know that the most important component in alpha generation is asset allocation. Now, the difficulty is to have a single measure of risk adjusted measure of alpha. This is where Sharpe did the job. It could give a single number across many asset classes: be it fixed income, equities, commodities etc.
  2. Uncertainty: the human brain is hard wired to associate uncertainty with risk. It triggers the amygdala and activates the fight, flight or freeze reflex (see one of my posts about fear and greed). So, Sharpe is a good measure of uncertainty: it quantifies units of uncertainty adjusted performance.

Now, Sharpe ratio, as part of the modern finance package, was invented the same year of the coronation of the Queen of England. It was good, almost revolutionary for its time, since Batista in Cuba was fighting El Che and Fidel. But, like the UN building designed by Brasilian Oscar Niemeyer, it did not age well, and here is why:

Sharpe is not a measure of risk, it is a measure of volatility adjusted performance

Sharpe equates volatility with risk. Risk does not equate volatility and here are a few examples:

  1. Low vol may be extremely risky: LTCM had low vol. In fact, their strategy was to be short gamma. It worked until it did not. Fast forward 2008, vol funds collapsed one after the other. Low vol does not equate risk.  As the great American philosopher Yogi Berra reminded us: “in theory, theory and practice are the same. In practice, they aren’t”. In theory, CDOs and CDs were AAA, low vol high yield products.In practice, they weren’t
  2. CTAs like Ed Seykota, Tom Basso, Bill Dunn, William Eckhardt etc: they have supposedly hopelessly low Sharpe but have clocked >+25% year in year out.

Does it mean that the CTAs have risky strategies ? No, it means they have low semi-volatility adjusted strategies. Semi-vol is just downside volatility.

Volatility means uncertainty, just learn to get comfortable with it

As much as uncertainty is not pleasant and may trigger some reptilian alarms in our brain, we must learn to live with it. It involves mindfulness meditation, strict formalisation of strategies etc. Do not pray for an easy life, pray for the strength to endure a tough one.

Now, what is risk ?

Risk is not a small paragraph at the end of a dissertation called investment thesis. Risk is a number. The only difficulty is to find the adequate formula that goes along. There are two types of strategies: mean reversion or trend following. Please read my posts on the subject.

Risk is not difficult to quantify. It is only difficult to identify. I have come up with the common sense ratio as it recaptures both mean reversion and trend following strategies.

CSR = tail ratio * gain to pain ratio

sense ratio as it recaptures both mean reversion and trend following strategies.

CSR = tail ratio * gain to pain ratio

Please use the trading edge visualiser to find out your personality:

TradingEdgeVisualiser

Conclusion

Bottom line, we have associated risk with volatility. We have come up with a measure of volatility adjusted performance and deem it a risk measure. CSR, on the other hand, is a unified risk measure that can be used across asset classes. It measures risk according to strategy type.

Please subscribe and get some files, material and resources. This is all free so take advantage of it.

What the great Chinese philosopher Bruce Lee can teach Fund managers about mastery

Answer by Laurent Bernut: This was originally a question on QUORA: which investment method is the best ?

As the Great Chinese philosopher Bruce Lee said: “have the style of no style, be water my friend”Game of death

There are two games of trading: outer and inner game of trading

Stage 0: Dunning Kruger effect
The Dunning Kruger effect is a cognitive bias where unskilled individuals believe in their illusory superiority. It is often found in senior management of old listed companies such as Volkswagen, Kodak, Sony etc. When Bruce Lees did not know anything about Wing Tsun, he thought a punch was merely a punch. After he had internalised his craft, a punch became just a punch.
In the beginning, anyone thinks the stock market is easy. Then they lose

Stage 1: Exploration
Bruce Lee not only explored Wing Tsun, but also English boxing, karate.
At this stage, market students embark on an exploratory phase to build a syncretism of what they think is best.

Stage 2: Perfection
This is the most common mistake of all outer game centered practice. Students perfect their craft and believe their style beats any other style out there. MMA is better than Brazilian Jiu Jitsu. Kyokushinkai is more resilient among karate etc.
Still, students myopically concentrate on their microscopic universe and fail to embrace diversity. They may be outwardly good, but they are still trapped in the outer game.

Stage 3: Acceptance
Responding to a challenge from other Kung Fu teachers, Bruce Lee defeated his opponent in a  whooping 3 minutes. In doing so, he injured himself and pestered about how long it took. He then proceeded to enrich his repertoire.
This is the first stage of inner game. This is where internalization and deep learning starts.
This is the essence of the “10,000 hours”. This is where “flow state” happens. Students redefine their identity. They free themselves from the confine of the style they used to practice.

Stage 4: Mastery “Be water my friend”
At this stage, students redefine the game. They bend reality. It becomes effortless. Master traders and investors have redefined their game. They have a congruent universe governed by a simple set of rules.

So, in conclusion, there is no superior method: fundamental, quantitative, technical, HFT, etc. There is a better method for You that suits your personality. It is incumbent upon You to find your path on the markets. Believing that fundamental or technical analysis is the way to succeed, just because everyone else around is doing it, will not work. They are also struggling. A long journey on the markets begins in stillness

Which investment method is the best?

What programs are usually used to back-test trading strategies?

Answer by Laurent Bernut:

Testing a strategy is a journey. For any journey, You need the right equipment. I test everything on WealthLab then program on other platforms. Here is why

The objective of back-testing is to simulate real trading. When You trade real money, You face the following problems:

  1. Position size: You do not trade 1 share per trade. You may have sophisticated position sizing algo. Platforms offering position sizing algos in back-testing phase are few and far between: WealthLab & amiBroker. QuantConnect and Quantopian may but I have not tried
  2. Cash constraint: You strategy may generate signals but if You do not have cash to execute either a Buy Long or a Buy to Cover, it is a moot point. WLD and amiBroker
  3. Portfolio rotation: this is similar to the above point. Test may look great/poor on one security but in real life, you trade a portfolio.
  4. Slippage & commission: always set slippage at max. My settings is -0.5% one-way, that is 1% slippage + commission for a round trip
  5. Volume: only academics and efficient market believers trade on thin markets and banking holidays
  6. Borrow and uptick: structural shorts are a dime a dozen. Profitable structural shorts are the unicorns of short-selling. If You find one, capture it safely and let’s study it

The journey:
The first part of the journey is to get the signal right. This is where most people stop. They identify a signal that they test across a population of stocks one after the other. This may seem fine in theory but in practice You will rapidly come across a concept called Buying Power. If You don’t have the cash, You can’t execute. If You can’t execute, then it’s all academic. This excludes primitve versions of Matlab, MT4 and older versions of TradeStation
Math formula for that level is: Signal Validity = Win%

Second stage is when You start testing at portfolio level
You have realised that signals must be executable to be worth anything.
At this stage, You will test signals. These are where most people stop. This is the province of most sell-side quants using R or Matlab. Tradestation does not go any further. Not sure about Ninja, never tested that one
It assumes all positions are equal weight. This is primitive
math is  Win rate = Win% – Loss %
Bloomberg BTST is a rudimentary version of that

Third stage is when You start working on the real trading edge formula
Trading Edge = Win% *Avg Win% -Loss%* Avg Loss%
This is when You start to realise that size does matter in the markets, particularly when strategy fails to deliver.
At this stage, there are only two platforms which deliver: WealthLab Developer and Amibroker. Both have a comprehensive position sizing library.
Matlab can deliver but You will need to buy an additional expensive module. Matlab is an expensive guillotine, hardly suitable for neurosurgery. I do not recommend it.
WealthLab and amibroker are both C#. They both have canned strategies You can learn from and a vibrant community.

Personally WealthLab changed my life. It permanently changed the way I perceive the markets.

A word about optimisation: the masala smoothie approach
When I started working on the strategy, I, as everyone else, ventured on the side of complexity. I resorted to optimistion to find the best indicator value.

Most people, most quants, love to optimise and re-reoptimise and re-re-optimise their optimisations.
Bad news: it gives the right mathematical answer to the wrong question. Optimisation is the monosodium glutamate MSG of strategies: it gives depth and substance to poor quality food.
Work on the logic, not on the value of some hypothetical Billion Dollar idea.
Do not throw everything in hoping it will stick. Optimisers will waterboard the data until it confesses everything

PS: 100% Free Kick -A@#resource:
Andrew Swanscott interviewed me on Better System Trader.
Interview with Laurent Bernut – Better System Trader
Off line, he suggested I should offer something to his audience. Here is a tool I use daily.

The Trading Edge Visualiser User’s Manual
The way to use it to load your backtest data and look at distribution. I use this tool many times a day during strategy development.

What programs are usually used to back-test trading strategies?

The Trading Edge Visualiser User’s Manual

It is impossible to survive in the markets without an edge. Let alone being able to quantify it. How do You know if You even have an edge ?  If You want to articulate a better strategy, You need to 1) understand where your trading edge comes from, 2) quantify it and then 3) gradually improve it. Sharpe, Sortino or Treynor ratios may provide some comfort, but these are just sterile numbers. The smoothie approach of blending indicators and factors into an optimiser has never led to robust breakthroughs. Our brain remembers stories, associates images and concepts. If You can visualise your trading edge, quantify then You will be able to will be able to a better strategy.
The tool I am about to share simply changed my life. It permanently changed the way I approach markets and strategy development. It enabled me to reclassify strategies in two buckets. It then enabled me to understand the pros and cons of each. From there, it showed me the way to improve my trading edge by gradually nudging the distribution. This file is still very much part of my daily development kit. For example, in the summer of 2015 we realised there were many false positives very close to the break even line. We modified just 2 lines in the program, win rate improved by 5% points. This has enabled us to trade higher periodicity while keeping a high win rate.
The Trading Edge Visualiser tool is free. (You may be asked to reconfirm your mail-address, but it is 100% free). It is designed to be simple and intuitive. It will help You
  1. visualise your dominant trading style: mean reversion or trend following
  2. visualise and quantify your trading edge both in aggregate and at individual security level
  3. materially improve your trading edge: we posted some techniques and tips. Try them and see the results for yourself

The trading edge formula

Whatever You believe your trading edge comes from, it can be expressed in this simple formula
      Trading Edge = Win% * Avg Win – Loss% * Avg Loss
The Trading Edge Visualiser is a visual representation of the trading edge. It shows two distributions: absolute P&L and contribution. Contribution is simply P&L divided by Equity.
Green and Orange bars show Buy and Sell (Long & Short) trades. Blue and mauve bars show AVG win, AVG Loss for BUY & SELL. The middle bar is BUY & SELL Trading Edge.

Visual representations of the trading edge of the  styles

Irrespective of instruments traded, there are only two major types of strategies: mean reversion or trend following.

Mean reversion 

Gain Expectancy - Classic Mean reversion
Mean reversion strategies have a Moby Dick shape like distribution:
  1. the hump of the win rate is above the 50% hit ratio line
  2. The long left tail looks like a fin.

 

 

 Trend Following

Gain Expectancy - Classic Trend FollowingTrend following strategies have those characteristics
  1. Low win rates: between 30 to 40%. The peak of the loss rate is below the 50% line
  2. Short left tail
  3. Long right tail

 Step 1: Diagnostic

“If You don’t know who You are, the markets are a very expensive place to find out”, Adam Smith
Both Abebe Bikila, the barefoot Ethiopian marathonian, and Hussain Bolt run fast. Yet, marathonians are not good sprinters and vice versa. Similarly, we all have our own trading personality.
The story we tell ourselves about our style and what our trading history shows are two separate things. It is not uncommon to find “value” guys chasing momentum. Neither is it rare to find “momentum” guys doubling down on “cheap” stocks. The first step is to take an honest look at your dominant style. This tool is as honest as the scale in your bathroom.
Process your trading history on the Trading Edge Visualiser. Compare your distribution with the above major dominant styles: mean reversion or trend following.
 

Step 2: Understand and measure the risks associated with your dominant style

Risk is not a dissertation in an investment thesis. Risk is a number. The difficulty is to pick the formula will adequately match the risk associated with your style.
Sharpe, Treynor et al do not measure risk. They measure volatility of returns and naively assimilate volatility with risk. They may have some marginal utility for asset allocation purposes, but certainly not when it comes to quantifying risk.
Relevant risk measures:
  1. Mean reversion: The key risk measure for mean reversion strategies is the Tail Ratio. Tail ratios of 0.3 and below present severe risk of blow-ups. For example, some strategies may clock +0.5% every month, but have a sudden -4% drawdown. This would take 8 months to recover, which is probably beyond the patience threshold of many investors.
  2. Trend following: The key risk measure for trend following strategies is the Gain to Pain Ratio: trend following strategies have low win rates. For example, if You allow each loser to dent your capital by -1%, assuming a 40% win rate, winners will have to average +1.5% just to break even.
Common Sense Ratio
“Common sense is not so common these days”, Voltaire, French freedom fighter
One fine Monday morning at 9 am, I had the honour to meet Jack Schwager. I had just finished his book on risk so I was eager to show him my concocted risk measure. He murmured: “hmm, common sense”. A few days later, I showed it to my boss who cared to elaborate: “hmm, it makes good common sense”. Voila: Common Sense Ratio.
     CSR = Tail Ratio * Gain to Pain Ratio
Lose money 1 < CSR < 1 Make money
CSR is a notable improvement on the tail ratio as it will also capture aggregate profit ratio, or the ability to recover from big losses. It will recapture the inherent cyclicality of trend following strategies via mediocre GPR but high tail ratio.

Step 3: Improve your trading edge

Techniques explained below are designed to nudge the shape of your distribution. Your trading edge is the shape of your distribution. Ideally, You want something that looks like this:

  1. High win rate: not only does it feel better, but it compounds fasterGain Expectancy - Alpha Secure
  2. Long right tail: ride your winners and allow your capital to appreciate
  3. No left tail: cut your losers
  4. Symmetrical distribution on the Long & Short side: identical rules on both sides of the book

 

Mean reversion

The key to success for mean reversion strategies is to increase the tail ratio. This can be accomplished in two ways:

  1. Stop loss: a strategy without a stop loss is like a car without brakes. As a rule of thumb, a stop loss should not be further away then twice the 90th percentile of your profits. Beyond that limit, the period of recovery may be too long to be commercially acceptable
  2. Elongate your right tail: mean reversion strategies do not allow winners to fully mature. This simple technique can allow winners to develop while preserving profits. Instead of closing the entire position, close no more than 2/3 and place a trailing technical stop loss on the remainder. Do not place a valuation stop loss as it will exceed your comfort zone.
 Moral of the story:
  1. Shops do not restock on products they cannot sell; they mark down the inventory and clear it at a discount. Similarly, do not double down on losers, accept your loss and move on.
  2. “Value” investors usually sell their positions to their “momentum” colleagues, only to sigh in despair when prices subsequently double or triple. Next time, sell them a portion of your holdings and enjoy the ride with them. Worse case scenario, if it does not work, your stop loss will take you out and protect your profit.

Trend Following

Profits look big only to the extent that losses are kept small. So, all You have to do is to manage losses and profits will take care of themselves.
  1. Stop Loss is the second most important variable in your trading system, after the most volatile place on the market, that is the grey box between your left and right earlobes. Stop loss has a direct impact on three out of four components of the trading edge: Win rate, Avg Win, Loss rate. Make a habit of placing your stop loss as your enter your orders
  2. Would You allow tenants to stay rent free in a building You own ? Every time You say yes to a free loader, You say no to a good customer, so make a habit of evicting poor performers
  3. Improve your win rate: assuming average loss stays the same, any improvement in the win rate will have a material impact on the trading edge.
Real life example: i am a short seller. The short side is plagued by periodic tidal waves called short squeezes.  The Trading Edge Visualiser taught me that rather fighting them, it made more sense to use them. I wait for the short squeeze to pass and only after that do I enter at a higher level. Then, as the next short squeeze approaches, I reduce size. This clocks a small win, reduces risk and allows to weather squeezes. Once the squeeze is over, there is a fresh high probability entry point.
This habit of scaling-out and scaling-in tilts the P&L distribution to something like the distribution at the beginner of the paragraph. It combines the high win rate of mean reversion strategies but still has long right tail, short left tail.

File user’s manual

 The Trading Edge Visualiser was built using Metatrader 4 OrderLog. It can be applied to any trading history, provided You load data in the fields coloured in blue and reset the pivot table

 Data load

  • Time and Date: the information is organised in chronological order on the Table sheet
  • Ticket No: this assumes that all trades have a unique identifier
  • Symbol: The table sheet calculates the trading edge of each security in a timely manner
  • Type: Buy/Sell, this allows rapid sort
  • Buy/Sell Lots: this field is useful for multiple entries/exits
  • Profit: this is an absolute USD P&L
  • Contribution: this is a simple P&L / Contribution field. There is no currency conversion, benchmarking or modified-Dietz time-series. Relative performance calculation should take place in this field

 Pivot Table settings

  • ROW fields in Tabular Form: In the PivotTableFields: click on Field Settings: in Layout & Print table: Click on Show items in tabular form
  • ROW Fields SubTotals deactivated: In the PivotTableFields: click on Field Settings: SubTotal & Filters table, Subtotals: click None
  • PivotTable Options Totals Columns deactivated: Right-click anywhere in the PivotTable, go to Totals & Filters, uncheck Show grand totals for columns
  • Column Label: Click on Select All to allow automatic refreshing
 Useful tips:
  1. Run this analysis periodically and keep track of your evolution to receive the full benefits
  2. Truncate data: the current file looks at the entire population. Segment your trading history into blocks when your strategy performs, when it does not.
  3. Comment and annotate entries/exits. You will realise that a bit of finesse on exit will go a long way. It is useful to keep track of exits

Conclusion

People who keep track of their weight are 30% more susceptible to reach their weight loss target. The Trading Edge Visualiser tool will help You understand who You really are. It has the potential to transform your trading game, as it continues to do so for me.

It is 100% free, so download and play with it!

The four horsemen of apocalyptic position sizing used by professional investors

4 horsemenDespite picking a fair share of good stocks, it is still tough to generate some consistent serious alpha. Picking the right stocks and exiting them well tells You how often You win. How much You win, however, is a function of how much You bet. Some professional investors pay surprisingly little attention to their bet sizes. Below are four algorithm often practiced by professionals that can

  • Four popular bet sizing algorithms used by professionals that have negative gain expectancy
  • Size does matter in the markets: 1$ or 100 will have a different outcome

 

When it comes to bet sizing, there are only two sizes: either too much, either too little. As a professional short-seller, position sizing is mission critical. Successful positions shrink. Not only do they contribute less and less, but they also tilt exposures (net & net Beta). To add insult to injury, they become less noticeable. On the other hand, unsuccessful positions balloon. They immediately hurt. So, I have spent years studying the science of bet sizing. I sought to learn from other investment professionals. It eventually dawned upon me that Long biased people rarely ask themselves the same questions. For them, bet sizing does not have the same degree of urgency. Worse even, it became apparent that some position sizing algorithms had outright negative expectancy, or nasty side effects that they were never even aware of.

Aral Sea Ships

Insufficient liquidity

Horseman 1: Liquidity. If You can’t get out, You don’t own stuff. Stuff owns You
Getting into a position is like buying a boat, or a second house. You can do that any day of the week. Now, selling a boat is tough (been there, done that). It may take time to build a position in a stock. Time is an expensive luxury few market participants can afford when they want to liquidate.So, no matter how attractive a story may be, if you can’t exit easily, just don’t enter.

Rule 1: don’t size your positions so that they may go Hotel California on You:
“You can check-out anytime You like, but You can never leave!”, Don Henley, Hotel California

 

 

Bernie-Madoff-mugshot

Example of long conviction

Horseman 2: High conviction: feel-good position sizing
Disclaimer: this position sizing is used by the greatest and the worst investors. The classic rationale is: “if You believe in something, then you should go big or go home”. What else is it but a feel good position sizing algorithm ? Risk is not quantified but subjectively assessed. The problem is mental accounting, or the constant emotional revisionism of the situation. Jack Welch said: “what can be measured can be improved”. If You can’t quantify your risk, then don’t expect improvement in consistent alpha generation capability.

The greatest investors also use conviction as a position sizing algorithm. The only difference is that they express conviction in units of risk. They quantify risk first and then put chips on the table according to their perception of the reward. If an idea does not pan out, risk can be parred down.

 

Horseman 3: Equal size: one-size-fits-all and the volatility roller coaster
This position sizing algorithm will not bring ruin, but it has negative side-effects that may prevent You from achieving your obejctives in terms of performance, attractiveness to investors and quality of life…

Equal weight is a form of laziness:
First, let’s look at the math behind equal weight. All trading systems boil down to their trading edge (Avg Win% * Win% – Avg Loss% *|Loss%|). Since all bets are equal, equal weight implicitly puts emphasis on the signal, and excludes the value of money management. In other words, stock picking has to be consistently above 50% to absorb losses and generate a profit. Unfortunately, no system works all the time. So, equal weight carries cyclicality in performance.

Ignoring volatility at the position sizing level invites volatility in the portfolio
Not all stocks have the same personality. Some are more volatile than others. For example, internet stocks tend to be much more turbulent than utilities. If all positions are sized equally, then the most volatile stocks will drive the volatility of the overall portfolio. Morality, ignoring volatility at the position sizing level will in turn invite volatility in the portfolio.

Horseman 4: Average down, martingale and the certainty of ruin
Rookie gamblers always come up with some elaborate scheme to break the casino. It is usually a variation on the theme of doubling down after each loss. They believe that the losing streak will end and they will recoup their losses. This position sizing algorithm is known as martingale. Let’s look at the math behind this algorithm

1. Adding to a losing position reduces the hit ratio
2. even if You had infinite capital, the most favourable outcome would be break-even. First, do You have infinite capital ? Second, any other outcome before the most favourable one carries an interesting probabilistic property called certainty of ruin
3. Doubling down means adding to losers. Resources have to come from somewhere, probably winning trades. Books written by successful market participants always emphasize “cut losers, ride winners”. Do You know any successful market guru who says “cut your winners, ride your losers ?”

In conclusion, there is a reason casinos have gold, marble, paintings from masters and gamblers declare bankruptcy. Double down on losers and You will go broke. One more thing about probabilities, it’s not about if, it’s about when.

Conclusion
Size does matter in the markets. Not paying enough attention to position sizing has consequences that range from unpleasant volatility to certainty of ruin. Position sizing is not a glamorous topic, but in highly competitive sport, every little bit of edge counts

A powerful two step process to deal with the endowment effect: The game of two thirds, or how to deal with free loaders in your portfolio

Would You allow tenants to stay rent-free ?

Would You allow tenants to stay rent-free ?

If You were the owner of an apartment building, would You allow tenants to stay rent-free forever ? You would probably do everything in your power to either collect or evict free loaders. In the investment realm however, one of the main reasons managers fail to accomplish their goals is that they allow free-loaders to stay rent-free in their portfolios. The difficulty then is how to identify and deal with free loaders.

They don’t really stand out enough on an individual basis. Yet, as an aggregate free-loaders put a drag on performance.

  • Endowment effect: once in the portfolio positions are sticky.
  • How to identify and effectively deal with free loaders
  • The 3 main benefits of the game of two thirds
Once upon a time, i used to place thematic small positions across the portfolio like pawns on a chessboard. They were supposedly hedges for China, precious metals, oil, monetary intervention etc. They were all tiny positions that were supposed to kick in if any of these themes were to gain traction. Six months went by and I could not understand why performance was so pedestrian. Meanwhile, none of those stocks had worked. Then, it dawned upon me that even though they were tiny individual positions, they totaled 10% of the portfolio as an aggregate.
The endowment effect (Thaler 1980)
Endowment effect is the hypothesis that people value more what they own than what they could buy. It is hard for positions to dribble their way into our portfolios, but once in they become sticky. It is difficult to get rid of them, even though they do not contribute. Some managers would hold on to losers just because they do not know what to buy next.
Our lives, our desks, our houses are filled with clutter. Unless we actively create and enforce rules to get rid of it, clutter creeps up on us. Our inner saboteur will always find good reasons to hoard junk. To illustrate its potency, let’s look at a simple example: in your wardrobe, isolate the clothes You have not worn for over a year. Think about all the excuses to keep them, but then ask yourself: “If i did not have it, would i buy it now ?” If not, then bye bye, fashion moves on and so should You.
The game of two thirds: A simple two-step process to deal with free loaders
Free loaders neither detract nor contribute enough to be visible. They don’t stand out enough to be dealt with. Since it is not possible to deal with them on the y-axis (price), the solution is to introduce time x-axis. Rationale is simple, if stocks have been there for some time, but still fail to contribute, then their weight should be reduced.
  1. Calculate portfolio turnover, divide it by three: first 1/3. Add 1/3 turnover to the entry date of each position. For example, a stock entered on January 5th and a turnover of 1 would yield a cut-off date of April 5th
  2. Divide performance in 4 quartiles, concentrate on the third quartile: second 1/3. For all stocks in the third quartile past their anniversary date, cut weight in half
 Special mention for long-term winners
Apple (AAPL) or Softbank (9984:JT) are long-term winners. They sometimes go through extended periods of under-performance. Because there is so much embedded profit, it is difficult to realise that they have not contributed for some time. The idea then is to reset contribution on a rolling basis.
The idea then is to apply the same rules as above on a rolling basis. Instead of cutting positions to half, taking a portion the size of the out-performance from the previous haircut. For example, if Apple went up by 10% from previous haircut, then shave 10% off the current size.
The rationale is
  1. if it starts to underperform, it will be dealt with, and this profit taking will have cushioned the blow. This demonstrates stewardship
  2. If it continues to go nowehere, resources are re-allocated to a potentially more productive asset. If non-performance persists over 2/3 of portfolio turnover, then a more drastic reduction is in order
  3. if outperformance resumes, then it will be dealt with
It is important to periodically reset contribution. When stocks have been in the portfolio for a long time and substantially contributed, we become attached. Failure to reset contribution is one of the reasons why some managers escort their positions on the way up and then all the way back down. It doesn’t show until it is too late.
The three benefits of the game of two thirds

The game of two thirds may appear simplistic. It has however powerful psychological implications. It is a simple, powerful and objective way to short-circuit the endowment effect for three reasons:

  1. Simplicity: math is beyond dispute. Simple rules are elegant, easier to implement and harder to challenge
  2. Stewardship: great investors are not smarter, they have smarter trading habits. Getting rid free loaders builds the habit of dealing with difficult stocks
  3. The quality of our excuses determines the quality of our performance: one of the most frequent excuses is “what do i buy next ?” Constant re-examination of positions forces managers into action.
Discussion
Once in a portfolio, positions are often sticky. Asking ourselves “would you buy it again today ?” is too subjective to deal with positions that have overstayed their welcome. Our inner saboteur will find good reasons to procrastinate until the next review. Our natural instinct to hoard junk “endowment effect”. The game of two thirds is an elegant way to identify and deal with free loaders.

 

The game of two halves: an elegant two-step process designed to cut losers, run winners, while maintaining conviction

In every hospital around the world, there is an unwritten rule: surgeons should not operate on their own children. There is no such thing as professional detachment when it comes to your own child. In the investment realm however, market participants are consistently asked to defend their convictions, but also expected to be surgical about their losers. How can someone maintain enough attachment to weather rough times, but stay detached enough to surgically cut when necessary ?

“Cut your losers, run your winners” is the key to survival in the markets, but no-one tells You how to pick the lock. This is especially difficult if You are a fundamentalist (fundamental analyst/manager/investor/trader). First, there is no price mechanism like a stop loss to tell You it’s time to move on. Second, You don’t want to be perceived as lacking conviction. Third, investors want You to manage risk. No wonder 80% of managers find it difficult to outperform every year.
This is the second article in a series of four about exits and affective neurosciences. Our central premise is that the quality of exits will determine the quality of performance. The purpose of this exercise is to help fundamentalists cut their losers, run their winners, while keeping conviction. It is based on the assumption that they are refractory to the idea of a stop loss policy. It is a simple yet powerful method that is guaranteed to mechanically lift performance.
You do not need to be right 51% in order to make money
One of the classic myth is that “You will make money as long as You are right 51% of the time”. Wrong. You will make money only if You have a trading edge:
                     Trading edge = Average Win% * Win% – |Average Loss%| * Loss %
Let’s take an easy example: if average profit is twice as big as average loss, what would be the break-even hit ratio ?
          0  = 2 * X – 1 *(1-X)
          X     = 1/3
with X = Win% and Loss% = 1- Win%
In a system with a 2/1 profit/loss ratio, you only need to be right 1/3 of the time. In other words, stock pickers who identify 3-5 baggers only need to keep losers small to make formidable gains
In reality, the visual representation of a stock picker’s P&L distribution looks very much like the chart below: a few princes make up for a lot of frogs. . Being right 51% of the time through the entire bull/bear cycle is the unicorn of stock picking. Every strategy experiences a drawdown at some point. Stock pickers make money as long as they stay disciplined and keep their losses small.
 Gain Expectancy - Classic Trend Following
 In order to move to the distribution shown below,  one of two things need to happen:
  1. Either reduce the number of frogs: easier said than done, particularly when strategies stop working at some point through the cycle
  2. or, their impact is reduced: reducing drag will mechanically improve profitability
 Gain Expectancy - Alpha Secure
Predicting tomorrow’s winners is much harder than dealing with today’s losses. The game outlined below is an elegant way to deal with losers. Not only does it mechanically improve the trading edge, it also salvages ego and rewires neural pathways from outcome to process orientation.
The game of 2 halves
The objective is to halve the weight of losers once they detract more than half average contribution. Proceeds are then re-allocated to either fresh ideas or winners. This is a simple two-step process:
  1. Divide all positions between contributors and detractors, calculate average contribution: first half
  2. Reduce weight by half (1/2) for all detractors below -1/2*Average contribution: second half
Example:
Average contribution: +0.5%          Babylon Ltd weight: 4%  Unrealised P&L: -0.4%     Realised P&L: 0%
After weight reduction                      Babylon Ltd weight: 2%   Unrealised P&L: -0.2%     Realised P&L: -0.2%
Now two things will happen: either Babylon Ltd will perish, or it will rise
  1. If Babylon meets a tragically eponymous fate : it would have to drop another -15%, just to reach minus average contribution, or -0.5%. At this point, it will be either it is a screaming Buy or a dog. Either way, it will be an easier decision to make
  2. If Babylon rises: then unrealised profits will compensate for realised losses. One rule of thumb in order to maintain a positive trading edge, do not add to the position until it crosses previous entry price
The additional 2% freed-up can be re-allocated either to winners or fresh ideas. Adding to winners cements conviction. Adding fresh ideas brings fresh blood to the portfolio. Either way, it is more of a good thing.
Special mention for managers who use an equal weight position sizing: Equal weight position has many drawbacks, but it has one benefit in this case. Instead of using contribution (weight * return), a simple distribution of return is sufficient.
The game of two halves has three deep benefits
  1. Trading edge mechanically improves: this is a simple elegant formulation of the first mantra: “cuts your losers and ride your winners”
  2. Good stewardship: managers are often torn between defending their convictions and dealing with problems. If they cut too frequently, they are perceived as lacking conviction, which negatively impacts investors confidence. By selling a portion of the position, they show peers and investors that they both maintain their conviction and deal with problems
  3. Process versus outcome neural pathways re-wiring: funds reach capacity not when they are too big in size, but when inertia sets in. Dealing with losers forces managers into action. This accomplishes three things:
    1. Managers become dispassionate with their problem children: since dealing with them improves stewardship, the stigma of taking a loss disappears. The game is simple enough to be executed even in the darkest
    2. Increased fluidity: since proceeds are re-invested, managers have a direct incentive to look for fresh ideas, or to their existing ones
    3. Process versus outcome mindset: believing that being right about a stock is a matter of profitability is an outcome process. When ideas are profitable, ego gets validation. When (not if) they are unprofitable, ego feels under attack. This invariably leads to defensive, unprofitable and often destructive behaviors. Dealing with losers in an orderly fashion changes focus from outcome to process. Being right is no longer about the outcome but about doing the right thing.
Conclusion
The game of two halves is a key to unlock the “Cut losers and ride winners” fortress. It is an elegant solution to the oldest problem in fundamental investment. It reconciles the demand for conviction with the need for action. The privilege of its (mathematical) simplicity is that it imposes itself even in the darkest times.
More importantly, it changes the definition of being right. It is not a binary outcome on the profitability of individual ideas., It is the observance of a process that will lead to higher aggregate profitability. In the Jungian archetypes, it no longer triggers the orphan (amygdala in the limbic brain, responsible for fight, fight or freeze), but activates the ruler (pre-frontal cortex or thinking brain). In short, the game of two halves reduces stress and improves profitability.