Algorithmic and Mechanical Forex Strategies | OneStepRemoved

  • Articles
  • Sophisticated Web Sites
  • Automated Trading
  • Testimonials
  • Contact

Optimizing Your Algo: Tips for Beginners

June 6, 2016 by Lior Alkalay Leave a Comment

You have created a trading algo. The Algo is profitable in the backtester. Before unleashing it with real money, you’ve got to first tighten the screws. That is, ensure your algo is fine-tuned so it can deliver optimal returns. There’s one major challenge ahead of you.

Firstly, your strategy is rather simple. You may go through the detailed process of building and optimizing a strategy, including curve fitting, correlation and so on. But you want a simpler process; something leaner, that will fit your modest needs.

Secondly, you may not yet have mastered the full technique of optimizing. You are still learning and want to try off with a simple process.

One technique I find especially simple in optimizing your algo is probability. The probability method, in essence, contains many components of a full optimization technique. However, it tends to rely more on common sense and logic to narrow the options and optimise the algo. That makes it a pretty good way to begin the entire concept of optimizing a strategy. Moreover, you will find it easier to digest.

The essence of the strategy—optimize by elimination.

Algo Case Study

The following Algo is a simple one. Let’s call it RSIMV which is RSI and Moving Average. Here is what RSIMV describes through conditioning:

If Open Positions = 0 then

If (MA(30)>MA(14)) and RSI=<60 then

                                                Open Buy (50,000) {It will buy 50 lots}

                                             Set Stop Loss = Price – 50{Pips}

                                                Set Limit= Price+ (50*2)

End

The strategy: If the moving average cross points on a bullish trend and the RSI is equal or below 60 it means that the rally has some length before reaching an oversold level (RSI above 80). That points to a good buying opportunity.

Looking at RSIMV, you can conclude there are four parameters to optimize: RSI and two Moving Averages

Starting with the Moving Averages, we will look at the 14 and the 30 days. Seemingly, the options are endless, with many combinations of moving averages to test. In theory, that is correct, but that is where probability comes in.

Algo

MT4

When we look at the chart, we can see that the longer the averages (orange and red) the lesser the chance that there is a combination of a low RSI and a bullish momentum.

Moreover, a combination of a low RSI and a bullish signal only occurs when the two averages, the fast and the slow, have more or less a 2 to 1 ratio (such as a 30 and 14).

Those two conclusions help us narrow the parameters we are looking for.

The highest likelihood of finding a better set of averages is with faster averages, not slower, and those that have a ratio of 2 to 1. And let’s not forget we already know that 14 and 30 works. So we shouldn’t move too far up the scale.

We will use 25 and 12 as the first combination and 20 and 10 for the second. Both are faster than the original parameters, have a roughly 2 to 1 ratio, and are close to the original settings.

  1. 25,12
  2. 20,10

Moving into the RSI parameter, narrowing the options is even simpler. We know the RSI cannot possibly be higher than 60, because then we will be left with insufficient upside before the pair turns oversold.

On the other hand, if we try an RSI below 40 it’s unlikely that it will occur while the moving average cross is bullish.

Since, as in the Moving Averages case we know the original setting worked, we know we only need a minor tweak. With no way to go but up we are left with two reliable options – RSI<55 and RSI<50.

Hence our options are:

  1. C) (55)
  2. D) (50)

As we can see from testing all the alternative parameters, what we needed was a better entry for the RSI. As we intended… minor tweaks.

Algo

Don’t Optimize Too Much

Ironic as it may sound, optimization sometimes has a downside. At times, we are tempted to over-optimize to such an extent that our newest strategy no longer resembles our original, pre-optimization plans. That can throw us into an eternal loop and waste precious time. Don’t be tempted! Don’t fall in love with the optimization process. After all, optimization is merely tightening the screws, not building the engine. If your strategy works, confine your optimization to minor tweaks. If it doesn’t, optimization won’t help and you’ll need to start from scratch.

And, finally, a practical tip; always keep records of the results of your original strategy and compare it to your current, post-optimization strategy. This way you can always make sure that you’ve really optimized your strategy.

The Bottom Line

Sure, the optimization technique isn’t perfect. But the take away here is that if you really understand your strategy, you can use logic to in order to find better settings. If you’re a beginner and lack the knowledge for advanced optimization techniques, optimizing through the logic of probability is a powerful tool to have.

 

Filed Under: Test your concepts historically Tagged With: moving average, optimization, RSI

What’s the Story on Lagging Indicators?

January 14, 2015 by Richard Krivo 7 Comments

Lagging Indicator

A  question that I get asked quite a bit has to do with “lagging indicators”.  Many traders will deride them and are hesitant to use them since they lag the market to a greater or lesser degree.  Their argument is that many pips can be left behind since the initial part of the move has occurred before the entry signal is generated.

