
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.
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: 1. IBS value reaches or exceeds the upper threshold (default 0.9) 2. Closing price is higher than the previous bar’s high 3. 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).
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.
/*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")
//#endregion