The Internal Bar Strength Indicator

The internal bar strength or (IBS) is an oscillating indicator which measures the relative position of the close price with respect to the low to high range for the same period. The calculation for Internal Bar Strength is as follows… IBS =  (Close – Low) / (High – Low) * 100; For example, on 13/01/2016 the QQQ etf had a high price of $106.23, a low price of $101.74 and a close price of $101.90. The value of IBS would be calculated as … (101.90 – 101.74) / (106.23 – 101.74) * 100 = 3.56 Low IBS readings show that a market has closed near the lows of the day, high IBS readings show that a market has closed near the highs of the day. The following image shows the IBS indicator plotted beneath the price series. IBS-1-630x315

Testing the Internal Bar Strength Indicator The test period is between 01/01/2005 and today. $100,000 hypothetical starting balance, with 100% of available equity invested per position. Commissions are $0.01 per share and there is a minimum cost per trade of $1.00. Tests are carried out using Amibroker and the data is provided by Norgate Premium. These are the Strategy rules:

  • If IBS < 10
  • Buy the close
  • Exit at close if price > previous day high.

QQQ Results

  • No. of trades = 199
  • % of Winners = 72.36%
  • Average P/L% per trade = 0.62%
  • Average hold time = 4 days
  • Annualized return = 11.32%
  • Maximum draw-down = -16.14%
  • CAR/MDD = 0.70
  • Exposure = 28.47% The monthly breakdown of returns is as follows…

Internal-Bar-Strength-QQQ-Performance-1 One common trait among many of these types of mean-reversion systems is that they seem to perform best during volatile markets. To illustrate the point, I added a filter to the above strategy which only allows us to buy QQQ if the VIX has closed above the value of it’s previous 10-day MA. Adding the VIX filter improved the win-rate %, average profit % per trade, and annual % return of the strategy. Here are the results… * No. of trades = 158 * % of Winners  = 75.32% * Average P/L% per trade = 0.85% * Average hold time = 4 days * Annualized return = 12.46% * Maximum draw-down = -14.83% * CAR/MDD = 0.84 * Exposure = 22.3% The Equity curve and monthly breakdown of returns are as follows…


Combining the Internal Bar Strength Strategy with a Trend-Following Strategy Finally, I wanted to see whether combining a trend-following strategy with the Internal Bar Strategy could improve the risk-adjusted returns of either stand-alone strategy. The trend following strategy is as follows…

  • Buy the SPY when the Close > upper Bollinger Band (C,200,1);
  • Sell the SPY when the Close < lower Bollinger Band (C,200,1); Since 2005, this strategy has the following performance metrics:

  • No. of trades = 5

  • % of Winners  = 80%

  • Average P/L% per trade = 19.17%
  • Average hold time = 425 days
  • Annualized return = 7.37%
  • Maximum draw-down = -14.17%
  • CAR/MDD = 0.52
  • Exposure = 76.25% The Equity Curve and monthly breakdown of returns are as follows…

SPY-trend-Following For the Final test, QQQ is traded using the Internal Bar Strength (IBS) strategy and SPY is traded using the above trend-following (TF) strategy. The first test will allocate 70% of available equity to the SPY strategy and 30% of available equity to the QQQ strategy. Further tests will use different capital allocations. Because the SPY can sometimes be held for a long period, it is necessary to periodically rebalance the size of open SPY positions. For the following tests the rebalance frequency will be monthly and the rebalance threshold will be 2%.

70%TF / 30%IBS. Results

  • No. of trades = 163
  • % of Winners  = 75.46%
  • Average P/L% per trade = 1.39%
  • Average hold time = 18 days
  • Annualized return = 9.01%
  • Maximum draw-down = -11.45%
  • CAR/MDD = 0.86
  • Exposure = 60.23%

60%TF / 40%IBS. Results

  • Annualized return = 9.53%
  • Maximum draw-down = -11.09%
  • CAR/MDD = 0.86
  • Exposure = 54.76%

50%TF / 50%IBS. Results

  • Annualized return = 10.04%
  • Maximum draw-down = -10.98%
  • CAR/MDD = 0.91
  • Exposure = 49.35%

40%TF / 60%IBS. Results

  • Annualized return = 10.55%
  • Maximum draw-down = -10.93%
  • CAR/MDD = 0.97
  • Exposure = 43.95%

30%TF / 70%IBS. Results

  • Annualized return = 11.05%
  • Maximum draw-down = -10.87%
  • CAR/MDD = 1.02
  • Exposure = 38.51% The above results illustrate that combining both a trend-following strategy and a mean-reversion strategy within your portfolio has been a useful method for improving risk-adjusted returns. For context, the IBS strategy when traded alone produced a maximum draw-down of 14.83% and a CAR/MDD of 0.86. The Trend-following strategy produced a maximum draw-down of 14.17% and a CAR/MDD of 0.52.