While that is an accurate statement, let’s take a look at what comprises the signal that an indicator generates.  Regardless of which indicator a trader uses, RSI, MACD, Stochastics, CCI, etc., each indicator is based on an average of the price action that has already taken place.  With that being the case, it is impossible for an indicator to provide split second, turn on a dime signals based on an immediate move that a currency pair has made.

And, believe it or not, I believe that is a very good thing.

While no one likes to leave “pips on the table” so to speak, think of it this way…

What you are forgoing by missing the initial move, you make up for by entering a trade that has a greater amount of confirmation behind it.  If we are looking to enter a trade at the very first sign that a move may be taking place, we are going to find ourselves entering trades based on very short term signals – i.e., little or no confirmation.  Consequently, we will be basing our trades on what ultimately can turn out to be a “false entry” signal.

People will rarely (if ever) buy a house based solely on what it looks like from the curb…or buy a car only because the driver’s seat feels comfortable…or propose marriage to someone during a first date.  We want and deserve some confirmation that there is more to the house than only curb appeal…more to the car than just a comfy seat…and more to our partner than what we learned over a few hours.

So too, we should not jump headlong into a trade based on virtually zero confirmation.

Let’s take a look at a historical Daily chart of the EURCHF currency pair below…

Lagging Chart

If we enter this trade at the point where the MACD line (red) crosses the Signal line (blue), we forgo the profit between point A and point B on the chart – approximately 280 pips.  This is due to the “lag” of the MACD indicator as it is calculating the price action that has taken place over the last several days.  Had we entered the trade short as soon as price began to move down from the high, we would have entered on a bearish move but with virtually no confirmation – we would have bought the house without stepping inside.

However, if we wait for the signal to enter this trade until the move is confirmed by MACD, we set ourselves up for a higher probability trade based on our lagging indicator.

Could this trade turned out to be a loser even with the confirming signal?  Sure…no doubt about it.  But the point is that by waiting we are putting probabilities more on our side – we have more of an “edge” on the trade.

In the case of this particular trade, we ultimately book the profit between point B and point C which is just shy of 1000 pips.

As can be seen from this example, it is possible to have a highly successful trade even though a trader is not capturing the initial pips in a move.

All things considered, I would rather enter a trade late and be right than enter early and be wrong.

 

All the best and good trading,

Richard

 

RKrivoFX@gmail.com

@RKrivoFX

Filed Under: Trading strategy ideas Tagged With: CCI, indicator, lagging, MACD, RSI, Stochastics

Combining Indicators Through Creative Development

January 5, 2014 by Andrew Selby Leave a Comment

When quantitative traders come across indicators that seem to produce results, our first instinct is usually to build them right into our strategy as trade signals. Surprisingly, this often leads to reduced overall returns. It can often be much more advantageous to use the additional indicator as a filter, as opposed to an entry/exit signal.

combining indicators

Combining indicators doesn’t always produced the desired outcome, but through creative development, there may be a solution that does produce better results.

There is a post from Qusma that does an interesting job of illustrating this idea. The author develops an extremely simple indicator that produces very successful backtesting returns. However, when that indicator is brought into the author’s existing strategy, the overall returns plummet. The author then makes a slight adjustment, and the new indicator significantly improves the original strategy.

The CRTDR Indicator

CRTDR is just a fancy acronym that the author came up with to describe an indicator that measures where an index closes relative to its daily range. The author later added that this concept is also known as Internal Bar Strength (IBS).

The indicator is calculated by taking the difference between the close and the low of the day and dividing it be the difference between the high and the low of the day. This will return a number between 0 and 1 that is the percentage of the daily range that is represented by the close.

The author points out that while this may seem like an overly simplistic concept, it actually does a very impressive job of predicting the following day’s market action. He also has the backtesting results to back up that claim:

Backtesting Qusma’s CRTDR Indicator

The author broke the CRTDR numbers into four quartiles and then backtested the indicator on the SPY and QQQ. The results show that when either of the indices closed in the bottom half of the day’s range, the following day’s return was, on average, positive. When the indices closed in the bottom quartile, the next day’s average returns were even more impressive.

The article contains backtesting results for 35 different ETFs where a long position is taken when the CRTDR is less than 45% and a short position is taken when the CRTDR is greater than 95%. This strategy produced an average win rate approaching 60% and profit factors ranged from 1.02 to 2.19 depending on the ETF.

These results indicate that the CRTDR indicator by itself could be developed into a profitable mean reversion strategy. The author suggested that improvements like changing the number of days used in the calculation, adjusting to include overnight price changes, or creating a moving average derivative might make the CRTDR indicator even more useful.

The CRTDR Filter

The article takes an interesting twist when the author explains that he is not actually using this apparently profitable indicator. He says that he prefers the results of the mean reversion strategy he is already trading using Cutler’s RSI indicator.

The author then provides the backtesting results of a strategy that would take signals from both the CRTDR and RSI indicators. The combined strategy produces significantly lower returns than the RSI indicator did without the CRTDR addition.

