Skip to content

Ahmed-GoCode/tradingview-strategy-collection

Repository files navigation

πŸ“ˆ Pine Script Trading Strategies Collection

TradingView Pine Script Status Author


🎯 About This Collection

A comprehensive collection of 3 Professional Pine Script Trading Strategies developed and optimized for TradingView. Each strategy is carefully crafted to provide specific trading advantages and updated to the latest Pine Script v5 for optimal performance.

Created by: Ahmed-GoCode
Updated: September 2025
Version: Pine Script v5

πŸ“Š Strategies Included:

  1. 🎯 DCA Bollinger Strategy - Dollar Cost Averaging with Mean Reversion
  2. ⚑ MACD+RSI Indicator - Combined Momentum & Oscillator Analysis
  3. πŸ”„ Scalping PAC Tool - Price Action Channel Scalping System

πŸš€ How to Use These Scripts

βš™οΈ Step-by-Step Installation

  1. Open TradingView in your web browser
  2. Navigate to Pine Editor (bottom of the screen)
  3. Copy the desired strategy code from the .pinescript files
  4. Paste the code into the Pine Editor
  5. Click "Add to Chart" to apply the strategy
  6. Adjust parameters in the strategy settings panel
  7. Enable alerts if you want notifications

πŸ“Š Choosing the Right Strategy

  • For Long-term Investment: Use DCA Bollinger Strategy
  • For Technical Analysis: Use MACD+RSI Indicator
  • For Day Trading: Use Scalping PAC Tool

πŸ“ˆ Strategy Details

1. πŸ’° DCA Bollinger Strategy

File: DCA STRATEGY + BB +Reversion.pinescript

Strategy Timeframe Risk

🎯 Purpose: This strategy automates Dollar Cost Averaging (DCA) by purchasing assets when prices cross below the lower Bollinger Band, implementing a mean reversion approach.

πŸ’‘ How it Works:

  • Monitors price action relative to Bollinger Bands calculated on your chosen timeframe
  • Executes buy orders when price crosses under the lower band (oversold condition)
  • Automatically closes all positions on your specified end date
  • Uses configurable investment amounts for each trade

πŸ“ˆ Best Used For:

  • Long-term accumulation strategies
  • Volatile markets with mean-reverting behavior
  • Automated investment without emotional decision-making
  • Building positions during market dips

βš™οΈ Key Settings:

  • Investment Amount: Dollar amount per trade (default: $100)
  • Date Range: Start and end dates for the strategy
  • Bollinger Period: Moving average length (default: 200)
  • Standard Deviation: Band width multiplier (default: 2.0)
  • Timeframe: Chart timeframe for calculations (default: 4H)

🎨 Visual Elements:

  • Red middle line (Bollinger Band basis)
  • Blue upper and lower bands
  • Blue fill between bands
  • Background colors: Red (price above upper band), Green (price below lower band)

2. πŸ“Š MACD+RSI Combined Indicator

File: MACD+RSI.pinescript

Indicator Timeframe Signals

🎯 Purpose: Combines two powerful technical indicators (MACD and RSI) in a single oscillator pane for comprehensive momentum and overbought/oversold analysis.

πŸ’‘ How it Works:

  • MACD shows momentum through the difference between fast and slow moving averages
  • RSI indicates overbought (above +1000) and oversold (below -1000) conditions
  • Histogram displays the difference between MACD line and signal line
  • Color-coded visualization makes trend identification easier

πŸ“ˆ Best Used For:

  • Identifying trend changes and momentum shifts
  • Finding overbought/oversold entry points
  • Confirming signals from other indicators
  • Multi-timeframe analysis across different charts

βš™οΈ Key Settings:

  • MACD Fast Length: Fast EMA period (default: 12)
  • MACD Slow Length: Slow EMA period (default: 26)
  • Signal Smoothing: Signal line EMA period (default: 9)
  • RSI Length: RSI calculation period (default: 14)
  • MA Types: Choose between SMA or EMA for calculations

