OPEN-SOURCE SCRIPT
Updated

Buy on 5% dip strategy with time adjustment

239
**IMPORTANT** Works the best on SOXL

1. Core Functionality
✅ Buys after a 5% drop from the highest price
✅ Sells when the price increases by 22% (Take Profit Multiplier: 1.22x) SOXL
✅ Forced sell after 230 days if the trade remains unprofitable, but waits for a -15% recovery before exiting
✅ Leverage and capital allocation can be adjusted
✅ Provides a performance table for monthly and yearly returns, including CAGR and Max Drawdown (MDD)

2. Key Features
1️⃣ Trading Period Restriction

The script allows trading only within a specific time range (e.g., from 2015 to 2026).
2️⃣ Buy Signal Based on Price Drop

It tracks the highest price recorded and checks if the current price has dropped by a user-defined percentage (-5%) to trigger a buy order.
3️⃣ Take Profit & Forced Sell Conditions

If the price reaches 1.22x of the entry price, the position is closed.
If the position remains open for 230 days and is still at a loss, it waits for a recovery of -15% from the entry price before selling.
4️⃣ Leverage & Position Sizing

Users can configure leverage and capital allocation percentage for each trade.
5️⃣ Performance Analysis Table

The strategy logs monthly and yearly profit/loss, calculates CAGR (Compound Annual Growth Rate), and tracks Max Drawdown (MDD) to assess risk and profitability.
3. Strategy Implementation
Buy Signal: Activated when the price drops 5% from the highest recorded price.
Sell Signal: Triggered when the price reaches 1.22x the entry price or recovers from a -15% drawdown after 230 days.
Performance Analysis: Generates a monthly and yearly P&L table to help users track strategy effectiveness.


I
Release Notes
**IMPORTANT** WORKS THE BEST ON SOXL SOXL

1. Core Functionality
✅ Buys after a 5% drop from the highest price
✅ Sells when the price increases by 22% (Take Profit Multiplier: 1.22x)
✅ Forced sell after 230 days if the trade remains unprofitable, but waits for a -15% recovery before exiting
✅ Leverage and capital allocation can be adjusted
✅ Provides a performance table for monthly and yearly returns, including CAGR and Max Drawdown (MDD)

2. Key Features
1️⃣ Trading Period Restriction

The script allows trading only within a specific time range (e.g., from 2015 to 2026).
2️⃣ Buy Signal Based on Price Drop

It tracks the highest price recorded and checks if the current price has dropped by a user-defined percentage (-5%) to trigger a buy order.
3️⃣ Take Profit & Forced Sell Conditions

If the price reaches 1.22x of the entry price, the position is closed.
If the position remains open for 230 days and is still at a loss, it waits for a recovery of -15% from the entry price before selling.
4️⃣ Leverage & Position Sizing

Users can configure leverage and capital allocation percentage for each trade.
5️⃣ Performance Analysis Table

The strategy logs monthly and yearly profit/loss, calculates CAGR (Compound Annual Growth Rate), and tracks Max Drawdown (MDD) to assess risk and profitability.
3. Strategy Implementation
Buy Signal: Activated when the price drops 5% from the highest recorded price.
Sell Signal: Triggered when the price reaches 1.22x the entry price or recovers from a -15% drawdown after 230 days.
Performance Analysis: Generates a monthly and yearly P&L table to help users track strategy effectiveness.
This strategy is designed for medium-to-long-term trading, managing risks through controlled stop-loss conditions while maximizing profit potential. 🚀

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.