While using the two indicators in tandem didn’t improve returns, using the CRTDR indicator to confirm the RSI trades did. The article contains a matrix that shows that using a CRTDR value of 50% as a filter would eliminate a portion of the RSI indicator’s losing trades. Combining the indicators in this manner produced a dramatically more profitable strategy than using the RSI by itself.

 

Filed Under: Trading strategy ideas Tagged With: combining indicators, CRTDR, RSI

Mean Reversion Strategies Are In Hibernation

October 20, 2013 by Andrew Selby Leave a Comment

Many of the trading systems I have profiled stem from the interesting books written by Larry Connors and Cesar Alvarez. Their research focuses on short term, mean reversion systems that look to take quick profits when trending markets become temporarily oversold.

Cesar Alvarez recently launched his own blog, and one of his first posts addressed the issue of whether mean reversion strategies are still valid in today’s market environment. He begins by discussing how he has a friend that continues to challenge him on the issue, demanding proof that the strategy is still profitable.

Alvarez set out to test the following theory:

My theory is that mean reversion is in hibernation waiting to come back; or said another way, mean reversion is simply mean reverting. I think that when too many people trade mean reversion, the space gets crowded and we see fewer winning trades and smaller returns. However, this has always been conjecture never backed up with numbers. Are we really seeing fewer trades? Smaller returns?

In order to test his theory, Alvarez took the top 1,000 stocks in terms of dollar-volume from the beginning of 2001 through August 30, 2013. He used a 2-period RSI value under 5 as his entry signal, and then exited when the value rose above 70. Entries and exits were all calculated by closing prices and the data set was free of survivorship bias.

mean reversion strategies

Alvarez believes that mean reversion strategies are simple in a period of hibernation.

The first question Alvarez sought to address with the data that he produced was whether fewer oversold opportunities were presenting themselves:

The blue line is the percent of stocks with RSI2 < 5 compared to all the stock for a given year.  This has hovered between 5.1% in 2009 and 8.0% in 2008. The green line is a liner regression of the data. We can see that the trend has been down since 2001 but not a lot.  The trend from 2005 to 2007 compared to the trend from 2011 to 2013 looks very similar. Is this trend because we are in the same cycle of a bull market? Is mean-reversion in hibernation? Given the trade data, I would say yes. Nothing appears out of the ordinary.

Next, Alvarez looked at whether the average profit had changed:

This chart surprised me. The blue line is the average % profit/loss of all the trades with RSI2 < 5 and the exiting when RSI2 > 70. The green line is a linear regression of the data. The last thing I expected was an up sloping linear regression line. The 2013 average % profit/loss is .94% substantially less than the 2008 and 2010 values of 1.58% and 1.57% respectively. But 2013 returns are higher than 2011 and 2012 and substantially higher than 2007’s value of .33%.

Alvarez concludes that basic mean reversion strategies are currently finding less signals than in past years, but are still quite profitable. He suggests that the strategy is just hibernating and is poised to make a strong return.

We are at the low of the number of sold off stocks per year but the average # profit/loss is the middle range. The numbers do not tell me anything is out of whack with mean reversion. Mean reversion is not dead but it looks like it is coming out of hibernation.

Filed Under: Trading strategy ideas Tagged With: alvarez, mean reversion, RSI

Jeff Swanson’s TRIN System

September 30, 2013 by Andrew Selby Leave a Comment

Early in September, Jeff Swanson from System Trader Success wrote an interesting article that completely ignores the price. He suggests that a large number of system traders focus exclusively on price based data. Since the market generally rewards those who stray from the crowd, he reasoned that it might be worthwhile to develop a system that uses a non-price based indicator.

About The System

The non-price based indicator that Jeff elected to build his system around was the Short Term Trading Index (TRIN). This is a relative strength ratio that uses the advance / decline ratio and the advancing / declining volume to produce and oscillating value. TRIN values below 1 indicate general market strength, and TRIN values above 1 indicate general market weakness.

For this system, Jeff planned to trade S&P Futures contracts and use the TRIN value for all of the NYSE stocks. He combined that indicator with the 2-period RSI and used the 200-day simple moving average (SMA) as a trend filter. The system will combine one price based indicator and one non-price based indicator to identify short-term weakness in the market during long-term uptrends.

TRIN trade

Is your trading system just another sheep in the herd? The TRIN takes a completely novel approach to trading

Trading Rules

Enter Long When:

  • Price > 200 Day SMA
  • 2-Period RSI < 50
  • TRIN closes above 1 for three consecutive days

Exit Long When:

  • 2-Period RSI > 65

Backtesting Results

Jeff backtested this strategy on the E-mini S&P Futures market from September of 1997 through September of 2013. Starting with an account of $25,000, the system produced a net profit over that time of $24,470. There were a total of 91 trades.

The system registered a profit factor of 2.2 and won on 76% of its trades. The average annual rate of return worked out to be 4.49%. As usually happens with rough system ideas, the biggest problem with Jeff’s TRIN system was the maximum drawdown, which was over $11,000 at one point.

System Analysis and Improvement

ATR Stops