🎨 Visual Elements:

  • Blue MACD line showing momentum
  • Orange signal line for crossover signals
  • Color-coded histogram (green for bullish, red for bearish)
  • Green RSI line scaled to match MACD
  • Purple background highlighting RSI extreme zones

3. ⚑ Scalping PAC Tool

File: Scalping-Pullback.pinescript

Scalping Timeframe Speed

🎯 Purpose: Advanced scalping system using Price Action Channel (PAC) methodology to identify high-probability pullback entries in trending markets.

πŸ’‘ How it Works:

  • Creates a Price Action Channel using EMA of high, low, and close
  • Identifies trend direction using multiple EMA ribbons (fast, medium, slow)
  • Detects pullbacks when price moves from outside PAC back into the channel
  • Generates buy/sell arrows when price exits PAC in the trend direction
  • Includes fractal recognition for key support/resistance levels

πŸ“ˆ Best Used For:

  • Scalping on 1-minute to 15-minute charts
  • Trading pullbacks in trending markets
  • Quick entries and exits with tight stops
  • Day trading with high-frequency signals

βš™οΈ Key Settings:

  • PAC Length: Price Action Channel period (default: 34)
  • Fast EMA: Quick trend EMA (default: 89)
  • Medium EMA: Main trend EMA (default: 200)
  • Slow EMA: Long-term trend EMA (default: 600)
  • Lookback: Bars to look back for PAC cross (default: 3)
  • Heikin Ashi: Option to use HA candles for calculations

🎨 Visual Elements:

  • Gray PAC channel with red center line
  • Green/blue/black EMA ribbon for trend identification
  • Color-coded bars: Blue (above PAC), Red (below PAC), Gray (inside PAC)
  • Background colors: Green (uptrend), Red (downtrend), Yellow (neutral)
  • Buy/sell arrows for entry signals
  • Fractal markers showing swing highs/lows

πŸ“Š Additional Features:

  • Higher High/Lower Low detection for trendline drawing
  • Built-in alert conditions for automated notifications
  • Support for both regular and Heikin Ashi candle calculations
  • Customizable display options for all visual elements

🎨 Understanding the Visual Elements

🌈 Color System Guide

  • 🟒 Green Elements: Bullish signals, uptrend conditions, buy zones
  • πŸ”΄ Red Elements: Bearish signals, downtrend conditions, sell zones
  • 🟑 Yellow Elements: Neutral conditions, trend transitions
  • πŸ”΅ Blue Elements: Support levels, upper band conditions
  • βšͺ Gray Elements: Consolidation zones, channel boundaries

πŸ“Š Chart Element Meanings

  • Lines: Moving averages, Bollinger Bands, Price Action Channel boundaries
  • Arrows: Entry and exit signal points for trades
  • Background Colors: Overall trend direction and market conditions
  • Histograms: Momentum strength in MACD indicator
  • Shapes: Important price levels like fractals and swing points

βš™οΈ Configuration and Setup Guide

πŸŽ›οΈ Getting Started

1. Choose Your Trading Style:

  • Long-term Investing: Start with DCA Bollinger Strategy on daily/4H charts
  • Technical Analysis: Use MACD+RSI on any timeframe for signal confirmation
  • Day Trading: Apply Scalping PAC Tool on 1m-15m charts for quick trades

2. Parameter Optimization:

  • Conservative Approach: Use default settings initially
  • Aggressive Trading: Reduce moving average periods for faster signals
  • Custom Markets: Adjust Bollinger Band standard deviation based on volatility

3. Risk Management Setup:

  • Set appropriate position sizes based on your account
  • Configure stop-loss levels according to your risk tolerance
  • Use TradingView alerts to avoid missing signals

πŸ’‘ Best Practices

For DCA Strategy:

  • Use on assets you believe in long-term
  • Set reasonable investment amounts per trade
  • Choose longer timeframes (4H, Daily) for better signals
  • Monitor during high volatility periods

For MACD+RSI Indicator:

  • Look for MACD line crossing above/below signal line
  • Watch for RSI extreme readings (+1000/-1000) for reversal signals
  • Combine with price action for confirmation
  • Use on multiple timeframes for stronger signals

