Our Research

The world does not need yet another market commentator. Our tools are designed to help investors along their investment journey

  • Signals: trend reversal signals (Bull/Bear) on equity indices, Forex and government bonds
  • Trading systems: simple steps from concept, back tests to auto-trade
  • Money management: bet sizing algorithms, money/risk management tools
  • Psychology: research and practical tools on habit formation
  • Topics: discussions on the industry, trends

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.