• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Decoding Markets

  • Top Posts
  • Courses
  • Resources
    • Books
  • Free Class
  • Blog
You are here: Home / Amibroker / Using The RSI Technical Indicator For Dynamic Position Sizing

September 27, 2017 By Joe Marwood 8 Comments

Using The RSI Technical Indicator For Dynamic Position Sizing

Position sizing is an important topic but many investors don’t give it much thought.

In this article I will look at a method that uses the RSI indicator to size positions. This means we can buy more when the price is low and buy less when the price is high.

Simple RSI-2 Trading Strategy

Before we look at the impact of dynamic position sizing with RSI we first need a trading strategy that we can use to compare our results.

For this, we will use a basic end of day mean reversion strategy based on the RSI-2 indicator.

Very simply, we are going to go long SPY when the RSI-2 indicator is less than 25 and we are going to sell when the RSI-2 is more than 50.

The Relative Strength Index (RSI) is a momentum oscillator that calculates the speed and change of a security’s movements.

The following results and equity curve show how the strategy has performed between 1/2000 – 1/2017:

CAR: 7.12%
Net Profit: $55,466.51
Max Drawdown: -23.82%
CAR/MDD: 0.30
Win Rate: 68.09%
Risk Adjusted Return: 23.39%
# Trades: 445

Buy/Hold CAR: 4.51%
Buy/Hold MDD: -55%

positions sizing with RSI 2 on spy equity curve

As you can see, this simplistic system has done fairly well on SPY over the last 17 years and has beaten buy and hold.

However, the focus of this article is not the strategy performance but the impact of different position sizing.

RSI Position Sizing

To understand this, I will run the same test but this time the position size will be determined by the previous bar’s RSI-2 value. The formula we will use is as follows:

Percent of Equity = 50 – RSI(2)

In Amibroker, this can be written as follows:

pctPosSize = 50 - Ref(RSI(2),-1);
SetPositionSize(pctPosSize,spsPercentOfEquity);

This formula means that our position size will change in response to how oversold the stock is. When RSI-2 is low we will buy more shares and when RSI-2 is high we will buy fewer shares.

As an example, if RSI-2 closes at a value of 10, we will use 40% of our equity (50 – 10) on the next trade. Likewise, if RSI-2 closes at 22, we will use 28%.

Using RSI 2 for position size example

Since our buy rule requires RSI-2 to be under 25, and because RSI is a bounded oscillator, the highest our position size can go is 50% and the lowest is 25%.

The following results and equity curve show the performance using this approach:

CAR: 2.69%
Net Profit: $14,292.24
Max Drawdown: -6.94%
CAR/MDD: 0.39
Win Rate: 68.09%
Risk Adjusted Return: 26.99%

positions sizing with RSI 2 on spy equity curve with RSI 2

As you can see, using RSI-2 for position sizing has reduced the annualised return and the overall net profit.

But did you notice that using RSI to set the position size has improved the risk-adjusted return?

Our drawdown has shrunk to -6.94% so we now have a risk adjusted return of 26.99% (as opposed to 23.29%) and a CAR/MDD of 0.39 (as opposed to 0.30).

In short, using RSI-2 for dynamic position sizing has given us a better return for each dollar invested. This means our money is working a little harder.

It also means that we have unused cash that we can use for another strategy.

Some Observations

I think this method works quite well in this example because using RSI for position sizing is in line with the strategy itself.

If you were to use this approach with a different strategy, such as a breakout system, then I’m not sure the results would be as good because the method doesn’t make sense.

Truthfully, I am not 100% sold on this method yet but I thought I’d share it as it could be powerful given the right conditions. It also opens up the opportunity to use other indicators in a similar way.

There are many different oscillators and indicators that could be experimented with. For example:

  • MACD
  • CCI
  • Stochastic %D
  • MFI
  • ROC

Summary

The purpose of this article was not to provide a complete trading strategy but to show a different approach to sizing positions.

We have shown that the RSI-2 is a flexible indicator that can also be used to size trades.

Using the RSI in this way means we buy more when the stock is more oversold and buy less when the stock is less oversold.

I have found that this technique can work better than using a percentage of equity, fixed amount or ATR sizing.

I think it’s worth trying this out in your own time and seeing what you can find.

Simulations and charts from Amibroker with data from Norgate.

All simulations assume transaction costs of $0.01 per share and all trades are placed on the next open after the trading signal with no stop losses included.


Thank You For Reading

joe marwood profile pictureJoe Marwood is an independent trader and the founder of Decoding Markets. He worked as a professional futures trader and has a passion for investing and building mechanical trading strategies. If you are interested in more quantitative trading strategies, investing ideas and tutorials make sure to check out our program Marwood Research.


Disclaimer