The combined strategy portfolio with a 30% TF and 70% IBS allocation produced a maximum draw-down of 10.87% and a CAR/MDD of 1.02.  This is superior to either strategy if traded alone. The equity curve and monthly breakdown of returns for the 30% TF / 70% IBS portfolio are as follows… Combining-trend-folloiwng-with-Mean-Reversion-2 *Update: As some readers have correctly pointed out, trading on the close when an indicator requires the closing price to be calculated is not necessarily straight forward. With that said, I have included further tests below whereby the trades are executed on the open of the day which follows the signal. The IBS strategy does not perform as well, but the main point of the article (that combining mean-reversion with trend-following can be beneficial) is still valid.

QQQ Results (Enter on open of day which follows signal)

  • No. of trades = 197
  • % of Winners  = 70.05%
  • Average P/L% per trade = 0.49%
  • Average hold time = 4 days
  • Annualized return = 8.69%
  • Maximum draw-down = -15.99%
  • CAR/MDD = 0.54
  • Exposure = 22.04%

QQQ Results with VIX Filter (Enter on open of day which follows signal)

  • No. of trades = 157
  • % of Winners  = 73.89%
  • Average P/L% per trade = 0.64%
  • Average hold time = 4 days
  • Annualized return = 9.15%
  • Maximum draw-down = -16.10%
  • CAR/MDD = 0.57
  • Exposure = 17.26%

SPY Trend-Following Results  (Enter on open of day which follows signal)

  • No. of trades = 5
  • % of Winners  = 80%
  • Average P/L% per trade = 18.87%
  • Average hold time = 425 days
  • Annualized return = 7.24%
  • Maximum draw-down = -14.15%
  • CAR/MDD = 0.51
  • Exposure = 76.06%

Combined Portfolio (70%IBS / 30%TF)  (Enter on open of day which follows signal)

  • No. of trades = 162
  • % of Winners  = 74.07%
  • Average P/L% per trade = 1.19%
  • Average hold time = 17 days
  • Annualized return = 9.90%
  • Maximum draw-down = -11.47%
  • CAR/MDD = 0.86
  • Exposure = 35.47% The equity curve and monthly breakdown of returns for the 70% IBS / 30% TF portfolio are as follows…

Combining-trend-folloiwng-with-Mean-Reversion-3 — By Llewelyn of Backtest Wizard

About the Author Llewelyn James

