OPEN-SOURCE SCRIPT
Options Scalper v2 - SPY/QQQ

Here's a comprehensive description of the Options Scalper v2 strategy:
---
## Options Scalper v2 - SPY/QQQ
### Overview
A multi-indicator confluence-based scalping strategy designed for trading SPY and QQQ options on short timeframes (1-5 minute charts). The strategy uses a scoring system to generate high-probability CALL and PUT signals by requiring alignment across multiple technical indicators before triggering entries.
---
### Core Logic
The strategy operates on a **scoring system (0-9 points)** where both bullish (CALL) and bearish (PUT) conditions are evaluated independently. A signal only fires when:
1. A recent EMA crossover occurred (within the last 3 bars)
2. The direction's score meets the minimum threshold (default: 4 points)
3. The signal's score is higher than the opposite direction
4. Enough bars have passed since the last signal (cooldown period)
5. Price action occurs during valid trading sessions
---
### Indicators Used
| Indicator | Purpose | CALL Condition | PUT Condition |
|-----------|---------|----------------|---------------|
| **9/21 EMA Cross** | Primary trigger | Fast EMA crosses above slow | Fast EMA crosses below slow |
| **200 EMA** | Trend filter | Price above 200 EMA | Price below 200 EMA |
| **RSI (14)** | Momentum filter | RSI between 45-65 | RSI between 35-55 |
| **VWAP** | Institutional level | Price above VWAP | Price below VWAP |
| **MACD (12,26,9)** | Momentum confirmation | MACD line > Signal line | MACD line < Signal line |
| **Stochastic (14,3)** | Overbought/Oversold | Oversold or K > D | Overbought or K < D |
| **Volume** | Participation confirmation | Spike on green candle | Spike on red candle |
| **Price Structure** | Breakout detection | Higher high formed | Lower low formed |
---
### Scoring Breakdown
**CALL Score (Max 9 points):**
- Recent EMA cross up: +2 pts
- EMA alignment (fast > slow): +1 pt
- RSI in bullish range: +1 pt
- Above VWAP: +1 pt
- MACD bullish: +1 pt
- Volume spike on green candle: +1 pt
- Stochastic setup: +1 pt
- Above 200 EMA: +1 pt
- Breaking higher high: +1 pt
**PUT Score (Max 9 points):**
- Recent EMA cross down: +2 pts
- EMA alignment (fast < slow): +1 pt
- RSI in bearish range: +1 pt
- Below VWAP: +1 pt
- MACD bearish: +1 pt
- Volume spike on red candle: +1 pt
- Stochastic setup: +1 pt
- Below 200 EMA: +1 pt
- Breaking lower low: +1 pt
---
### Risk Management
The strategy uses **ATR-based dynamic stops and targets**:
| Parameter | Default | Description |
|-----------|---------|-------------|
| Stop Loss | 1.5x ATR | Distance below entry for longs, above for shorts |
| Take Profit | 2.0x ATR | Creates a 1:1.33 risk-reward ratio |
Positions are also closed on:
- Opposite direction signal (flip trade)
- Take profit or stop loss hit
---
### Session Filtering
Trades are restricted to high-liquidity periods by default:
- **Morning Session:** 9:30 AM - 11:00 AM EST
- **Afternoon Session:** 2:30 PM - 3:55 PM EST
This avoids choppy midday price action and captures the highest volume periods.
---
### Input Parameters
| Parameter | Default | Description |
|-----------|---------|-------------|
| Fast EMA | 9 | Fast moving average period |
| Slow EMA | 21 | Slow moving average period |
| Trend EMA | 200 | Long-term trend filter |
| RSI Length | 14 | RSI calculation period |
| RSI Overbought | 65 | Upper RSI threshold |
| RSI Oversold | 35 | Lower RSI threshold |
| Volume Multiplier | 1.2x | Volume spike detection threshold |
| Min Signal Strength | 4 | Minimum score required to trigger |
| Crossover Lookback | 3 | Bars to consider crossover "recent" |
| Min Bars Between Signals | 5 | Cooldown period between signals |
---
### Visual Elements
**Chart Plots:**
- Green line: 9 EMA (fast)
- Red line: 21 EMA (slow)
- Gray line: 200 EMA (trend)
- Purple dots: VWAP
**Signal Markers:**
- Green triangle up + "CALL" label: Buy call signal
- Red triangle down + "PUT" label: Buy put signal
- Small circles: EMA crossover reference points
**Info Table (Top Right):**
- Real-time CALL and PUT scores
- RSI, MACD, Stochastic values
- VWAP and 200 EMA position
- Recent crossover status
- Current signal state
---
### Alerts
| Alert Name | Trigger |
|------------|---------|
| CALL Entry | Standard call signal fires |
| PUT Entry | Standard put signal fires |
| Strong CALL | Call signal with score ≥ 6 |
| Strong PUT | Put signal with score ≥ 6 |
---
### Recommended Usage
| Setting | 0DTE Scalping | Intraday Swings |
|---------|---------------|-----------------|
| Timeframe | 1-2 min | 5 min |
| Min Signal Strength | 5-6 | 4 |
| ATR Stop Mult | 1.0 | 1.5 |
| ATR TP Mult | 1.5 | 2.0 |
| Option Delta | 0.40-0.50 | 0.30-0.40 |
---
### Key Improvements Over v1
1. **Requires actual crossover** - Eliminates false signals from simple trend continuation
2. **Balanced scoring** - Both directions evaluated equally, highest score wins
3. **Signal cooldown** - Prevents overtrading with minimum bar spacing
4. **Multi-indicator confluence** - 8 factors must align for signal generation
5. **Volume-candle alignment** - Volume spikes only count when matching candle direction
---
### Disclaimer
This strategy is for educational purposes. Backtest thoroughly before live trading. Options trading involves significant risk of loss. Past performance does not guarantee future results.
---
## Options Scalper v2 - SPY/QQQ
### Overview
A multi-indicator confluence-based scalping strategy designed for trading SPY and QQQ options on short timeframes (1-5 minute charts). The strategy uses a scoring system to generate high-probability CALL and PUT signals by requiring alignment across multiple technical indicators before triggering entries.
---
### Core Logic
The strategy operates on a **scoring system (0-9 points)** where both bullish (CALL) and bearish (PUT) conditions are evaluated independently. A signal only fires when:
1. A recent EMA crossover occurred (within the last 3 bars)
2. The direction's score meets the minimum threshold (default: 4 points)
3. The signal's score is higher than the opposite direction
4. Enough bars have passed since the last signal (cooldown period)
5. Price action occurs during valid trading sessions
---
### Indicators Used
| Indicator | Purpose | CALL Condition | PUT Condition |
|-----------|---------|----------------|---------------|
| **9/21 EMA Cross** | Primary trigger | Fast EMA crosses above slow | Fast EMA crosses below slow |
| **200 EMA** | Trend filter | Price above 200 EMA | Price below 200 EMA |
| **RSI (14)** | Momentum filter | RSI between 45-65 | RSI between 35-55 |
| **VWAP** | Institutional level | Price above VWAP | Price below VWAP |
| **MACD (12,26,9)** | Momentum confirmation | MACD line > Signal line | MACD line < Signal line |
| **Stochastic (14,3)** | Overbought/Oversold | Oversold or K > D | Overbought or K < D |
| **Volume** | Participation confirmation | Spike on green candle | Spike on red candle |
| **Price Structure** | Breakout detection | Higher high formed | Lower low formed |
---
### Scoring Breakdown
**CALL Score (Max 9 points):**
- Recent EMA cross up: +2 pts
- EMA alignment (fast > slow): +1 pt
- RSI in bullish range: +1 pt
- Above VWAP: +1 pt
- MACD bullish: +1 pt
- Volume spike on green candle: +1 pt
- Stochastic setup: +1 pt
- Above 200 EMA: +1 pt
- Breaking higher high: +1 pt
**PUT Score (Max 9 points):**
- Recent EMA cross down: +2 pts
- EMA alignment (fast < slow): +1 pt
- RSI in bearish range: +1 pt
- Below VWAP: +1 pt
- MACD bearish: +1 pt
- Volume spike on red candle: +1 pt
- Stochastic setup: +1 pt
- Below 200 EMA: +1 pt
- Breaking lower low: +1 pt
---
### Risk Management
The strategy uses **ATR-based dynamic stops and targets**:
| Parameter | Default | Description |
|-----------|---------|-------------|
| Stop Loss | 1.5x ATR | Distance below entry for longs, above for shorts |
| Take Profit | 2.0x ATR | Creates a 1:1.33 risk-reward ratio |
Positions are also closed on:
- Opposite direction signal (flip trade)
- Take profit or stop loss hit
---
### Session Filtering
Trades are restricted to high-liquidity periods by default:
- **Morning Session:** 9:30 AM - 11:00 AM EST
- **Afternoon Session:** 2:30 PM - 3:55 PM EST
This avoids choppy midday price action and captures the highest volume periods.
---
### Input Parameters
| Parameter | Default | Description |
|-----------|---------|-------------|
| Fast EMA | 9 | Fast moving average period |
| Slow EMA | 21 | Slow moving average period |
| Trend EMA | 200 | Long-term trend filter |
| RSI Length | 14 | RSI calculation period |
| RSI Overbought | 65 | Upper RSI threshold |
| RSI Oversold | 35 | Lower RSI threshold |
| Volume Multiplier | 1.2x | Volume spike detection threshold |
| Min Signal Strength | 4 | Minimum score required to trigger |
| Crossover Lookback | 3 | Bars to consider crossover "recent" |
| Min Bars Between Signals | 5 | Cooldown period between signals |
---
### Visual Elements
**Chart Plots:**
- Green line: 9 EMA (fast)
- Red line: 21 EMA (slow)
- Gray line: 200 EMA (trend)
- Purple dots: VWAP
**Signal Markers:**
- Green triangle up + "CALL" label: Buy call signal
- Red triangle down + "PUT" label: Buy put signal
- Small circles: EMA crossover reference points
**Info Table (Top Right):**
- Real-time CALL and PUT scores
- RSI, MACD, Stochastic values
- VWAP and 200 EMA position
- Recent crossover status
- Current signal state
---
### Alerts
| Alert Name | Trigger |
|------------|---------|
| CALL Entry | Standard call signal fires |
| PUT Entry | Standard put signal fires |
| Strong CALL | Call signal with score ≥ 6 |
| Strong PUT | Put signal with score ≥ 6 |
---
### Recommended Usage
| Setting | 0DTE Scalping | Intraday Swings |
|---------|---------------|-----------------|
| Timeframe | 1-2 min | 5 min |
| Min Signal Strength | 5-6 | 4 |
| ATR Stop Mult | 1.0 | 1.5 |
| ATR TP Mult | 1.5 | 2.0 |
| Option Delta | 0.40-0.50 | 0.30-0.40 |
---
### Key Improvements Over v1
1. **Requires actual crossover** - Eliminates false signals from simple trend continuation
2. **Balanced scoring** - Both directions evaluated equally, highest score wins
3. **Signal cooldown** - Prevents overtrading with minimum bar spacing
4. **Multi-indicator confluence** - 8 factors must align for signal generation
5. **Volume-candle alignment** - Volume spikes only count when matching candle direction
---
### Disclaimer
This strategy is for educational purposes. Backtest thoroughly before live trading. Options trading involves significant risk of loss. Past performance does not guarantee future results.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.