This post expresses the opinions of the writer and is for information, entertainment purposes only. Joe Marwood is not a registered financial advisor or certified analyst. The reader agrees to assume all risk resulting from the application of any of the information provided. Past performance is not a reliable indicator of future returns and financial trading is full of risk. Margin trading can lead to losses more than in your account. Mistakes in backtesting and presenting of analysis regularly occur. Please read the Full disclaimer.

Filed Under: Amibroker, Stocks, Strategies/ Systems, Top Posts Tagged With: amibroker, risk, strategies

Recommended Educational Resources:


  • Discover New Trading Strategies
  • Learn Japanese Candlesticks (Free)
  • Mental Models For Trading (Free)
  • Indicators For Amibroker (Free)
  • Tools For Options Traders (Free)
  • Historical Data For 8000 Stocks (Free)

Reader Interactions

Comments

  1. Jay says

    September 29, 2017 at 12:16 am

    Interesting post – and thanks for sharing! I tend to use fixed fractional position sizing (with some filters/adjustments based on market conditions). But this is a really interesting approach I’m going to give more thought to… 🙂

    Reply
    • JB Marwood says

      September 29, 2017 at 5:13 pm

      Thanks Jay, hope you find something interesting.

      Reply
  2. Sudharshan says

    October 1, 2017 at 11:41 pm

    Good stuff. I find the articles to be very informative without any pretensions of being a guru making millions while trying to sell you a $97 trading system ( I have no issues in people selling stuff per session ).

    Lot of food for thought. Do you provide only amibroker code..are there any articles on the nuts and bolts of Amibroker.

    Reply
  3. JB Marwood says

    October 2, 2017 at 4:36 pm

    Thanks for your comment. You can filter by category to see all the Amibroker posts https://decodingmarkets.com/category/amibroker-2/

    Reply
  4. Nick says

    October 4, 2017 at 9:52 am

    Very cool. You can take it a step further with a multiplier, then optimize it and compare versions. Something like this:

    Multiplier = Optimize(“Multiplier”,1,.1,5,.1);
    pctPosSize = 100 – (Ref(RSI(2),-1)*Multiplier);
    SetPositionSize(pctPosSize,spsPercentOfEquity);

    BTW I´m enjoying your site a lot..

    Reply
    • JB Marwood says

      October 4, 2017 at 11:07 am

      Ahh nice idea, cheers!

      Reply
  5. Ellis Baxter says

    July 26, 2019 at 4:12 am

    Very interesting, what would be your settings for a MACD for this?

    Great ideas … and best of all honest.

    The back tests are OK but in todays much faster market It may mean that every one is some sort of day trader?

    Thank for being there Joe!

    Reply
    • Joe Marwood says

      August 8, 2019 at 12:33 pm

      I’m not sure I have not looked at MACD but interesting idea. I might give it a look.

      Reply

Leave a Reply Cancel reply

Your email address will not be published.

Primary Sidebar

Access Marwood Research image

Popular

positions sizing with RSI 2 on spy equity curve

Using The RSI Technical Indicator For Dynamic Position Sizing

technical analysis for stocks

Technical Analysis For Stocks Essential Guide

Slide 3 Books

The 100 Best Trading And Investing Books Of All Time

The System Traders Feedback Loop – Don’t Get Stuck In The Back-Testing Spiral

How to 10x Your Momentum Trading Strategy

How To 10x Your Momentum Returns

The Truth About Intraday Momentum

Slide 1 Trading Desk

How To Build A Mean Reversion Trading Strategy

Testing The RSI Model From The Quantitative Technical Analysis Book By Howard Bandy

Search

Recommended Resources

  • Discover New Trading Strategies
  • Learn Japanese Candlesticks (Free)
  • Mental Models For Trading (Free)
  • Indicators For Amibroker (Free)
  • Tools For Options Traders (Free)
  • Hist. Data For 8000 Stocks (Free)

Financial Disclaimer

Financial trading is risky and you can lose money. Joe Marwood is not a registered investment advisor and nothing on this site is to be regarded as personalized investment advice. Past performance is not indicative of future results. Data errors and mistakes do occur. Please see the full disclaimer.

Footer

About The Author

Joe Marwood is an independent trader and investor specialising in financial market analysis and trading systems. He worked as a professional futures trader for a trading firm in London and has a passion for building mechanical trading strategies. He has been in the market since 2008 and working with Amibroker since 2011.

Joe Marwood Profile PIc

Recent Posts

  • Investing With Intelligent Machines
  • Trend Following With ETFs and Large Cap Stocks
  • Should You Trade This Earnings Pullback Strategy?
  • Simple Algo Trading With Alpaca And Streak
  • Is Value Investing Dead? Dissecting The Value Investing Narrative
  • How To Screen For Stocks With Norgate Data
  • Do Stocks Have A Floor?
  • What Trading Signals Work Best For Long-Term Investors?

Search

Privacy policy | Contact | Disclaimer | All Rights reserved. JB Marwood.