OPEN-SOURCE SCRIPT
Range Filter Strategy [Arabic Real Backtest]

استراتيجية مرشح النطاق - اختبار واقعي
نظرة عامة
استراتيجية مرشح النطاق المتقدمة مصممة للاختبار الواقعي مع توقيت تنفيذ دقيق وإدارة مخاطر شاملة. تم بناؤها خصيصًا لأسواق العملات الرقمية مع معلمات قابلة للتخصيص لأصول وفترات زمنية مختلفة.
الخوارزمية الأساسية
تقنية مرشح النطاق:
* حساب متوسط النطاق السلس باستخدام فلترة مزدوجة للـ EMA
* فلترة أسعار استنادًا إلى النطاق الديناميكي لتحديد اتجاه الاتجاه
* نظام فلترة ضد الضوضاء لتقليل الإشارات الخاطئة
* تتبع الزخم الاتجاهي مع عدادات للأعلى/للأسفل
الميزات الرئيسية
**التنفيذ الفوري (بدون تأخير)**
* معالجة الأوامر عند كل نقطة: تنفيذ فوري دون انتظار إغلاق الشمعة
* تكامل مكبر الشمعة للحصول على دقة داخل الشمعة
* الحساب في كل نقطة لضمان الاستجابة القصوى
* تجاوز OHLC القياسي لزيادة الدقة
**محاكاة الأسعار الواقعية**
* تسعير الدخول باستخدام HL2 (High+Low)/2 لملء واقعي
* محاكاة للبُعد العازل للسعر القابل للتخصيص
* إنشاء انزلاق عشوائي (من 0 إلى الحد الأقصى للانزلاق)
* التحقق من سيولة السوق قبل الدخول
**فلترة الإشارات المتقدمة**
* فلترة استنادًا إلى الحجم مع نسبة قابلة للتخصيص
* نظام تأكيد الإشارة اختياري (من 1 إلى 3 شموع)
* منطق مضاد للتكرار لمنع الإشارات المكررة
* التحكم في حد التداول اليومي
**إدارة المخاطر**
* نسب ثابتة للمخاطرة: العائد مع حساب دقيق للنقاط
* تنفيذ وقف الخسارة وجني الأرباح تلقائيًا
* إدارة حجم المركز
* تحديد الحد الأقصى للصفقات اليومية
**نظام التنبيهات**
* تنبيهات فورية متزامنة مع تنفيذ الاستراتيجية
* أنواع متعددة من التنبيهات: إعداد، دخول، خروج، حالة
* تخصيص تنسيق الرسائل مع تضمين السعر/الوقت
* تكامل مع لوحة تنبيهات TradingView
المعلمات الافتراضية
محسن لرسوم بيانية لفترة 5 دقائق لبيتكوين:
* فترة العينة: 100
* معامل النطاق: 3.0
* المخاطرة: 50 نقطة
* المكافأة: 100 نقطة (نسبة 1:2)
* بُعد الانتشار: 2.0 نقطة
* الحد الأقصى للانزلاق: 1.0 نقطة
منطق الإشارة
**شروط الدخول الطويل:**
* السعر فوق خط مرشح النطاق
* تأكيد الزخم الصاعد
* تلبية متطلبات الحجم (إذا تم تمكينها)
* اكتمال فترة التأكيد (إذا تم تمكينها)
* لم يتم تجاوز حد الصفقات اليومية
**شروط الدخول القصير:**
* السعر تحت خط مرشح النطاق
* تأكيد الزخم الهابط
* تلبية متطلبات الحجم (إذا تم تمكينها)
* اكتمال فترة التأكيد (إذا تم تمكينها)
* لم يتم تجاوز حد الصفقات اليومية
العناصر البصرية
* خط مرشح النطاق مع تلوين الاتجاه
* الأشرطة العليا والسفلى المستهدفة
* علامات إشارات الدخول
* صناديق نسبة المخاطرة/العائد
* لوحة إعدادات حية
خيارات التخصيص
**التكيف مع السوق:**
* تعديل فترة العينة لبيانات الزمن المختلفة
* تعديل معامل النطاق لمستويات التقلب المختلفة
* تكوين الانتشار/الانزلاق لوسطاء مختلفين
* تحديد النسب المناسبة للمخاطرة/العائد حسب أسلوب التداول
**ضوابط الفلترة:**
* تمكين/تعطيل فلترة الحجم
* تعديل متطلبات التأكيد
* تعيين حدود الصفقات اليومية
* تخصيص تفضيلات التنبيه
الميزات المتعلقة بالأداء
* نتائج اختبار واقعية متوافقة مع التداول المباشر
* القضاء على تحيز المستقبل
* محاكاة تنفيذ الأوامر بشكل صحيح
* إحصائيات تداول شاملة
تكوين التنبيه
**أنواع التنبيهات المتاحة:**
* إشارات الدخول مع معلومات التداول الكاملة
* تنبيهات الإعداد للتحضير المبكر
* إشعارات الخروج لإدارة المراكز
* فلترة التغيرات في الاتجاه لظروف السوق
**تنسيق الرسائل:**
رمز - الإجراء | السعر: XX.XX | الوقف: XX.XX | الهدف: XX.XX | الوقت: HH\:MM
التوصيات لاستخدام الاستراتيجية
**الإعدادات المثلى:**
* بيتكوين/العملات الرقمية الرئيسية: المعلمات الافتراضية
* الفوركس: تقليل فترة العينة إلى 50-70، المعامل إلى 2.0-2.5
* الأسهم: تقليل فترة العينة إلى 30-50، المعامل إلى 1.0-1.8
* الذهب: فترة العينة 60-80، المعامل 1.5-2.0
**تكوين TradingView:**
* إعادة الحساب: "على كل نقطة"
* الأوامر: "استخدام مكبر الشمعة"
* البيانات: يوصى باستخدام التغذية الحية
إخلاء المسؤولية
تم تصميم هذه الاستراتيجية لأغراض تعليمية وتحليلية. الأداء السابق لا يضمن النتائج المستقبلية. يجب دائمًا إجراء اختبارات شاملة على التداول الورقي قبل التنفيذ المباشر. يجب أخذ ظروف السوق، تنفيذ الوسيط، والتحمل الشخصي للمخاطر في الاعتبار عند استخدام أي نظام تداول آلي.
Range Filter Strategy - Real Backtesting
# Overview
Advanced Range Filter strategy designed for realistic backtesting with precise execution timing and comprehensive risk management. Built specifically for cryptocurrency markets with customizable parameters for different assets and timeframes.
Core Algorithm
Range Filter Technology:
- Smooth Average Range calculation using dual EMA filtering
- Dynamic range-based price filtering to identify trend direction
- Anti-noise filtering system to reduce false signals
- Directional momentum tracking with upward/downward counters
Key Features
Real-Time Execution (No Delay)
- Process orders on tick: Immediate execution without waiting for bar close
- Bar magnifier integration for intrabar precision
- Calculate on every tick for maximum responsiveness
- Standard OHLC bypass for enhanced accuracy
Realistic Price Simulation
- HL2 entry pricing (High+Low)/2 for realistic fills
- Configurable spread buffer simulation
- Random slippage generation (0 to max slippage)
- Market liquidity validation before entry
Advanced Signal Filtering
- Volume-based filtering with customizable ratio
- Optional signal confirmation system (1-3 bars)
- Anti-repetition logic to prevent duplicate signals
- Daily trade limit controls
Risk Management
- Fixed Risk:Reward ratios with precise point calculation
- Automatic stop loss and take profit execution
- Position size management
- Maximum daily trades limitation
Alert System
- Real-time alerts synchronized with strategy execution
- Multiple alert types: Setup, Entry, Exit, Status
- Customizable message formatting with price/time inclusion
- TradingView alert panel integration
Default Parameters
Optimized for BTC 5-minute charts:
- Sampling Period: 100
- Range Multiplier: 3.0
- Risk: 50 points
- Reward: 100 points (1:2 R:R)
- Spread Buffer: 2.0 points
- Max Slippage: 1.0 points
Signal Logic
Long Entry Conditions:
- Price above Range Filter line
- Upward momentum confirmed
- Volume requirements met (if enabled)
- Confirmation period completed (if enabled)
- Daily trade limit not exceeded
Short Entry Conditions:
- Price below Range Filter line
- Downward momentum confirmed
- Volume requirements met (if enabled)
- Confirmation period completed (if enabled)
- Daily trade limit not exceeded
Visual Elements
- Range Filter line with directional coloring
- Upper and lower target bands
- Entry signal markers
- Risk/Reward ratio boxes
- Real-time settings dashboard
Customization Options
Market Adaptation:
- Adjust Sampling Period for different timeframes
- Modify Range Multiplier for various volatility levels
- Configure spread/slippage for different brokers
- Set appropriate R:R ratios for trading style
Filtering Controls:
- Enable/disable volume filtering
- Adjust confirmation requirements
- Set daily trade limits
- Customize alert preferences
Performance Features
- Realistic backtesting results aligned with live trading
- Elimination of look-ahead bias
- Proper order execution simulation
- Comprehensive trade statistics
Alert Configuration
Alert Types Available:
- Entry signals with complete trade information
- Setup alerts for early preparation
- Exit notifications for position management
- Filter direction changes for market context
Message Format:
Symbol - Action | Price: XX.XX | Stop: XX.XX | Target: XX.XX | Time: HH:MM
Usage Recommendations
Optimal Settings:
- Bitcoin/Major Crypto: Default parameters
- Forex: Reduce sampling period to 50-70, multiplier to 2.0-2.5
- Stocks: Reduce sampling period to 30-50, multiplier to 1.0-1.8
- Gold: Sampling period 60-80, multiplier 1.5-2.0
TradingView Configuration:
- Recalculate: "On every tick"
- Orders: "Use bar magnifier"
- Data: Real-time feed recommended
Risk Disclaimer
This strategy is designed for educational and analytical purposes. Past performance does not guarantee future results. Always test thoroughly on paper trading before live implementation. Consider market conditions, broker execution, and personal risk tolerance when using any automated trading system.
نظرة عامة
استراتيجية مرشح النطاق المتقدمة مصممة للاختبار الواقعي مع توقيت تنفيذ دقيق وإدارة مخاطر شاملة. تم بناؤها خصيصًا لأسواق العملات الرقمية مع معلمات قابلة للتخصيص لأصول وفترات زمنية مختلفة.
الخوارزمية الأساسية
تقنية مرشح النطاق:
* حساب متوسط النطاق السلس باستخدام فلترة مزدوجة للـ EMA
* فلترة أسعار استنادًا إلى النطاق الديناميكي لتحديد اتجاه الاتجاه
* نظام فلترة ضد الضوضاء لتقليل الإشارات الخاطئة
* تتبع الزخم الاتجاهي مع عدادات للأعلى/للأسفل
الميزات الرئيسية
**التنفيذ الفوري (بدون تأخير)**
* معالجة الأوامر عند كل نقطة: تنفيذ فوري دون انتظار إغلاق الشمعة
* تكامل مكبر الشمعة للحصول على دقة داخل الشمعة
* الحساب في كل نقطة لضمان الاستجابة القصوى
* تجاوز OHLC القياسي لزيادة الدقة
**محاكاة الأسعار الواقعية**
* تسعير الدخول باستخدام HL2 (High+Low)/2 لملء واقعي
* محاكاة للبُعد العازل للسعر القابل للتخصيص
* إنشاء انزلاق عشوائي (من 0 إلى الحد الأقصى للانزلاق)
* التحقق من سيولة السوق قبل الدخول
**فلترة الإشارات المتقدمة**
* فلترة استنادًا إلى الحجم مع نسبة قابلة للتخصيص
* نظام تأكيد الإشارة اختياري (من 1 إلى 3 شموع)
* منطق مضاد للتكرار لمنع الإشارات المكررة
* التحكم في حد التداول اليومي
**إدارة المخاطر**
* نسب ثابتة للمخاطرة: العائد مع حساب دقيق للنقاط
* تنفيذ وقف الخسارة وجني الأرباح تلقائيًا
* إدارة حجم المركز
* تحديد الحد الأقصى للصفقات اليومية
**نظام التنبيهات**
* تنبيهات فورية متزامنة مع تنفيذ الاستراتيجية
* أنواع متعددة من التنبيهات: إعداد، دخول، خروج، حالة
* تخصيص تنسيق الرسائل مع تضمين السعر/الوقت
* تكامل مع لوحة تنبيهات TradingView
المعلمات الافتراضية
محسن لرسوم بيانية لفترة 5 دقائق لبيتكوين:
* فترة العينة: 100
* معامل النطاق: 3.0
* المخاطرة: 50 نقطة
* المكافأة: 100 نقطة (نسبة 1:2)
* بُعد الانتشار: 2.0 نقطة
* الحد الأقصى للانزلاق: 1.0 نقطة
منطق الإشارة
**شروط الدخول الطويل:**
* السعر فوق خط مرشح النطاق
* تأكيد الزخم الصاعد
* تلبية متطلبات الحجم (إذا تم تمكينها)
* اكتمال فترة التأكيد (إذا تم تمكينها)
* لم يتم تجاوز حد الصفقات اليومية
**شروط الدخول القصير:**
* السعر تحت خط مرشح النطاق
* تأكيد الزخم الهابط
* تلبية متطلبات الحجم (إذا تم تمكينها)
* اكتمال فترة التأكيد (إذا تم تمكينها)
* لم يتم تجاوز حد الصفقات اليومية
العناصر البصرية
* خط مرشح النطاق مع تلوين الاتجاه
* الأشرطة العليا والسفلى المستهدفة
* علامات إشارات الدخول
* صناديق نسبة المخاطرة/العائد
* لوحة إعدادات حية
خيارات التخصيص
**التكيف مع السوق:**
* تعديل فترة العينة لبيانات الزمن المختلفة
* تعديل معامل النطاق لمستويات التقلب المختلفة
* تكوين الانتشار/الانزلاق لوسطاء مختلفين
* تحديد النسب المناسبة للمخاطرة/العائد حسب أسلوب التداول
**ضوابط الفلترة:**
* تمكين/تعطيل فلترة الحجم
* تعديل متطلبات التأكيد
* تعيين حدود الصفقات اليومية
* تخصيص تفضيلات التنبيه
الميزات المتعلقة بالأداء
* نتائج اختبار واقعية متوافقة مع التداول المباشر
* القضاء على تحيز المستقبل
* محاكاة تنفيذ الأوامر بشكل صحيح
* إحصائيات تداول شاملة
تكوين التنبيه
**أنواع التنبيهات المتاحة:**
* إشارات الدخول مع معلومات التداول الكاملة
* تنبيهات الإعداد للتحضير المبكر
* إشعارات الخروج لإدارة المراكز
* فلترة التغيرات في الاتجاه لظروف السوق
**تنسيق الرسائل:**
رمز - الإجراء | السعر: XX.XX | الوقف: XX.XX | الهدف: XX.XX | الوقت: HH\:MM
التوصيات لاستخدام الاستراتيجية
**الإعدادات المثلى:**
* بيتكوين/العملات الرقمية الرئيسية: المعلمات الافتراضية
* الفوركس: تقليل فترة العينة إلى 50-70، المعامل إلى 2.0-2.5
* الأسهم: تقليل فترة العينة إلى 30-50، المعامل إلى 1.0-1.8
* الذهب: فترة العينة 60-80، المعامل 1.5-2.0
**تكوين TradingView:**
* إعادة الحساب: "على كل نقطة"
* الأوامر: "استخدام مكبر الشمعة"
* البيانات: يوصى باستخدام التغذية الحية
إخلاء المسؤولية
تم تصميم هذه الاستراتيجية لأغراض تعليمية وتحليلية. الأداء السابق لا يضمن النتائج المستقبلية. يجب دائمًا إجراء اختبارات شاملة على التداول الورقي قبل التنفيذ المباشر. يجب أخذ ظروف السوق، تنفيذ الوسيط، والتحمل الشخصي للمخاطر في الاعتبار عند استخدام أي نظام تداول آلي.
Range Filter Strategy - Real Backtesting
# Overview
Advanced Range Filter strategy designed for realistic backtesting with precise execution timing and comprehensive risk management. Built specifically for cryptocurrency markets with customizable parameters for different assets and timeframes.
Core Algorithm
Range Filter Technology:
- Smooth Average Range calculation using dual EMA filtering
- Dynamic range-based price filtering to identify trend direction
- Anti-noise filtering system to reduce false signals
- Directional momentum tracking with upward/downward counters
Key Features
Real-Time Execution (No Delay)
- Process orders on tick: Immediate execution without waiting for bar close
- Bar magnifier integration for intrabar precision
- Calculate on every tick for maximum responsiveness
- Standard OHLC bypass for enhanced accuracy
Realistic Price Simulation
- HL2 entry pricing (High+Low)/2 for realistic fills
- Configurable spread buffer simulation
- Random slippage generation (0 to max slippage)
- Market liquidity validation before entry
Advanced Signal Filtering
- Volume-based filtering with customizable ratio
- Optional signal confirmation system (1-3 bars)
- Anti-repetition logic to prevent duplicate signals
- Daily trade limit controls
Risk Management
- Fixed Risk:Reward ratios with precise point calculation
- Automatic stop loss and take profit execution
- Position size management
- Maximum daily trades limitation
Alert System
- Real-time alerts synchronized with strategy execution
- Multiple alert types: Setup, Entry, Exit, Status
- Customizable message formatting with price/time inclusion
- TradingView alert panel integration
Default Parameters
Optimized for BTC 5-minute charts:
- Sampling Period: 100
- Range Multiplier: 3.0
- Risk: 50 points
- Reward: 100 points (1:2 R:R)
- Spread Buffer: 2.0 points
- Max Slippage: 1.0 points
Signal Logic
Long Entry Conditions:
- Price above Range Filter line
- Upward momentum confirmed
- Volume requirements met (if enabled)
- Confirmation period completed (if enabled)
- Daily trade limit not exceeded
Short Entry Conditions:
- Price below Range Filter line
- Downward momentum confirmed
- Volume requirements met (if enabled)
- Confirmation period completed (if enabled)
- Daily trade limit not exceeded
Visual Elements
- Range Filter line with directional coloring
- Upper and lower target bands
- Entry signal markers
- Risk/Reward ratio boxes
- Real-time settings dashboard
Customization Options
Market Adaptation:
- Adjust Sampling Period for different timeframes
- Modify Range Multiplier for various volatility levels
- Configure spread/slippage for different brokers
- Set appropriate R:R ratios for trading style
Filtering Controls:
- Enable/disable volume filtering
- Adjust confirmation requirements
- Set daily trade limits
- Customize alert preferences
Performance Features
- Realistic backtesting results aligned with live trading
- Elimination of look-ahead bias
- Proper order execution simulation
- Comprehensive trade statistics
Alert Configuration
Alert Types Available:
- Entry signals with complete trade information
- Setup alerts for early preparation
- Exit notifications for position management
- Filter direction changes for market context
Message Format:
Symbol - Action | Price: XX.XX | Stop: XX.XX | Target: XX.XX | Time: HH:MM
Usage Recommendations
Optimal Settings:
- Bitcoin/Major Crypto: Default parameters
- Forex: Reduce sampling period to 50-70, multiplier to 2.0-2.5
- Stocks: Reduce sampling period to 30-50, multiplier to 1.0-1.8
- Gold: Sampling period 60-80, multiplier 1.5-2.0
TradingView Configuration:
- Recalculate: "On every tick"
- Orders: "Use bar magnifier"
- Data: Real-time feed recommended
Risk Disclaimer
This strategy is designed for educational and analytical purposes. Past performance does not guarantee future results. Always test thoroughly on paper trading before live implementation. Consider market conditions, broker execution, and personal risk tolerance when using any automated trading system.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.