Following the backtesting results, Jeff makes it a point to remind us that this is a very rough idea for a system and that its return could be improved but implementing stop-losses and money management. That is the first recommendation I make to improve just about every system we have profiled here.

This system will trade much like a lot of the short-term mean reversion systems I have profiled. It has the same open-ended loss capabilities as those systems as well. Using a simple ATR multiple stop could go a long way towards protecting profits or even just keeping losses small.

Short Component

One of the improvements Jeff makes to his TRIN system is to add a bear market component. When price is trading below the 200-day SMA, he still looks to enter long positions, he just lowers the required 2-period RSI value. This forces the system to isolate only the very best situations.

I would be interested to see how the TRIN system would perform if instead he reversed all of the entry rules and looked to short the market. In a lot of the backtesting data that I have seen, adding a short component will decrease the overall profitability of a system on a per trade basis, but it will also increase the number of trades that system is able to generate. It would be very interesting to see how that would have worked here.

Multiple Markets

Another way to improve the system would be to find a way for it to generate more trade signals. This could easily be done if it was able to trade multiple markets. However, because it uses the TRIN value of the NYSE stocks, it would not be likely to perform very well in other markets.

One way to get more exposure would be to couple the system with another system that could be traded when the equities markets are not above the 200-day SMA. Trading a simpler 2-Period RSI System on commodity or bond futures during these times would certainly increase the number of overall trades, which might improve the numbers across the board.

About the TRIN Indicator

The TRIN Indicator was developed in the 1970s by Richard Arms. It is also referred to as the Arms Index. The name TRIN is short for TRading INdex. The TRIN is calculated by dividing a group’s advance/decline ration by its advancing/declining volume.

TRIN = (advancing issues / declining issues) / (advancing volume / declining volume)

TRIN is most popularly used on the NYSE and Nasdaq because their advance/decline data is widely available. Because bull markets are generally accompanied by large volume, TRIN numbers below 1 are considered bullish. TRIN numbers above 1 are considered bearish. The further the number moves from 1, the more bullish/bearish it becomes.

Filed Under: Test your concepts historically, Trading strategy ideas Tagged With: advance decline ratio, Jeff Swanson, NYSE, relative strength, RSI, S&P, trin system

Comparing Exit Strategies for the Cumulative RSI System

September 19, 2013 by Andrew Selby Leave a Comment

This is the third post in a series covering the work Larry Connors and Cesar Alvarez have done using the 2-period RSI as an entry signal. In the first post, we discussed their evidence that shows how accurate the indicator can be in identifying short term oversold situations. Then, we reviewed how they took that entry signal and built the Cumulative RSI System around it.

In the second post, I noted that Connors and Alvarez had suggested that there were a number of different exit strategies that could be implemented. In a later chapter of their book, Short Term Trading Strategies That Work, they discussed five different types of exits and then provided data from backtesting some of those signals.

exit strategies

Five Different Types of Exit Strategies

Much like using the 2-Period RSI as an oversold indicator, many of these exit strategies go against what has become my natural preference towards long-term trend following strategies. Most long-term trend following strategies look to hold on to positions that are closing up, making new highs, and closing above their moving averages.

It is important to remember that we are looking at these strategies from a very short-term viewpoint. That explains why they can be almost exactly opposite from some of the long-term trend following strategies that I prefer and still be profitable.

Fixed Time Exit Strategies

Fixed Time Exit Strategies are exactly what the name implies. They commit to exiting a position a certain amount of time after the entry. If you recall, the average holding time for a position using the Cumulative RSI Strategy was between three and four days. Based on that, it is reasonable to assume that if a position is going to produce a positive return, it will do so sooner rather than later.

First Up Close Exit Strategies

First Up Close Exit Strategies look to exit a position on the first positive close made after a position is entered. Obviously, this only works when used with a short-term system that is looking to take quick, small profits out of the market with a very high win rate. In those situations, it can be surprisingly profitable.

New High Exit Strategies

New High Exit Strategies exit positions after they close at a new high. As I said, this concept runs counter to the long-term trend following approach, but can be very profitable in short-term situations. These strategies wouldn’t work if you were buying at new highs, but since the Cumulative RSI System looks to enter markets that have become oversold during uptrends, a bounce back up to new highs would represent a profitable situation.

Close Above the Moving Average Exit Strategies

Close Above the Moving Average Exit Strategies provide exit signals when a market closes above a specified moving average. The logic here is very similar to the New High Exit Strategies. When entering a position, an oversold market in a long-term uptrend will likely be below its moving averages, so a bounce back above those moving averages would represent a profitable trade.

2-Period RSI Exit Strategies

This is the exit strategy that was used in backtesting the Cumulative RSI System. It looks to exit a position when the 2-Period RSI closes above a certain number. Connors and Alvarez suggest values of 65, 70, or 75 for this number. The concept behind these strategies is that once the 2-Period RSI value has risen to one of those values, the market is no longer oversold and may actually have become overbought.

Backtesting These Exit Strategies

