OPEN-SOURCE SCRIPT
S/R Breakout Strategy LONG ONLY

S/R Breakout Strategy is a long-only trend-following strategy that enters positions when price breaks above a confirmed resistance level. It features independent take-profit management per trade, a built-in cooldown mechanism, and a multi-timeframe SMA filter to ensure trades align with the broader market trend.
This strategy is designed for traders who prefer systematic breakout entries with strict risk controls and the ability to manage multiple positions simultaneously.
🔧 Key Features
1. Support & Resistance Breakout Entry
Identifies swing highs and swing lows using configurable left/right bar parameters.
Enters a long position when price crosses above a confirmed resistance level.
Validates that the channel width between support and resistance does not exceed a user-defined maximum percentage — ensuring entries occur only in reasonably tight ranges.
2. Independent Take Profit Per Trade
Each trade has its own dynamically calculated take-profit level based on the entry price.
Take profit is set as a percentage above entry, allowing consistent risk-to-reward structure across all positions.
3. Cooldown Mechanism
Prevents consecutive entries immediately after a trade is opened.
Configurable number of bars to wait before allowing a new entry — useful for avoiding overtrading in volatile conditions.
4. Multi-Timeframe SMA Filter
Optionally uses an SMA (Simple Moving Average) on a higher or custom timeframe to filter entries.
Ensures trades are taken only when price is above the SMA and beyond a minimum distance percentage — helping avoid trades against the dominant trend.
5. Position Management
Limits the maximum number of concurrent open trades to control exposure.
Allows pyramiding (multiple entries) with independent exits.
📈 How to Use
1. Add the strategy to your chart.
2. Configure the parameters according to your trading style and market conditions.
3. Enable or disable the SMA filter based on whether you want trend confirmation.
4. Backtest on your preferred symbols and timeframes to validate performance.
Recommended use: This strategy works well on 3-4 minutes timeframe cooldown bars must be 50 or above
This strategy is designed for traders who prefer systematic breakout entries with strict risk controls and the ability to manage multiple positions simultaneously.
🔧 Key Features
1. Support & Resistance Breakout Entry
Identifies swing highs and swing lows using configurable left/right bar parameters.
Enters a long position when price crosses above a confirmed resistance level.
Validates that the channel width between support and resistance does not exceed a user-defined maximum percentage — ensuring entries occur only in reasonably tight ranges.
2. Independent Take Profit Per Trade
Each trade has its own dynamically calculated take-profit level based on the entry price.
Take profit is set as a percentage above entry, allowing consistent risk-to-reward structure across all positions.
3. Cooldown Mechanism
Prevents consecutive entries immediately after a trade is opened.
Configurable number of bars to wait before allowing a new entry — useful for avoiding overtrading in volatile conditions.
4. Multi-Timeframe SMA Filter
Optionally uses an SMA (Simple Moving Average) on a higher or custom timeframe to filter entries.
Ensures trades are taken only when price is above the SMA and beyond a minimum distance percentage — helping avoid trades against the dominant trend.
5. Position Management
Limits the maximum number of concurrent open trades to control exposure.
Allows pyramiding (multiple entries) with independent exits.
📈 How to Use
1. Add the strategy to your chart.
2. Configure the parameters according to your trading style and market conditions.
3. Enable or disable the SMA filter based on whether you want trend confirmation.
4. Backtest on your preferred symbols and timeframes to validate performance.
Recommended use: This strategy works well on 3-4 minutes timeframe cooldown bars must be 50 or above
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.