In the S&C September 2020 article “Tracking Relative Strength In Four Dimensions”, James Garofallou presents a metric for evaluating a security’s strength relative to 11 major market sectors and over several time periods. All this information is squeezed into a single value. Maybe at cost of losing other important information? In this article we’ll look into how to program such a beast, and how it fares when we use it for rebalancing a stock portfolio. Continue reading “Petra on Programming: Four Dimensions of Strength”
Vitali Apirine, inventor of the OBVM indicator, presented another new tool for believers in technical analysis. His new Compare Price Momentum Oscillator (CPMO), described in the Stocks & Commodities August 2020 issue, is based on the Price Momentum Oscillator (PMO) by Carl Swenlin. Yet another indicator with an impressive name. But has it any use? Let’s find out.
Cumulative indicators, such as the EMA or the MACD, are affected by a theoretically infinite history of candles. But backtest periods are finite, so these indicators return slightly different results depending on the tested period. This effect is often assumed negligible. John Ehlers demonstrated in his July S&C article that it is not so. At least not for some indicators, such as a narrow bandpass filter. We have to truncate the indicator’s ‘internal history’ for getting consistent results. How do we do that in C? Continue reading “Petra on Programming: Truncated Indicators”
The previous article dealt with indicators based on correlation with a trend line. This time we’ll look into another correlation-based indicator by John Ehlers. The new Correlation Cycle indicator (CCY) measures the price curve correlation with a sine wave. This works surprisingly well – not for generating trade signals, but for a different purpose.
This months project is a new indicator by John Ehlers, first published in the S&C May 2020 issue. Ehlers had a unique idea for early detecting trend in a price curve. No smoothing, no moving average, but something entirely different. Lets see if this new indicator can rule them all.
In his article in the S&C April 2020 issue, Vitali Apirine proposed a modified On Balance Volume indicator (OBVM). The hope was that OBVM crossovers and divergences make great trade signals, especially for stock indices. I got the job to put that to the test.
Would you like to read – from begin to end – a 18 page pounderous law draft titled “Law for introducing a duty to report cross-border tax structuring”? The members of the German Bundestag apparently didn’t. After all, nothing seemed wrong with a duty to report cum-ex schemes. So the new law, proposed by finance minister Olaf Scholz, passed legislation on December 12, 2019 without much discussion. Only afterwards its real content, hidden on page 15, became public. It caused incredulity and turmoil among traders and investors. This article deals with the upcoming bizarre ‘trader tax’, and with ways to step around it. Continue reading “The Scholz Brake: Fixing Germany’s New 1000% Trader Tax”
I was recently hired to code a series of indicators based on monthly articles in the Stocks & Commodities magazine, and to write here about the details of indicator programming. Looking through the magazine, I found many articles useful, some a bit weird, some a bit on the esoteric side. So I hope I won’t have to code Elliott waves or harmonic figures one day. But this first one is a very rational indicator invented by a famous algo trader.
We can see thinking machines taking over more and more human tasks, such as car driving, Go playing, or financial trading. But sometimes it’s the other way around: humans take over jobs supposedly assigned to thinking machines. Such a job is commonly referred to as a Mechanical Turk in reminiscence to Kempelen’s famous chess machine from 1768. In our case, a Mechanical Turk is an automated trading algorithm based on human intelligence. Continue reading “The Mechanical Turk”
Since December 2017, bitcoins can not only be traded at more or less dubious exchanges, but also as futures at the CME and CBOE. And already several trading systems popped up for bitcoin and other cryptocurrencies. None of them can claim big success, with one exception. There is a very simple strategy that easily surpasses all other bitcoin systems and probably also all known historical trading systems. Its name: Buy and Hold. In the light of the extreme success of that particular bitcoin strategy, do we really need any other trading system for cryptos? Continue reading “Deep Learning Systems for Bitcoin 1”
In this article we’ll look into a real options trading strategy, like the strategies that we code for clients. This one however is based on a system from a trading book. As mentioned before, options trading books often contain systems that really work – which can not be said about day trading or forex trading books. The system examined here is indeed able to produce profits. Which is not surprising, since it apparently never loses. But it is also obvious that its author has never backtested it. Continue reading “Algorithmic Options Trading 3”
Compared with machine learning or signal processing algorithms of conventional trading strategies, High Frequency Trading systems can be surprisingly simple. They need not attempt to predict future prices. They know the future prices already. Or rather, they know the prices that lie in the future for other, slower market participants. Recently we got some contracts for simulating HFT systems in order to determine their potential profit and maximum latency. This article is about testing HFT systems the hacker’s way. Continue reading “Hacking a HFT system”
In this second part of the Algorithmic Options trading series we’ll look more closely into option returns. Especially into combining different option types for getting user-tailored profit and risk curves. Option traders know combinations with funny names like “Iron Condor” or “Butterfly”, but you’re not limited to them. With some tricks you can create artificial financial instruments of any desired property – for instance “Binary Options” with more than 100% payout factor. Continue reading “Algorithmic Options Trading 2”
Just a quick post in the light of a very recent event. Users of financial functions of R, MatLab, Python, or Zorro got a bad surprise in the last days. Scripts and programs based on historical price data suddenly didn’t work anymore. And our favorite free historical price data provider, Yahoo, now responds on any access to their API in this way:
Despite the many interesting features of options, private traders rarely take advantage of them (of course I’m talking here of serious options, not binary options). Maybe options are unpopular due to their reputation of being complex. Or because they are unsupported by most trading software tools. Or due to the price tags of the few tools that support them and of the historical data that you need for algorithmic trading. Whatever – we recently did several programming contracts for options trading systems, and I was surprised that even simple systems seemed to produce relatively consistent profit. Especially selling options appears more lucrative than trading ‘conventional’ instruments. This article is the first one of a mini-series about earning money with algorithmic options trading. Continue reading “Algorithmic Options Trading 1”
It’s time for the 5th and final part of the Build Better Strategies series. In part 3 we’ve discussed the development process of a model-based system, and consequently we’ll conclude the series with developing a data-mining system. The principles of data mining and machine learning have been the topic of part 4. For our short-term trading example we’ll use a deep learning algorithm, a stacked autoencoder, but it will work in the same way with many other machine learning algorithms. With today’s software tools, only about 20 lines of code are needed for a machine learning strategy. I’ll try to explain all steps in detail. Continue reading “Better Strategies 5: A Short-Term Machine Learning System”
Most trading systems are of the get-rich-quick type. They exploit temporary market inefficiencies and aim for annual returns in the 100% area. They require regular supervision and adaption to market conditions, and still have a limited lifetime. Their expiration is often accompanied by large losses. But what if you’ve nevertheless collected some handsome gains, and now want to park them in a more safe haven? Put the money under the pillow? Take it into the bank? Give it to a hedge funds? Obviously, all that goes against an algo trader’s honor code. Here’s an alternative. Continue reading “Get Rich Slowly”
We’re recently getting more and more contracts for coding binary option strategies. Which gives us a slightly bad conscience, since those options are widely understood as a scheme to separate naive traders from their money. And their brokers make indeed no good impression at first look. Some are regulated in Cyprus under a fake address, others are not regulated at all. They spread fabricated stories about huge profits with robots or EAs. They are said to manipulate their price curves for preventing you from winning. And if you still do, some refuse to pay out, and eventually disappear without a trace (but with your money). That’s the stories you hear about binary options brokers. Are binary options nothing but scam? Or do they offer a hidden opportunity that even their brokers are often not aware of? Continue reading “Binary Options: Scam or Opportunity?”
Deep Blue was the first computer that won a chess world championship. That was 1996, and it took 20 years until another program, AlphaGo, could defeat the best human Go player. Deep Blue was a model based system with hardwired chess rules. AlphaGo is a data-mining system, a deep neural network trained with thousands of Go games. Not improved hardware, but a breakthrough in software was essential for the step from beating top Chess players to beating top Go players.
In this 4th part of the mini-series we’ll look into the data mining approach for developing trading strategies. This method does not care about market mechanisms. It just scans price curves or other data sources for predictive patterns. Machine learning or “Artificial Intelligence” is not always involved in data-mining strategies. In fact the most popular – and surprisingly profitable – data mining method works without any fancy neural networks or support vector machines. Continue reading “Better Strategies 4: Machine Learning”
This is the third part of the Build Better Strategies series. In the previous part we’ve discussed the 10 most-exploited market inefficiencies and gave some examples of their trading strategies. In this part we’ll analyze the general process of developing a model-based trading system. As almost anything, you can do trading strategies in (at least) two different ways: There’s the ideal way, and there’s the real way. We begin with the ideal development process, broken down to 10 steps. Continue reading “Build Better Strategies! Part 3: The Development Process”
Whatever software we’re using for automated trading: We all need some broker connection for the algorithm to receive price quotes and place trades. Seemingly a simple task. And almost any broker supports it through a protocol such as FIX, through an automated platform such as MT4™, or through a specific broker API. But if you think you can quickly hook up your trading software to a broker API, you’re up for a bad surprise. Dear brokers – please read this post and try to make hacker’s and coder’s lifes a little easier! Continue reading “Dear Brokers…”
Trading systems come in two flavors: model-based and data-mining. This article deals with model based strategies. Even when the basic algorithms are not complex, properly developing them has its difficulties and pitfalls (otherwise anyone would be doing it). A significant market inefficiency gives a system only a relatively small edge. Any little mistake can turn a winning strategy into a losing one. And you will not necessarily notice this in the backtest. Continue reading “Build Better Strategies! Part 2: Model-Based Systems”
The more data you use for testing or training your strategy, the less bias will affect the test result and the more accurate will be the training. The problem: price data is always in short supply. Even shorter when you must put aside some part for out-of-sample tests. Extending the test or training period far into the past is not always a solution. The markets of the 1990s or 1980s were very different from today, so their price data can cause misleading results.
In this article I’ll describe a simple method to produce more trades for testing, training, and optimizing from the same amount of price data. The method is tested with a price action system based on data mining price patterns. Continue reading “Better Tests with Oversampling”
Enough blog posts, papers, and books deal with how to properly optimize and test trading systems. But there is little information about how to get to such a system in the first place. The described strategies often seem to have appeared out of thin air. Does a trading system require some sort of epiphany? Or is there a systematic approach to developing it?
This post is the first of a small series in which I’ll attempt a methodical way to build trading strategies. The first part deals with the two main methods of strategy development, with market hypotheses and with a Swiss Franc case study. Continue reading “Build Better Strategies!”
You’ve developed a new trading system. All tests produced impressive results. So you started it live. And are down by $2000 after 2 months. Or you have a strategy that worked for 2 years, but revently went into a seemingly endless drawdown. Situations are all too familiar to any algo trader. What now? Carry on in cold blood, or pull the brakes in panic?
Several reasons can cause a strategy to lose money right from the start. It can be already expired since the market inefficiency disappeared. Or the system is worthless and the test falsified by some bias that survived all reality checks. Or it’s a normal drawdown that you just have to sit out. In this article I propose an algorithm for deciding very early whether or not to abandon a system in such a situation. Continue reading “The Cold Blood Index”
You’re a trader with serious ambitions to use algorithmic methods. You already have an idea to be converted to an algorithm. The problem: You do not know to read or write code. So you hire a contract coder. A guy who’s paid for delivering a script that you can drop in your MT4, Ninja, TradeStation, or Zorro platform. Congratulations, now you’re an algorithmic trader. Just start the script and wait for the money to roll in. – Does this really work? Answer: it depends. Continue reading “I Hired a Contract Coder”
Clients often ask for strategies that trade on very short time frames. Some are possibly inspired by “I just made $2000 in 5 minutes” stories on trader forums. Others have heard of High Frequency Trading: the higher the frequency, the better must be the trading! The Zorro developers had been pestered for years until they finally implemented tick histories and millisecond time frames. Totally useless features? Or has short term algo trading indeed some quantifiable advantages? An experiment for looking into that matter produced a surprising result. Continue reading “Is “Scalping” Irrational?”
For performing our financial hacking experiments (and for earning the financial fruits of our labor) we need some software machinery for research, testing, training, and live trading financial algorithms. No existing software platform today is really up to all those tasks. So you have no choice but to put together your system from different software packages. Fortunately, two are normally sufficient. I’ll use Zorro and R for most articles on this blog, but will also occasionally look into other tools. Continue reading “Hacker’s Tools”
We will now repeat our experiment with the 900 trend trading strategies, but this time with trades filtered by the Market Meanness Index. In our first experiment we found many profitable strategies, some even with high profit factors, but none of them passed White’s Reality Check. So they all would probably fail in real trading in spite of their great results in the backtest. This time we hope that the MMI improves most systems by filtering out trades in non-trending market situations. Continue reading “Boosting Strategies with MMI”
This indicator can improve – sometimes even double – the profit expectancy of trend following systems. The Market Meanness Index tells whether the market is currently moving in or out of a “trending” regime. It can this way prevent losses by false signals of trend indicators. It is a purely statistical algorithm and not based on volatility, trends, or cycles of the price curve. Continue reading “The Market Meanness Index”
When I started with technical trading, I felt like entering the medieval alchemist scene. A multitude of bizarre trade methods and hundreds of technical indicators and lucky candle patterns promised glimpses into the future, if only of financial assets. I wondered – if a single one of them would really work, why would you need all the rest? And how can you foretell tomorrow’s price by drawing circles, angles, bats or butterflies on a chart? Continue reading “Seventeen Trade Methods That I Don’t Really Understand”
This is the third part of the Trend Experiment article series. We now want to evaluate if the positive results from the 900 tested trend following strategies are for real, or just caused by Data Mining Bias. But what is Data Mining Bias, after all? And what is this ominous White’s Reality Check? Continue reading “White’s Reality Check”
This is the second part of the trend experiment article series, involving 900 systems and 10 different “smoothing” or “low-lag” indicators for finding out if trend really exists and can be exploited by a simple algorithmic system. When you do such an experiment, you have normally some expectations about the outcome, such as: Continue reading “The Trend Experiment”
The most common trade method is dubbed ‘going with the trend‘. While it’s not completely clear how one can go with the trend without knowing it beforehand, most traders believe that ‘trend’ exists and can be exploited. ‘Trend’ is supposed to manifest itself in price curves as a sort of momentum or inertia that continues a price movement once it started. This inertia effect does not appear in random walk curves. Continue reading “Trend Indicators”
Contrary to popular belief, money is no material good. It is created out of nothing by banks lending it. Therefore, for each newly created lot of money there’s the same amount of debt. You’re destroying the money by repaying your credits. Since this requires a higher sum due to interest and compound interest, and since money is also permanently withdrawn from circulation by hoarding, the entire money supply must constantly grow. It must never shrink. If it still does, as in the 1930 economic crisis, loan defaults, bank crashes and bankruptcies are the result. The monetary system is therefore a classic Ponzi scheme. Continue reading “Money and How to Get It”