While they could have simply stopped after identifying all of these different strategies, what I like about Connors and Alarez’s work is that they went a step further and actually tested three of these strategies. In order to do that, they looked at every stock from 1995 through 2007 that traded above its 200-day moving average and had closed at a 10-day low. This provided them with 63,101 entry signals, so this was certainly not a small sample size.

Fixed Time Exit Strategies

On those entry signals, Fixed Time Exit Strategies performed the worst of the three strategies tested. However, they still performed much better than I expected. Exiting after holding for one day produced an average trade return of 0.61%. Increasing the hold time to just three days jumped that return number to 1.76%. Continuing that trend, increasing the hold time to 5 days provided a return of 1.97%, and holding the position for 7 days produced an average return of 2.05%.

Close Above the Moving Average Exit Strategies

While the Fixed Time Exit Strategies produced impressive return numbers, the exit strategies based on moving averages performed even better. Exiting on a close above the 5-day moving average produced an average return of 2.65%. Using the 10-day moving average increased the average return to 2.80%.

2-Period RSI Exit Strategies

Much like we saw with using the 2-Period RSI as an entry signal, the higher RSI values returned more profitable trades on average. Using a 2-Period RSI value of 65 produced an average return of 2.76%. Increasing the RSI value to 70 gave us an average return of 2.83%, and increasing the RSI value even higher to 75 gave us an average return of 2.93%.

Choosing an Exit Strategy

While I was not surprised that the dynamic exit strategies outperformed the Fixed Time Exit Strategies, I was surprised at how well those fixed time strategies performed to begin with. It appears that choosing an exit strategy for your system has more to do with your comfort level with a given strategy than its actual performance.

While using a value of 75 for your 2-Period RSI Exit may return a higher average profit than using a value of 65, if you lose sleep worrying about positions that don’t make it to that higher value then you might be better off using the lower value.

Filed Under: Trading strategy ideas Tagged With: Connors, exit, RSI, system

Cumulative RSI System

September 16, 2013 by Andrew Selby 13 Comments

The 2-period Relative Strength Index (RSI) can work as a short-term trade entry signal. After providing plenty of supporting evidence in their book, Short Term Trading Strategies That Work, Larry Connors and Cesar Alvarez went on to discuss a system that would make use of this powerful entry signal.

About The System

The Cumulative RSI System is built to take advantage of the power of using the 2-period RSI to identify short-term oversold conditions. The system exclusively trades the long side, targeting markets that are above their 200 day simple moving average (SMA). The goal of each trade is to identify a market that has been trending higher but is currently puling back. The RSI indicator provides the signal that the pullback has gone too far and a bounce is likely.

In order to enhance the RSI indicator, Connors and Alvarez added the cumulative element. Rather than simply taking the current RSI value, they chose to add up the RSI values of the past X number of days. For all of their testing, they used a value of 2 for X. This means that they simply added the RSI values of the most recent two closes.

They also introduced Y as a second variable that would represent the cumulative RSI value that would signal an entry. This means that, provided the long-term SMA condition was met, the system would enter a trade on the long side anytime the cumulative RSI value dropped below Y. In their testing they used values of 35 and 50 for Y. Keep in mind that this Y value is the sum of two RSI values, which means it will be larger than standard RSI values.

Once a trade is signaled, the long position is held until the 2-period RSI closes above 65. This is the standard RSI number, not the cumulative number. Connors and Alvarez actually suggest that you could use a number of different exit signals. Clearly, they do not place a great deal of importance on the exits. Since this is the one that they tested, it will be what we use for this system.

RSI system

Trading Rules

Enter Long When:
Price > 200 SMA
Cumulative 2-Period RSI for X days < Y

Exit Long When:
2-Period RSI > 65

Backtesting Data

Connors and Alvarez backtested this system using two different Y values. Both tests were conducted on the SPY from January of 1993 through December of 2007. They used a value of 2 for X in both tests.

For the first backtest, they used a Y value of 35, which would represent two closing RSI values that average to be 17.5. This test produced 50 trade signals over almost 15 years. The system was profitable on 88% of those trades and made an average of 1.26% on each trade. The average holding period for a trade was 3.7 days.

For the second backtest, they raised the Y value to 50, which represented two consecutive closes that average a 2-period RSI of 25. By raising they Y value, they were hoping to generate more trade signals without cutting down on the system’s profitability. This test generated a total of 105 trades over the same 15 year period. The system was profitable on 85.47% of those trades and made an average profit of 1.05% on each trade. This test actually had an even smaller average trade length of only 3.57 days.

Connors and Alvarez reported that they also tested the system on other indexes and ETFs and received similar results.

System Analysis

As it turns out, increasing the Y value doubled the number of trades, but had a much smaller impact on returns. It would be very interesting to test more combinations of X and Y values to see how adjusting them affects overall returns. In order for a system to be worth trading, it has to be profitable, but it also has to provide enough trade signals. There is no point trading a system that never produces trade signals, even if it has ridiculously high profitability numbers. The second test was able to produce twice the number of trades, but that still only amounted to an average of about seven trades per year.