For Scalping PAC Tool:

  • Focus on liquid markets with tight spreads
  • Trade only during active market hours
  • Watch for clear trend direction before entering
  • Use quick profit targets and tight stops

πŸ“Š Strategy Performance Notes

πŸ“ˆ Important Considerations

DCA Bollinger Strategy:

  • Works best in volatile, mean-reverting markets
  • Requires patience as positions may take time to become profitable
  • Best suited for assets you believe in long-term
  • Performance improves with longer backtesting periods

MACD+RSI Indicator:

  • More effective in trending markets than sideways markets
  • Combine with other indicators for confirmation
  • False signals can occur during low volatility periods
  • Works well across different timeframes

Scalping PAC Tool:

  • Requires active monitoring and quick decision-making
  • Performance heavily dependent on market liquidity
  • Best during high-volume trading sessions
  • May produce many signals - filter based on trend strength

⚠️ Remember: Past performance doesn't guarantee future results. Always test strategies thoroughly before live trading.


πŸ› οΈ Technical Specifications

πŸ“‹ Requirements

  • Platform: TradingView (Free/Pro/Premium)
  • Version: Pine Script v5
  • Compatibility: All TradingView plans
  • Languages: English interface

πŸ”§ Dependencies

  • No external dependencies
  • Built-in TradingView functions only
  • Cross-platform compatible

οΏ½ Practical Usage Examples

οΏ½ Example 1: Setting Up DCA Strategy

1. Set Investment Amount to your preferred dollar amount (e.g., $50)
2. Choose start date (e.g., January 1, 2024)  
3. Set end date for your DCA period (e.g., December 31, 2024)
4. Select 4H or Daily timeframe for Bollinger Band calculations
5. Adjust Standard Deviation if market is very volatile (increase to 2.5-3.0)

οΏ½ Example 2: Using MACD+RSI for Entries

1. Apply indicator to your chart (works on any timeframe)
2. Look for MACD line crossing above signal line (bullish)
3. Confirm RSI is not extremely overbought (above +1000)
4. Enter long position when both conditions align
5. Exit when MACD crosses back below signal line

πŸ“Š Example 3: Scalping with PAC Tool

1. Apply to 5-minute chart of a liquid asset (e.g., EUR/USD)
2. Wait for clear trend: background should be green or red (not yellow)
3. Look for price to pull back into the gray PAC channel
4. Enter when you see buy/sell arrow appear
5. Set tight stop-loss just outside the PAC channel
6. Take profit at next resistance/support level

🚨 Important Disclaimers

⚠️ Risk Warning: Trading involves substantial risk of loss. Never trade with money you cannot afford to lose.

⚠️ No Financial Advice: These scripts are for educational purposes. Always do your own research.

⚠️ Backtesting: Historical performance doesn't guarantee future results.


🀝 Contributing

We welcome contributions! Here's how you can help:

  1. πŸ› Report Bugs - Found an issue? Let us know!
  2. πŸ’‘ Suggest Features - Have ideas? Share them!
  3. πŸ”§ Submit Pull Requests - Improve the code
  4. πŸ“– Improve Documentation - Help others understand

πŸ“ž Support & Contact

GitHub TradingView

πŸ“§ Get Help

  • GitHub Issues: Report bugs or request features
  • TradingView Comments: Ask questions on script publications
  • Community Support: Share your experiences and improvements

πŸ™ Acknowledgments

Special thanks to:

  • 🎯 TradingView for the amazing Pine Script platform
  • πŸ“Š Trading Community for feedback and suggestions
  • πŸ’‘ Original Authors of referenced techniques

⭐ If you find this helpful, please give it a star! ⭐

Made with Love Pine Script

Happy Trading! πŸ“ˆπŸ’°


πŸ’­ Investment Wisdom

"The stock market is a device for transferring money from the impatient to the patient." - Warren Buffett

About

Pine Script v5 trading strategies: DCA automation, MACD+RSI indicator, and scalping tool for TradingView.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published