Join today
Strategies / Mean reversion / IBS Mean Reversion

IBS Mean Reversion on Stocks

Internal bar strength shows where the close sits inside the day's range. This system buys when IBS is below 0.7, the close is lower than the previous close, and the prior low undercut the one before it. It sells when IBS climbs above 0.9.

Mean reversionLong onlySwingMastercardDaily
2.65Profit factor
55,597Net profit USD
69.47%Win rate
380Trades
-5,014Max drawdown
146Avg trade

Best run of 31. Mastercard, Daily, from run stock2-queue:2026-09-15-Mastercard.tsv:8.

Entry rules, long

  1. Members only
  2. Close is below the previous close
  3. The previous low is below the low before it
  4. No long position is open

Exit rules

  1. Members only
  2. No stop loss or target

Test conditions

PeriodUp to 2026-09-15
InstrumentMastercard, Daily
Capital per trade10,000
CostsNot recorded for this run.
BarsDaily bars, full available history
Last tested2026-09-15

Parameters

capitalPerTrade
Money committed to each trade
10000
minRange
Floor on the bar range to avoid dividing by zero
0.00001
entryIbsLevel
Buy when IBS is below this
0.7
exitIbsLevel
Sell when IBS is above this
0.9

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
MastercardBest runDaily2.65 38069.4755,597 USD-5,014
VisaDaily2.51 33867.7538,486 USD-3,303
MicrosoftDaily2.45 69468.4496,673 USD-4,771
BroadcomDaily2.27 32165.7345,193 USD-3,454
CiscoDaily2.26 63165.45109,868 USD-9,961
ExxonMobilDaily2.07 89962.8573,449 USD-6,444
AlphabetDaily2.00 22867.5424,127 USD-3,127
Applied MaterialsDaily1.88 54267.1681,940 USD-5,612
PalantirDaily1.88 10462.5026,481 USD-7,075
IntelDaily1.81 79162.4590,133 USD-6,875
Johnson & JohnsonDaily1.81 89660.9459,038 USD-3,478
OracleDaily1.79 71063.3899,304 USD-12,794
ChevronDaily1.78 56464.0146,392 USD-6,534
MetaDaily1.76 25565.1030,490 USD-6,529
Lam ResearchDaily1.74 65961.00106,401 USD-10,650
TeslaDaily1.74 29663.5150,543 USD-13,146
Coca-ColaDaily1.73 1,04856.7765,632 USD-6,816
NvidiaDaily1.71 49357.0081,253 USD-10,619
CostcoDaily1.71 65564.4353,145 USD-6,378
AppleDaily1.68 63355.1377,286 USD-8,749
AbbVieDaily1.67 22862.2818,923 USD-3,850
Eli LillyDaily1.59 1,01559.4165,428 USD-8,172
Bank of AmericaDaily1.54 53265.9851,185 USD-13,735
AmazonDaily1.52 55161.5255,208 USD-16,419
Berkshire HathawayDaily1.49 57964.7723,761 USD-4,961
MicronDaily1.36 71261.1079,910 USD-24,132
AMDDaily1.28 81759.4969,026 USD-15,748
S&P 500Daily1.20 1,08862.8715,348 EUR-9,911
JPMorganDaily0.82 40651.97-10,417 USD-11,866
CaterpillarDaily0.67 23548.09-10,032 USD-10,930
WalmartDaily0.00 200.00-10,099 USD-17,189

Charts

Results by run

Profit factor by run

Above 1.0 made money, below 1.0 lost money.

0.01.32.53.85.01.0 = break-evenMastercard · Daily2.65Visa · Daily2.51Microsoft · Daily2.45Broadcom · Daily2.27Cisco · Daily2.26ExxonMobil · Daily2.07Alphabet · Daily2.00Applied Materials · Daily1.88Palantir · Daily1.88Intel · Daily1.81Johnson & Johnson · Daily1.81Oracle · Daily1.79Chevron · Daily1.78Meta · Daily1.76Lam Research · Daily1.74Tesla · Daily1.74Coca-Cola · Daily1.73Nvidia · Daily1.71Costco · Daily1.71Apple · Daily1.68AbbVie · Daily1.67Eli Lilly · Daily1.59Bank of America · Daily1.54Amazon · Daily1.52

Net profit against max drawdown

Net profitMax drawdown
0-25K-13K100K200KCisco · DailyLam Research · DailyOracle · DailyMicrosoft · DailyIntel · DailyApplied Materials · DailyNvidia · DailyMicron · DailyApple · DailyExxonMobil · DailyAMD · DailyCoca-Cola · DailyEli Lilly · DailyJohnson & Johnson · DailyMastercard · DailyAmazon · Daily

The code

ProBuilder, rewritten to house standard

Every file in the library uses the same header, the same section order and the same variable names. The numbers above were produced by the original version before the rewrite, and the rewrite has not yet been compiled in ProRealTime.

// ============================================================
// IBS Mean Reversion
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Mean reversion
// Direction: Long only
// Timeframe tested: Daily
// ============================================================

// --- Settings ---
DEFPARAM CumulateOrders = false

// --- Parameters ---
capitalPerTrade = 10000   // money committed to each trade
minRange = 0.00001        // floor on the bar range to avoid dividing by zero
entryIbsLevel = 0.7       // buy when IBS is below this
exitIbsLevel = 0.9        // sell when IBS is above this

// --- Indicators ---
positionSize = capitalPerTrade / close
barRange = MAX(high - low, minRange)
ibsValue = (close - low) / barRange

15 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • There is no stop loss, so a stock that keeps falling is held until a strong close appears.
  • Three of the thirty markets lost money: JPMorgan, Caterpillar and Walmart. Walmart had 20 trades and none of them won.
  • The S&P 500 run was far weaker than the best stocks, with a profit factor of 1.2 over 1,088 trades.

Indicators used

IBS

How to load it

  1. Copy the code with the copy button above the code block.
  2. In ProRealTime, open a chart of the instrument and timeframe you want to test, then open ProOrder > New trading system and choose "Create with programming".
  3. Paste the code, give the system a name and save it.
  4. Click "Backtest", set your own spread and position size, and run it before you consider trading it live.

Questions

About this strategy

Can IBS Mean Reversion run in ProOrder?

Yes, it only needs daily closes and ranges. The rewritten code was not compile-checked, so backtest before trading it live.

How did it do across the stocks?

Mastercard led with USD 55,596.58 net over 380 trades and a 69.47% win rate. Microsoft, Cisco and Visa also did well, while JPMorgan, Caterpillar and Walmart lost.

How is each trade sized?

Each position is 10,000 divided by the close, about 10,000 of stock. The Mastercard run had a max drawdown of USD 5,014.18.

Why daily bars?

IBS is built from the daily high, low and close, and each stock was tested on its full daily history.

Related

Strategies like this one

Turnaround Tuesday

Uses the same indicator.

3.80 PF · 39 trades

Three Down Days

A similar profit factor.

2.77 PF · 63 trades

Monday Dip Buy

Also a mean reversion strategy.

n/a PF · 146 trades

Want mean reversion systems that are already trading? Join the ProRealAlgos waitlist.

The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.

Past backtest results do not guarantee future results. This is not financial advice. Curated and maintained by ProRealAlgos. ProRealTime™ is a trademark of ProRealTime SAS. prorealalgos.comStatsDocs