One interesting aspect that Connors and Alvarez point out is that the second test was able to capture most of the gains of the SPY while only being in the market about 20% of the time. Because the system trades quickly and infrequently, it is possible that we could augment its returns by putting the capital to work somewhere else between trades.

Improving The System

The thing that I find most appealing about this system is its flexibility. The two variables can be used to adjust the ratio of trades to profitability. The authors themselves suggest that there are a number of exit options that could be used. Finally, trading this system would afford you the ability to do something else with your capital while the system is not in the market.

It would be very interesting to see if we could improve on the returns that Connors and Alvarez published by testing different variables, adding a hard stop-loss to protect our capital, and investing the capital in something safe like T-bills while it was not trading. Given all of those options to improve, the Cumulative RSI System is very interesting, and it is all based on a very impressive and well researched entry signal.

Filed Under: Test your concepts historically Tagged With: relative strength, RSI

Developing a System Around an RSI Entry Strategy

September 12, 2013 by Andrew Selby 4 Comments

In chapter nine of their book Short Term Trading Strategies That Work, Larry Connors and Cesar Alvarez refer to Relative Strength Index (RSI) as “The Holy Grail of Indicators.” While I don’t like the implication that there is a “Holy Grail” in trading other than hard work and studying, Connors and Alvarez to provide some interesting research to back up their claim.

Connors and Alvarez Research

The standard period that is commonly used for the RSI indicator is 14, but Connors and Alvarez argue that there is no statistical evidence that 14 is the optimal period. Their testing has revealed that a period of 2 will provide the best returns.

Connors and Alvarez set out to test their theory over the time period from January 1, 1995 through December 31, 2007. During this time, they calculated that the average stock that was above its 200 day simple moving average (SMA) gained 0.05% over a 1-day period, 0.1% over a 2-day period, and 0.25% over a 3 day period. They used these numbers as a benchmark for their 2-period RSI indicator to compete against.

Focusing on the oversold side, stocks that had an RSI below 10 were able to outperform each of the three benchmarks. They recorded returns of 0.13% over a 1-day period, 0.31% over a 2-day period, and 0.74% over a 1-week period.

Not surprisingly, when they lowered the oversold requirement to an RSI below 5, the performance numbers improved even more. The numbers then improved again when they lowered the RSI requirement to 2, and once again when they lowered the RSI requirement to 1.

When the RSI requirement was lowered all the way down to one, the RSI indicator recorded returns of 0.3% for a 1-day period, 0.66% for a 2-day period, and 1.18% for a 1-week period. This indicates that the lower the RSI, the more the stock was likely to rebound. Clearly, the 2 period RSI indicator can perform extremely well on short term trades.

My Initial Resistance To Oversold Indicators

My early stock market training was a combination of William O’Neil’s CANSLIM method and the trend following approach promoted by Michael Covel. Because of that, I have always been against the concept of an overbought or oversold indicator. Following with my trend following and CANSLIM training, I believe that the stocks with the strongest relative strength are most likely to continue moving higher.

What I was missing, was the idea that short term overbought and oversold conditions can exist within long term trends. That means that overbought/oversold indicators and trend following philosophies do not necessarily have to be mutually exclusive.

Current Examples

One interesting example of using RSI to identify short-term oversold opportunities would be Take Two Interactive Software (TTWO), which took a big hit in today’s trading. My CANSLIM and Trend Following background tells me to avoid stocks that are taking big hits and crashing below their 50-day moving average on big volume, but that is a longer-term outlook. It would not be unreasonable for TTWO to bounce back over the next few days and then head further south.

RSI Entry on TTWO

TTWO shows a good chance of correcting upward over the next few days

The same case can be made for Webster Financial Corp (WBS) , which has recently lost its 50-day line and has been trending down for the past few weeks. While taking a long term position in this stock might not make much sense to a mid- or long-term trend follower, the stock’s 2-period RSI of 4.23 indicates that it is likely to see a small bounce over the next few days.

RSI Entry WBS

The RSI entry rules show that WBS is due for a correction in the short term.

Systematizing This Concept

It is important to keep in mind that the profitable returns that Connors and Alvarez were able to produce in their returns came from including EVERY instance of a stock falling into oversold territory. They were not picking and choosing their favorite companies.

Therefore, in order for us to use this idea, we will have to build it into a system that will be able to trade every signal generated, not just the ones we like best. This will ensure that we don’t allow our own personal biases to interfere with the system’s success.

It is also important to realize that this 2-period RSI concept is simply an entry signal. In order to develop it into a trading system, we will need to add an exit signals, position sizing, and risk management. This will require extensive testing and analysis, but it does appear that it would be possible to build a profitable short-term trading system using the 2-period RSI as an entry signal.

Filed Under: Trading strategy ideas Tagged With: Connors, entry signal, RSI, stock, trading system

Moving Average Crossover System with RSI Filter

