OPEN-SOURCE SCRIPT
Slope & MA Cross + Acc + Range Filter

Slope & MA Cross + Acceleration + Angle Filter Strategy
This strategy combines Moving Average Velocity (Slope), Momentum Acceleration, Trigonometric Angle Filtering, and Dynamic Risk Management (Shrinking SL) into a unified quantitative trading framework. It is designed to capture early trend reversals while aggressively filtering out sideways/ranging market noise, especially on lower timeframes (e.g., 3-minute or 5-minute charts).
---
### 🚀 Key Features
#### 1. Momentum Acceleration (Early Signal Logic)
Instead of waiting for price crossovers or MA slope direction changes—which can introduce lag—the strategy measures the 2nd derivative of the Moving Average (Acceleration):
Acceleration = Current Slope - Previous Slope
This allows the algorithm to detect early deceleration at market bottoms/tops before the Moving Average officially changes direction.
#### 2. Scaled Trigonometric Angle Filter
Ranging markets often trigger costly false signals (whipsaws). The strategy calculates the slope angle using the arctangent function:
Angle = degrees(arctan(Price Change % * Multiplier))
Using an Angle Sensitivity Multiplier, micro percentage changes on short timeframes (e.g., 3m) are scaled across a wider degree spectrum, allowing precise filter fine-tuning to ignore sideways consolidation.
#### 3. Dynamic Shrinking Stop Loss
To protect profits during exhausting trends, the strategy features a Shrinking Stop Loss. When a trade reaches a specific profit threshold and momentum starts fading, the stop-loss level dynamically tightens toward the current price structure.
#### 4. Real-Time Dashboard
The built-in table displays live information including:
- Current Position Status & Market Regime (Trending vs. Ranging)
- MA Slope, Acceleration, and Scaled Angle Values
- Real-Time Open PnL (%) and Total Net Profit ($ / %)
---
### ⚙️ How to Use
1. Apply to Chart: Best suited for fast-moving assets on low timeframes (3m / 5m / 15m) using responsive MAs like Hull MA or ALMA.
2. Tune Angle Filter: Adjust Angle Sensitivity Multiplier and Minimum Trend Angle to filter out local consolidation areas.
3. Execution: All trades are executed upon bar confirmation (barstate.isconfirmed) to prevent repainting.
This strategy combines Moving Average Velocity (Slope), Momentum Acceleration, Trigonometric Angle Filtering, and Dynamic Risk Management (Shrinking SL) into a unified quantitative trading framework. It is designed to capture early trend reversals while aggressively filtering out sideways/ranging market noise, especially on lower timeframes (e.g., 3-minute or 5-minute charts).
---
### 🚀 Key Features
#### 1. Momentum Acceleration (Early Signal Logic)
Instead of waiting for price crossovers or MA slope direction changes—which can introduce lag—the strategy measures the 2nd derivative of the Moving Average (Acceleration):
Acceleration = Current Slope - Previous Slope
This allows the algorithm to detect early deceleration at market bottoms/tops before the Moving Average officially changes direction.
#### 2. Scaled Trigonometric Angle Filter
Ranging markets often trigger costly false signals (whipsaws). The strategy calculates the slope angle using the arctangent function:
Angle = degrees(arctan(Price Change % * Multiplier))
Using an Angle Sensitivity Multiplier, micro percentage changes on short timeframes (e.g., 3m) are scaled across a wider degree spectrum, allowing precise filter fine-tuning to ignore sideways consolidation.
#### 3. Dynamic Shrinking Stop Loss
To protect profits during exhausting trends, the strategy features a Shrinking Stop Loss. When a trade reaches a specific profit threshold and momentum starts fading, the stop-loss level dynamically tightens toward the current price structure.
#### 4. Real-Time Dashboard
The built-in table displays live information including:
- Current Position Status & Market Regime (Trending vs. Ranging)
- MA Slope, Acceleration, and Scaled Angle Values
- Real-Time Open PnL (%) and Total Net Profit ($ / %)
---
### ⚙️ How to Use
1. Apply to Chart: Best suited for fast-moving assets on low timeframes (3m / 5m / 15m) using responsive MAs like Hull MA or ALMA.
2. Tune Angle Filter: Adjust Angle Sensitivity Multiplier and Minimum Trend Angle to filter out local consolidation areas.
3. Execution: All trades are executed upon bar confirmation (barstate.isconfirmed) to prevent repainting.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.