Strategy vault / Mean reversion
High Position Internal Bar Strength Based Mean Reversion Short Strategy
This is a short-only mean reversion strategy based on the Internal Bar Strength (IBS) indicator, which identifies trading opportunities by monitoring the closing price's position within the daily price range. The…

Overview
This is a short-only mean reversion strategy based on the Internal Bar Strength (IBS) indicator, which identifies trading opportunities by monitoring the closing price's position within the daily price range. The strategy initiates short positions when the IBS indicates overbought conditions and exits when IBS reaches oversold levels. It is specifically designed for daily timeframe trading in stocks and ETF markets.
Strategy Principle
The core of the strategy lies in using the IBS indicator to measure where the closing price falls within the day's high-low range. IBS is calculated as: (Close - Low)/(High - Low). When IBS is greater than or equal to 0.9, it indicates the closing price is near the day's high, suggesting overbought conditions; when IBS is less than or equal to 0.3, it indicates the closing price is near the day's low, suggesting oversold conditions. The strategy enters a short position when all of the following conditions are met:
- IBS value reaches or exceeds the upper threshold (default 0.9)
- Closing price is higher than the previous bar's high
- Current time is within the specified trading window The strategy closes all positions when the IBS value drops below the lower threshold (default 0.3).
Strategy Advantages
- Clear and simple logic with few parameters, easy to understand and implement
- Effectively captures price reversion opportunities after overbought conditions
- Time window restrictions help avoid trading during unfavorable periods
- Entry conditions include previous day's high breakout confirmation, improving signal reliability
- Percentage-based position management allows for flexible risk control
Strategy Risks
- May face continuous losses in strong trending markets
- Using IBS indicator alone might generate false signals
- Lack of stop-loss mechanism could lead to significant losses in extreme market conditions
- Strategy relies on the stability of intraday price ranges
- Trading frequency might be high, resulting in substantial transaction costs
Strategy Optimization Directions
- Incorporate trend filters to avoid counter-trend trading in strong trends
- Add volume or volatility filters to improve signal quality
- Design dynamic IBS thresholds that adapt to different market conditions
- Implement stop-loss mechanisms to control single-trade risk
- Optimize position management system to adjust holdings based on market volatility
- Consider multi-timeframe analysis to enhance signal reliability
Summary
This is a short-only mean reversion strategy that uses the IBS indicator to capture price pullback opportunities after overbought conditions. While the strategy design is concise and operations are clear, it requires optimization based on specific trading instruments and market conditions. It is recommended to thoroughly test different parameter combinations and incorporate other technical indicators to improve strategy stability before live trading. Additionally, risk control must be emphasized, especially when applying the strategy in strong trending markets.
Source Pine Script
/*backtest
start: 2024-06-01 00:00:00
end: 2025-02-18 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Botnet101
//@version=6
strategy('[SHORT ONLY] Internal Bar Strength (IBS) Mean Reversion Strategy', overlay = false, default_qty_value = 100, default_qty_type = strategy.percent_of_equity, margin_long = 5, margin_short = 5, process_orders_on_close = true, precision = 4)
//#region INPUTS SECTION
// ============================================
//#region IBS Thresholds
upperThresholdInput = input.float(defval = 0.9, title = 'Upper Threshold', step = 0.1, maxval=1, group = 'IBS Settings')
lowerThresholdInput = input.float(defval = 0.3, title = 'Lower Threshold', step = 0.1, minval=0, group = 'IBS Settings')
//#endregion
//#endregion
//#region IBS CALCULATION
// ============================================
// IBS Value Calculation
// ============================================
internalBarStrength = (close - low) / (high - low)
//#endregion
//#region TRADING CONDITIONS
// ============================================
// Entry/Exit Logic
// ============================================
shortCondition = internalBarStrength >= upperThresholdInput and close>high[1]
exitCondition = internalBarStrength <= lowerThresholdInput
//#endregion
//#region STRATEGY EXECUTION
// ============================================
// Order Management
// ============================================
if shortCondition
strategy.entry('short', strategy.short)
if exitCondition
strategy.close_all()
//#endregion
//#region PLOTTING
// ============================================
// Visual Components
// ============================================
plot(internalBarStrength, color = color.white, title = "IBS Value")
plot(upperThresholdInput, color = color.yellow, title = "Upper Threshold")
plot(lowerThresholdInput, color = color.yellow, title = "Lower Threshold")
//#endregionPublished by ianzeng123 on the FMZ strategy square · last modified 2025-02-20. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/High-Position-Internal-Bar-Strength-Based-Mean-Reversion-Short-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- 1 2 3 Pattern Quantitative Trading Strategy with EMAs MACD and 4th Candle ExtensionPine Script · Mean reversion · 1h
- 3 10 Oscillator Profile Flagging StrategyPine Script · Mean reversion · 1d
- A Trend Reversal Strategy Based on Moving Averages Price Patterns and VolumePine Script · Mean reversion · 1d
- ATR and EMA based Dynamic Take Profit and Stop Loss Adaptive StrategyPine Script · Mean reversion · 1h
- Adaptive Mean Reversion Trading Strategy Based on Chande Momentum OscillatorPine Script · Mean reversion · 1d
- Adaptive Moving Average Tracking StrategyPine Script · Mean reversion · 1d