July 29, 2013 by Andrew Selby 8 Comments

Simple systems stand the best chances of succeeding by not becoming overly curve-fit. However, adding a simple filter to a robust system can be a great way to improve its profitability, provided you also analyze how it may alter any risks or biases built into the system.  The Moving Average Crossover System with RSI Filter is an excellent example of this.

About The System

This system uses the 30 unit SMA for the fast average and the 100 unit SMA for the slow average. Because its fast moving average is a good bit slower than the SPY 10/100 Long Only Moving Average Crossover System, it should generate less total trade signals. It will be interesting to see if this leads to a higher win rate.

The system also uses the RSI indicator as a filter. This is designed to keep the system out of trades in markets that are not trending, which should also lead to a higher win rate.

The system enters a long position when the 30 unit SMA crosses above the 100 unit SMA if the RSI is above 50. It enters a short position when the 30 unit SMA crosses below the 100 unit SMA if the RSI is below 50.

The system exits a long position if the 30 unit SMA crosses back below the 100 unit SMA, or if the RSI drops below 30. It exits a short position if the 30 unit SMA crosses back above the 100 unit SMA, or if the RSI rises above 70. It also implements a trailing stop that is based on the volatility of the market and sets an initial stop at the most recent low for a long position or the most recent high for a short position.

moving average crossover system

A daily FXI chart, the EURUSD ETF, shows the system rules in action

Trading Rules

Go Long When:

  • 30 unit SMA crosses above 100 unit SMA
  • RSI > 50

Go Short When:

  • 30 unit SMA crosses below 100 unit SMA
  • RSI < 50

Exit Long When:

  • 30 unit SMA crosses below 100 unit SMA, or
  • RSI drops below 30, or
  • Trailing Stop is hit, or
  • Initial Stop is hit

Exit Short When:

  • 30 unit SMA crosses above the 100 unit SMA, or
  • RSI rises above 70, or
  • Trailing Stop is hit, or
  • Initial Stop is hit

Backtesting Results

The backtesting results I found for this system were from the Euro vs US Dollar market from 2004 through 2011 using a daily time period. During those seven years, the system only made 14 trades, so it definitely filtered out a large portion of the action. The question is whether or not it filtered out the good trades or the bad ones.

Of those 14 trades, eight were winners and six were losers. That gives the system a 57% win rate, which we know can be traded very successfully provided the profit rate is also strong.

Backtesting reports for forex systems use a stat called profit factor. This number is calculated by dividing the gross profit by the gross loss. This gives us the average profit we can expect per unit of risk. The results for this backtesting report gave this system a profit factor of 3.61. This means that over the long run, this system will provide positive returns.

For a comparison point, the Triple Moving Average Crossover System only had a profit factor of 1.10, so the Moving Average Crossover System with RSI is likely to be three times more profitable. This means that using a larger number for the fast moving average and adding the RSI filter must be filtering out some of the less productive trades.

These numbers are further supported by the fact that the average profit was just over twice as large as the average loss. However, despite these positive ratios, the system did suffer a maximal drawdown of almost 40%.

Sample Size

The fact that this system gives so few signals is both its biggest strength and its biggest weakness. Placing fewer trades and holding them for longer periods of time will keep transaction costs from becoming a factor. However, analyzing 14 trades that occurred over seven years could lead the results to be skewed because of small sample size.

I am curious how this system would have performed if it was traded across a dozen different currency pairs over the same time period. Furthermore, how would it have performed if the backtest went back 50 years or tested the system on stock indexes or commodities. There is clearly positive stats to warrant further exploration of this system, but it would be foolish to trade real money based on the results of 14 trades.

Trading Example

An example of this system at work can be seen on the current chart of the FXI. Around March 18 of this year, the 30 day SMA crossed below the 100 day SMA. At that time, the RSI was also below 50. This would have triggered a short position somewhere just below 36. The initial stop would probably have been placed above the recent high at 38.

By mid-April, the price had dropped to 34 and we would have been sitting on a nice profit. The price then rebounded to almost trigger our initial stop at 38 in early May before crashing almost all the way down to 30 at the end of June. It has since bounced back to the 34 range.

At no point during any of this action did the 30 day SMA cross back above the 100 day SMA, and the RSI remained below 70. Therefore, neither of those would have triggered an exit. While the price came close to our initial stop, it did not quite get there, so that would have kept us in the trade as well.

The only thing that could have caused an exit would have been the trailing stop, which would have depended on how much volatility we set it to allow for. It is still to early to say whether we would want to have been stopped out or not.

About the RSI Indicator

The RSI indicator was developed by J. Welles Wilder and was featured in his 1978 book, New Concepts in Technical Trading Systems. It is a momentum indicator that oscillates between zero and 100, indicating the speed and change in price. Many momentum traders use RSI as an overbought/oversold indicator.

RSI is calculated by first calculating RS, which is the average gain of the last n periods divided by the average loss of the last n periods. The value for n is generally 14 days.

