This is the first of a series of articles written by Mario Cesolini for Unger Academy. Mario is a trader specialized in the conception, coding and development of trading systems, always looking for the perfect algorithm. The search for new strategies never stops. There are times when everything is hectic and times when everything goes in slow motion.
Often the best strategies are very simple. It is very rare for the system’s engine to reach high levels of complexity.
In these series of articles I would like to show readers how a strategy based on an indicator can not only be capable of good performance but can also form the basis for building a credible trading system battery.
During our journey we will face two stubborn enemies:
- Our expectations, which are often too high;
- Overfitting, that is the excessive optimization of the system inputs on the data of the past which, inevitably, leads to negative results in the out of sample phase.
Each of these two factors is able to blow up our trading plan. We will be forced to accept compromises to limit possible negative effects.
RELATIVE STRENGTH INDEX
Do all of you know the RSI? I really hope so. For those of you who are further back, however, it is right to spend two words on it. The RSI is a momentum indicator (like the momentum, the rate of change, …) devised by John Weller Wilder who in 1978 unveiled it to the world with his book New Concepts in Technical Trading System. To calculate it, Wilder considered a certain number of daily bars and calculated the average of the increases and the average of the rebates. What advantages does it offer compared to other indicators like the ROC (last closed split closure of x bars ago)? It offers several: it ranges between values 0 and 100 (with the consequent possibility of identifying areas of overbought and oversold) and gives us more precious information. As an example, let’s imagine that today the value of a security is the same as 14 days ago and that there were 12 days slightly bearish and 2 very positive. In this case the ROC would have returned a value of 0 (neutral market) while the RSI would have been able to tell us that the bullish impulses were much stronger than the bearish ones.
The SPY ETF is represented above with the RSI indicator calculated with 14 surveys and with the classic overbought and oversold areas identified by the values 30 and 70.
Let’s put our indicator to the test! What would happen if we bought the SPY (ETF of the SP500 index) every time the indicator goes into an oversold area (<30) and then operates short each time it reaches the overbought area (>70).
The results do not seem at all positive but it is not all so dim: the analysis of the performance report clearly shows a strong incongruity between long and short trades.
By isolating the two operations, the difference in behavior is evident. The long operation returns a profit factor of 2.63 against a 0.15 of the short ones.
Detailed equity line of a long trades
Detailed equity line of a short trades
How can all this be explained? With the analysis of the nature of the US stock market: mean reverting and characterized by a very strong bullish bias.
SP500 Index, monthly chart, January 1993 – July 2018. The bullish bias is evident.
DECISION # 1: WE LIMIT THE OPERATION ONLY TO LONG TRADES
Let’s take another step. Why use the value 14 as the length of the indicator? Its creator has chosen this value that is consistent with medium-term operations. However, in our case, we have not yet chosen the time horizon with which to operate.
We must study what happens using values other than 14. In this regard, an explanation is necessary: we will use the optimization exclusively as an analysis tool.
Let’s see what would happen.
The histograms shown above indicate output values (net profit). We have extremely positive news: all values return positive output. Are we moving in the right direction? We note then that when the input value decreases we get better results. We choose to use the value 2. We will no longer change this parameter.
DECISION # 2: WE USE A 2-PERIOD RSI
Let’s take a look at the equity line and an extract from the performance report of the operating system (only in the long direction) using the 2-period RSI, the oversold 30 area to open new positions and the overbought 70 area for close them.
RSI2 Equity line
Tradestation Performance Summary
What do we like most of all? For now the high percentage of favorable operations (72.82%) and the profit factor (1.79). The equity line is positive but not perfect. In this regard, we recall that we are in the first phase of development and that we are simulating operations without risk management (stop loss, take profit, …).
Before closing this first article, I consider it useful to take a look at Buy and Hold operations: buying the ETF on the first day of analysis and keeping it in the portfolio until the last day of the collection of data. We have already mentioned the strong bullish bias of the SP500 index, we expect positive results.
Our system, in this first phase of development, boasts a net profit of 221.10% compared to 520.94% of Buy and Hold. However, we must consider that the latter has experienced an unbearable drawdown of 76.69%, economically and psychologically, for the vast majority of traders.
In the next article we will continue the development of our strategy, I will not say anything in advance.