Llewelyn is the best-selling author of “The Honest Guide To Stock Trading” and “The Honest Guide To Candlestick Patterns”. His web site,, provides trading articles and programming lessons for Amibroker users.

  • robin says:

    are there any free charting websites where i can get the Internal Bar Strength Indicator free. i use but they dont have it

    any ideas welcome



    • Hi Robin,

      Thanks for reading the article. I don’t know what Jeff’s policy is with regards to mentioning certain software vendors/websites etc, but I know one such free EOD charting package that I can share the indicator code for.

      If Jeff gives me the go-ahead, I’ll post here.

      • Please do share. Thanks!

        • Llewelyn says:

          Thanks Jeff.

          There is a website called ProRealTime that provides software which is free to use with EOD data.

          Once you’ve opened up your charts, you can click the “Apply Indicator” button found at the top of the the chart pane.

          Click “New”.

          Then copy and paste the following into the formula editor…


          IBS = (Close – Low) / (High – Low) * 100
          return IBS as “IBS”


          Click the “Add Indicator to Chart” button.

          The indicator should now be beneath your chart.

          You can also screen for stocks/etfs with low IBS readings…

          To do so, click “Display” on the main Bar.

          Then click “ProScreener”.

          Then click the spanner icon.

          Then click “New”

          Copy and paste the following into the formula editor…


          IBS = ((Close – Low) / (High – Low)) * 100
          c1 = average[20](volume) > 250000
          c2 = IBS < 20

          criteria = IBS

          screener[c1 and c2] sort by criteria as "IBS"


          On the right hand side of the formula editor, select the database that you want to scan. E.G. "US NYSE STOCKS"

          Then click the "Execute ProScreenr" button.

          You'll now have a list of stocks which have a 20 day volume average greater than 250000, and have an IBS value below 20.

          I'm not affiliated with ProRealTime in any way, but as it's free I think that it's useful for folks that want to run some simple EOD scans.

          I hope that helps.



  • david says:

    Jeff – great article! Would be interesting to see the strategy expanded to a larger universe of stocks and possibly trading with a next day limit order below the signal close. Any thoughts ? Thanks!

    • Hi David,

      Thanks for reading the article. The strategy tests well enough with a larger universe of stocks and next day limit order.

      I can’t post tables, charts, graphs and all of that other fun stuff here…But I’ll follow up on my website within the next week.



  • Flo says:

    I tested this strategy with TradingView platform and it gives nice results, however it looks performance is great because market was bullish most of the time over the past 26 year. Only 3 years bear market -> 89% bull

    • Llewelyn says:

      Hi Flo,

      I’m not sure that I agree about the bullish bias of the market during the test period being the reason for the strong performance.

      2 out of 3 of the best performing years for the strategy were in 2002 and 2008.

      If we isolate a bear market regime as being a close below the 200 day MA, and only test the strategy during a bear market regime, both the win-rate % and Average profit per-trade % of the strategy improve.

      I’d be interested in your thoughts about this.

  • robin says:

    thanks for this, When you say “Exit at close if price > previous day high.” is there a suggested stop loss in case this does not happen?

    • Llewelyn says:

      Hi Robin,

      No stops were used during the above back-test. As is true with a large number of the mean-reversion strategies that I test, stop-loss rules don’t stop losses.

      With that said, a 5 day timed exit doesn’t hurt too much.

  • Flo says:

    Hi Llewelyn,

    Sorry I just see your answer right now. Interesting point you mention here. I was trying to figure out what makes this strategy so profitable with U.S. stock market indexes compare to others type of asset (currencies and european markets) and bull market bias was the only one I found as valid. Now I’m rethinking about it. Any idea why it doesn’t works with european markets ? 🙂 I notice backtest gives nice result with CBOE Volatility Index (VIX)

    • Llewelyn says:

      Hi Flo,

      Good question! I’m not sure why the strategy has worked on SPY but not on European Market ETFs. A number of academic papers provide evidence that US stock markets tend to exhibit a short-term overreaction to bad news, which could explain why the IBS works…but it does nothing to explain why European markets don’t suffer from the same short-term overreaction (or if they do, why the IBS strategy hasn’t capitalised on it).

      It’s worth pointing out that when I did my Masters research I worked with lots of professors who would publish study after study attempting to prove or disprove certain trading strategies, the momentum effect, short-term mean-reversion, etc.

      I then got a job trading short-term interest rate calander spreads and worked with people who had absolutely no interest in why their strategies worked. They just cared if the strategy made money or not.

      I’ll let you guess which of the people that I worked with had the more expensive car!

      • Flo says:

        Hi Llewelyn,

        Really appreciate your answer 🙂

        Please tell me, I’m convinced that simples trading systems are the most efficient and was wondering what will be the result of testing strategies in a brut force. The same way hackers test thousands of passwords to enter a computer system until they get in.

        The idea would be to write a program that could generates randomly thousands of strategies (+ backtest). Strategies would open and close a trade on recognizable configuration of various input like OHLC prices, volumes and/or indicators values for the n previous bars.

        I know there is huge amount of possibilities and it is not 100% clear for me what could be the input and how it would works but I was thinking like it could be great way to backtest once and for every immaginable patterns 🙂

        I’d be very curious to know if someone already tested something like this.

  • Flo says:

    I’ve customized the strategy a little bit so that it close trades after either small profits OR (very) small losses. Success ratio drop to 36%-42% depending on the timeframe (1h to 4h) but the strategy is still profitable with nice profit factor. Around 3 on the DAX index. Only long positions are considered here. However backtest are executed in TD with buy at the next open. Very interesting, thanks for sharing

  • Hi Jeff –

    I hope you get Llewelyn to contribute even more articles. He has some good stuff!

    Nice work Llewelyn!


    • Llewelyn says:

      Hi Kevin,

      Thanks very much for reading the article and leaving such a nice comment, it’s most appreciated!

      All the best,


  • nm says:

    Great Stuff!

    What would be the TS EL code? I tried this code but it doesn’t work?

    double IBS ( 0 );

    IBS = (Close – Low) / (High – Low) * 100;

    Plot1( IBS, “IBS” ) ;

  • It’s good to see someone else with same formulas!

    I wrote this same indicator a couple years ago except I added a smoothing length. I called it the Shift OC (open close) Ratio.

    It’s a good tool to also use as a trailing stop. If the bars body is no longer the main portion of the candle stick then the instrument is likely losing trend.

    • Guido says:

      Hi David,
      yes I really liked your shift theory indicator you licensed to me a few years ago for NT7.
      I just would like to take the opportunity to ask whether you have upgraded it to ninjatrader ver.8. Maybe you can post here one of your strategies which uses it.

  • >