RS = (Average Gain) / (Average Loss)

Once RS is calculated, the following equation is used to make that value into an oscillating indicator:

RSI = 100 – [ 100 / (1 + RS) ]

This will give us a value between zero and 100. Any value above 70 is generally considered overbought, and any value below 30 is considered oversold. However, since this system is a trend following system, overbought and oversold do not have their usual negative connotations.

Filed Under: Test your concepts historically, Trading strategy ideas Tagged With: crossover system, moving average, RSI

RSI 25/75 Mean Reversion System

July 18, 2013 by Andrew Selby Leave a Comment

The RSI 25/75 Mean Reversion System uses the Relative Strength Index to gauge when a stock becomes oversold during an uptrend or overbought during a downtrend. It aims to make quick trades that last only for a few days. Historical evidence shows that the system can be profitable on over 70% of its trades, logging as much as 1% profit on each positive trade.

About The System

The system was published by Larry Connors and Cesar Alvarez in their book High Probability ETF Trading: 7 Professional Strategies to Improve Your ETF Trading. In that book, they suggest that adjusting the time period for the RSI indicator from its standard of 14 down to 4 will dramatically increase the edge of that indicator.

The system uses a 200 day simple moving average (SMA) to determine the long term trend. Then, it signals a long position anytime a market in an uptrend has its RSI indicator drop below 25. It exits that position when the RSI crosses above 55. For a downtrending market, the system enters a short position when the RSI rises above 75 and exits that position when the RSI drops below 45.

The System Rules

Go Long When:

Price > 200 SMA

RSI < 25

Go Short When:

Price < 200 SMA

RSI > 75

Exit Long When:

RSI > 55

Exit Short When:

RSI < 45

Backtesting Results

In their book, Connors and Alvarez backtested this strategy across 20 ETFs from the inception of each ETF through the end of 2008. There were a total of 786 trade signals on the long side that averaged a return of 1.48% per trade. The trades averaged a length of 6.2 days and 82.2% of all trades were winners.

On the short side, 383 trades were signaled. Those trades averaged a profit of 1.26% per trade, with each trade lasting an average of 7.4 days and 68.1% of those trades were winners.

Wondering if publishing the system would skew its performance, blogger Sanz Prophet tested the system from the beginning of 2009 through September 5, 2012 trading both long and short signals. His results showed that the system logged an annual return of 7.78% with a drawdown of 13.38%. He also noted that the system produced winners on 73.44% of its trades.

System Analysis

Compared to the other mean reversion systems we have covered, the RSI 25/75 System appears to be able to outperform the 3 Day High/Low System, but not the Multiple Day Mean Reversion System. The results for all three systems are very similar. They all accumulate small profits through lots of quick trades, and they have a very high win rate on those trades.

The issue with this system is the same as every other mean reversion system, it leave you open to taking a crippling loss. In that respect, these mean reversion systems are actually quite similar to martingale systems. They almost always produce a profit, except when a black swan shows up. The RSI is eventually going to come back to the middle where you exit the trade, and usually it will do so rather quickly. However, all it takes is one time that it doesn’t to completely wipe you out.

Ideas for Improvement

For both of the previous mean reversion systems, I suggested that I would be curious to see how adding a stop-loss component would impact the results. The same holds true for this system. Setting a stop-loss order for each position would allow you to guard your downside, however we don’t know how many trades would have hit our stop before eventually becoming profitable.

I have also discussed trading a mean reversion system as part of a package that trades multiple systems. If you were to break down a number of different systems and then determine a way to trade each of them when they were most likely to be successful, perhaps you could gain an edge. Again, this would require extensive testing.

Another idea that I would be interested to test would be putting a time limit on each trade. It would be interesting to explore how many of the losing trades lasted longer than the average trade length. Perhaps we could find a length that could have taken smaller losses before they became larger losses.

SPY Example

The current chart of the SPY provides a great example for this system. The SPY is well above its 200 day SMA, so it is in an uptrend. Its RSI indicator dipped down to 25 two times in the month of June. Each of those trades would have been exited at a profit only a few days later as the RSI jumped back above 55 both times.

SPY RSI Mean Reversion System

Keep in mind that this is just an example over an incredibly small sample size. The system is certainly not guaranteed to perform like this every time.

Filed Under: Test your concepts historically, Trading strategy ideas Tagged With: mean reversion systems, RSI

  • 1
  • 2
  • Next Page »
FREE trading strategies by email

Trending

Sorry. No data so far.

Archives

  • Dominari
  • How does the forex market work?
  • Indicators
  • MetaTrader Tips
  • MQL (for nerds)
  • NinjaTrader Tips
  • Pilum
  • QB Pro
  • Stop losing money
  • Test your concepts historically
  • Trading strategy ideas
  • Uncategorized
  • What's happening in the current markets?

Translation


Free Trading Strategies

Privacy PolicyRisk Disclosure

Copyright © 2023 OneStepRemoved.com, Inc. All Rights Reserved.