OPEN-SOURCE SCRIPT
Recovery Strategy

Description:
The Recovery Strategy is a long-only trading system designed to capitalize on significant price drops from recent highs. It enters a position when the price falls 10% or more from the highest high over a 6-month lookback period and adds positions on further 2% drops, up to a maximum of 5 positions. Each trade is held for 6 months before exiting, regardless of profit or loss. The strategy uses margin to amplify position sizes, with a default leverage of 5:1 (20% margin requirement). All key parameters are customizable via inputs, allowing flexibility for different assets and timeframes. Visual markers indicate recent highs for reference.
How It Works:
Entry: Buys when the closing price drops 10% or more from the recent high (highest high in the lookback period, default 126 bars ~6 months). If already in a position, additional buys occur on further 2% drops (e.g., 12%, 14%, 16%, 18%), up to 5 positions (pyramiding).
Exit: Each trade exits after its own holding period (default 126 bars ~6 months), regardless of profit or loss. No stop loss or take-profit is used.
Margin: Uses leverage to control larger positions (default 20% margin, 5:1 leverage). The order size is a percentage of equity (default 100%), adjustable via inputs.
Visualization: Displays blue markers (without text) at new recent highs to highlight reference levels.
Inputs:
Lookback Period for High Peak (bars): Number of bars to look back for the recent high (default: 126, ~6 months on daily charts).
Initial Drop Percentage to Buy (%): Percentage drop from recent high to trigger the first buy (default: 10.0%).
Additional Drop Percentage to Buy (%): Further drop percentage to add positions (default: 2.0%).
Holding Period (bars): Number of bars to hold each position before selling (default: 126, ~6 months).
Order Size (% of Equity): Percentage of equity used per trade (default: 100%).
Margin for Long Positions (%): Percentage of position value covered by equity (default: 20%, equivalent to 5:1 leverage).
Usage:
Timeframe: Designed for daily charts (126 bars ~6 months). Adjust Lookback Period and Holding Period for other timeframes (e.g., 1008 hours for hourly charts, assuming 8 trading hours/day).
Assets: Suitable for stocks, ETFs, or other assets with significant price volatility. Test thoroughly on your chosen asset.
Settings: Customize inputs in the strategy settings to match your risk tolerance and market conditions. For example, lower Margin for Long Positions (e.g., to 10% for 10:1 leverage) to increase position sizes, but beware of higher risk.
Backtesting: Use TradingView’s Strategy Tester to evaluate performance. Check the “List of Trades” for skipped trades due to insufficient equity or margin requirements.
Risks and Considerations:
No Stop Loss: The strategy holds trades for the full 6 months without a stop loss, exposing it to significant drawdowns in prolonged downtrends.
Margin Risk: Leverage (default 5:1) amplifies both profits and losses. Ensure sufficient equity to cover margin requirements to avoid skipped trades or simulated margin calls.
Pyramiding: Up to 5 positions can be open simultaneously, increasing exposure. Adjust pyramiding in the code if fewer positions are desired (e.g., change to pyramiding=3).
Market Conditions: Performance depends on price drops and recoveries. Test on historical data to assess effectiveness in your market.
Broker Emulator: TradingView’s paper trading simulates margin but does not execute real margin trading. Results may differ in live trading due to broker-specific margin rules.
How to Use:
Add the strategy to your chart in TradingView.
Adjust input parameters in the settings panel to suit your asset, timeframe, and risk preferences.
Run a backtest in the Strategy Tester to evaluate performance.
Monitor open positions and margin levels in the Trading Panel to manage risk.
For live trading, consult your broker’s margin requirements and leverage policies, as TradingView’s simulation may not match real-world conditions.
Disclaimer:
This strategy is for educational purposes only and does not constitute financial advice. Trading involves significant risk, especially with leverage and no stop loss. Always backtest thoroughly and consult a financial advisor before using any strategy in live trading.
The Recovery Strategy is a long-only trading system designed to capitalize on significant price drops from recent highs. It enters a position when the price falls 10% or more from the highest high over a 6-month lookback period and adds positions on further 2% drops, up to a maximum of 5 positions. Each trade is held for 6 months before exiting, regardless of profit or loss. The strategy uses margin to amplify position sizes, with a default leverage of 5:1 (20% margin requirement). All key parameters are customizable via inputs, allowing flexibility for different assets and timeframes. Visual markers indicate recent highs for reference.
How It Works:
Entry: Buys when the closing price drops 10% or more from the recent high (highest high in the lookback period, default 126 bars ~6 months). If already in a position, additional buys occur on further 2% drops (e.g., 12%, 14%, 16%, 18%), up to 5 positions (pyramiding).
Exit: Each trade exits after its own holding period (default 126 bars ~6 months), regardless of profit or loss. No stop loss or take-profit is used.
Margin: Uses leverage to control larger positions (default 20% margin, 5:1 leverage). The order size is a percentage of equity (default 100%), adjustable via inputs.
Visualization: Displays blue markers (without text) at new recent highs to highlight reference levels.
Inputs:
Lookback Period for High Peak (bars): Number of bars to look back for the recent high (default: 126, ~6 months on daily charts).
Initial Drop Percentage to Buy (%): Percentage drop from recent high to trigger the first buy (default: 10.0%).
Additional Drop Percentage to Buy (%): Further drop percentage to add positions (default: 2.0%).
Holding Period (bars): Number of bars to hold each position before selling (default: 126, ~6 months).
Order Size (% of Equity): Percentage of equity used per trade (default: 100%).
Margin for Long Positions (%): Percentage of position value covered by equity (default: 20%, equivalent to 5:1 leverage).
Usage:
Timeframe: Designed for daily charts (126 bars ~6 months). Adjust Lookback Period and Holding Period for other timeframes (e.g., 1008 hours for hourly charts, assuming 8 trading hours/day).
Assets: Suitable for stocks, ETFs, or other assets with significant price volatility. Test thoroughly on your chosen asset.
Settings: Customize inputs in the strategy settings to match your risk tolerance and market conditions. For example, lower Margin for Long Positions (e.g., to 10% for 10:1 leverage) to increase position sizes, but beware of higher risk.
Backtesting: Use TradingView’s Strategy Tester to evaluate performance. Check the “List of Trades” for skipped trades due to insufficient equity or margin requirements.
Risks and Considerations:
No Stop Loss: The strategy holds trades for the full 6 months without a stop loss, exposing it to significant drawdowns in prolonged downtrends.
Margin Risk: Leverage (default 5:1) amplifies both profits and losses. Ensure sufficient equity to cover margin requirements to avoid skipped trades or simulated margin calls.
Pyramiding: Up to 5 positions can be open simultaneously, increasing exposure. Adjust pyramiding in the code if fewer positions are desired (e.g., change to pyramiding=3).
Market Conditions: Performance depends on price drops and recoveries. Test on historical data to assess effectiveness in your market.
Broker Emulator: TradingView’s paper trading simulates margin but does not execute real margin trading. Results may differ in live trading due to broker-specific margin rules.
How to Use:
Add the strategy to your chart in TradingView.
Adjust input parameters in the settings panel to suit your asset, timeframe, and risk preferences.
Run a backtest in the Strategy Tester to evaluate performance.
Monitor open positions and margin levels in the Trading Panel to manage risk.
For live trading, consult your broker’s margin requirements and leverage policies, as TradingView’s simulation may not match real-world conditions.
Disclaimer:
This strategy is for educational purposes only and does not constitute financial advice. Trading involves significant risk, especially with leverage and no stop loss. Always backtest thoroughly and consult a financial advisor before using any strategy in live trading.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.