Strategy vault / Mean reversion
Multi Level RSI Cross Under Regression Pyramiding Strategy
This strategy is an automated trading system based on the Relative Strength Index (RSI), primarily designed to capture potential rebounds by identifying oversold market conditions. The strategy employs a progressive…

Overview
This strategy is an automated trading system based on the Relative Strength Index (RSI), primarily designed to capture potential rebounds by identifying oversold market conditions. The strategy employs a progressive position-building approach, gradually establishing multiple positions when RSI crosses at low levels, with risk control through profit targets. The system features a flexible capital management mechanism, using 6.6% of total account equity per trade, allowing up to 15 pyramiding entries.
Strategy Principles
The core logic of the strategy is based on the following key elements:
- Entry Signal: Buy signals are triggered when 14-period RSI crosses below the oversold level of 28.5
- Position Management: Single position size is 6.6% of account equity, allowing up to 15 progressive entries
- Profit Taking: Closes 50% of the position when price reaches 900% gain from entry price
- Visualization: Displays buy/sell signals, RSI curve, entry price, and target price on charts The strategy observes RSI behavior in oversold territory to determine market trends, gradually building positions upon oversold signals to reduce average entry costs.
Strategy Advantages
- Systematic Entry: Automatically identifies trading opportunities through preset RSI parameters, avoiding subjective bias
- Risk Diversification: Uses progressive position building at different price levels, effectively spreading risk
- Flexibility: Strategy parameters can be adjusted according to different market environments and risk preferences
- Profit Protection: Sets clear profit targets with automatic position reduction to lock in partial gains
- Capital Efficiency: Optimizes capital utilization through proper position control and pyramiding mechanism
Strategy Risks
- Trend Risk: Frequent entry signals may trigger during strong downtrends, leading to losses
- Parameter Sensitivity: Improper settings of RSI parameters and position sizing can affect strategy performance
- Market Liquidity: Difficulty executing trades at target prices in illiquid markets
- Capital Management: Excessive pyramiding may lead to overexposure Solutions:
- Add trend filters to pause entries during clear downtrends
- Optimize parameters through backtesting
- Set maximum drawdown limits
- Dynamically adjust pyramiding thresholds
Strategy Optimization
- Dynamic Parameters: Automatically adjust RSI parameters and entry conditions based on market volatility
- Stop-Loss Mechanism: Add trailing stop-loss functionality for better risk control
- Market Filters: Incorporate volume and trend filters to improve signal quality
- Exit Optimization: Design more flexible profit-taking mechanisms, such as staged position reduction
- Risk Control: Add maximum drawdown limits and exposure control
Summary
The strategy identifies oversold opportunities through RSI indicator, combining pyramiding entries with fixed-ratio profit-taking to create a complete trading system. Its strengths lie in systematic operation and risk diversification, but attention must be paid to market trends and parameter settings affecting strategy performance. The strategy's stability and profitability can be further enhanced through dynamic parameter adjustment, stop-loss mechanisms, and market filters.
Source Pine Script
/*backtest
start: 2024-09-15 00:00:00
end: 2024-12-10 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("RSI Cross Under Strategy", overlay=true, initial_capital=1500, default_qty_type=strategy.percent_of_equity, default_qty_value=6.6)
// Input parameters
rsiLength = input(14, "RSI Length")
rsiOversold = input(28.5, "RSI Oversold Level")
profitTarget = input(900, "Profit Target (%)")
maxPyramiding = input(15, "Max Pyramiding")
// Calculate RSI
rsi = ta.rsi(close, rsiLength)
// Detect RSI crossunder
rsiCrossunder = ta.crossunder(rsi, rsiOversold)
// Calculate the profit target price
entryPrice = strategy.position_avg_price
targetPrice = entryPrice * (1 + profitTarget / 100)
// Buy condition
if (rsiCrossunder and strategy.position_size <= maxPyramiding * strategy.equity * 0.066)
strategy.entry("Buy", strategy.long)
// Take profit condition
if (strategy.position_size > 0 and high >= targetPrice)
strategy.close("Buy", qty_percent = 50)
// Plot buy signals
plotshape(rsiCrossunder, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
// Plot sell signals (when position is partially closed)
plotshape(strategy.position_size > 0 and high >= targetPrice, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
// Plot RSI
plot(rsi, "RSI", color=color.blue, linewidth=2)
hline(rsiOversold, "RSI Oversold", color=color.red, linestyle=hline.style_dashed)
// Plot entry and target prices
plot(strategy.position_size > 0 ? entryPrice : na, "Entry Price", color=color.green, linewidth=2, style=plot.style_linebr)
plot(strategy.position_size > 0 ? targetPrice : na, "Target Price", color=color.red, linewidth=2, style=plot.style_linebr)
// Display strategy information
var table infoTable = table.new(position.top_right, 3, 6, border_width=1)
table.cell(infoTable, 0, 0, "Strategy Info", bgcolor=color.blue, text_color=color.white)
table.cell(infoTable, 0, 1, "RSI Length: " + str.tostring(rsiLength))
table.cell(infoTable, 0, 2, "RSI Oversold: " + str.tostring(rsiOversold))
table.cell(infoTable, 0, 3, "Profit Target: " + str.tostring(profitTarget) + "%")
table.cell(infoTable, 0, 4, "Order Size: 6.6% of total")
table.cell(infoTable, 0, 5, "Max Pyramiding: " + str.tostring(maxPyramiding) + " times")
Published by ianzeng123 on the FMZ strategy square · last modified 2025-02-27. 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/Multi-Level-RSI-Cross-Under-Regression-Pyramiding-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
- 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 RSI Oscillator Dynamic Trading Strategy with Threshold OptimizationPine Script · Mean reversion · 1d
- Advanced 15 Minute Chart Trading Signal StrategyPine Script · Mean reversion · 3h
- Advanced Fibonacci Retracement Trend Following and Reversal Trading StrategyPine Script · Mean reversion · 3h
- Advanced Momentum EMA Trend Following with RSI Overbought Oversold Trading StrategyPine Script · Mean reversion · 1d