Hello friends,
A member of the community approached me and asked me how to write an indicator that would achieve a particular set of goals involving comprehensive trend analysis, risk management, and session-based trading controls. Here is one example method of how to create such a system:
Core Strategy Components
- Multi-Moving Average System - Uses configurable MA types (EMA, SMA, SMMA) with short-term (9) and long-term (21) periods for primary signal generation through crossovers
- Higher Timeframe Trend Filter - Optional trend confirmation using a separate MA (default 50-period) to ensure trades align with broader market direction
- Band Power Indicator - Dynamic high/low bands calculated using different MA types to identify price channels and volatility zones
Advanced Signal Filtering
- Bollinger Bands Volatility Filter - Prevents trading during low-volatility ranging markets by requiring sufficient band width
- RSI Momentum Filter - Uses customizable thresholds (55 for longs, 45 for shorts) to confirm momentum direction
- MACD Trend Confirmation - Ensures MACD line position relative to signal line aligns with trade direction
- Stochastic Oscillator - Adds momentum confirmation with overbought/oversold levels
- ADX Strength Filter - Only allows trades when trend strength exceeds 25 threshold
Session-Based Trading Management
- Four Trading Sessions - Asia (18:00-00:00), London (00:00-08:00), NY AM (08:00-13:00), NY PM (13:00-18:00)
- Individual Session Limits - Separate maximum trade counts for each session (default 5 per session)
- Automatic Session Closure - All positions close at specified market close time
Risk Management Features
- Multiple Stop Loss Options - Percentage-based, MA cross, or band-based SL methods
- Risk/Reward Ratio - Configurable TP levels based on SL distance (default 1:2)
- Auto-Risk Calculation - Dynamic position sizing based on dollar risk limits ($150-$250 range)
- Daily Limits - Stop trading after reaching specified TP or SL counts per day
Support & Resistance System
- Multiple Pivot Types - Traditional, Fibonacci, Woodie, Classic, DM, and Camarilla calculations
- Flexible Timeframes - Auto-adjusting or manual timeframe selection for S/R levels
- Historical Levels - Configurable number of past S/R levels to display
- Visual Customization - Individual color and display settings for each S/R level
Additional Features
- Alert System - Customizable buy/sell alert messages with once-per-bar frequency
- Visual Trade Management - Color-coded entry, SL, and TP levels with fill areas
- Session Highlighting - Optional background colors for different trading sessions
- Comprehensive Filtering - All signals must pass through multiple confirmation layers before execution
This approach demonstrates how to build a professional-grade trading system that combines multiple technical analysis methods with robust risk management and session-based controls, suitable for algorithmic trading across different market sessions.
Good luck and stay safe!
Phát hành các Ghi chú
- Added example slippage and commission for the presented
- In the code, there was a mention and usage of alexgrover's function from the following script: https://www.tradingview.com/script/gD1gDOyI-Intersection-Value-Functions/
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Coding services -> Telegram: @alex_everget
A list of FREE indicators:
bit.ly/2S7EPuN
A list of PAID indicators:
bit.ly/33MA81f
Earn $15:
tradingview.com/pricing/?share_your_love=everget
A list of FREE indicators:
bit.ly/2S7EPuN
A list of PAID indicators:
bit.ly/33MA81f
Earn $15:
tradingview.com/pricing/?share_your_love=everget
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Coding services -> Telegram: @alex_everget
A list of FREE indicators:
bit.ly/2S7EPuN
A list of PAID indicators:
bit.ly/33MA81f
Earn $15:
tradingview.com/pricing/?share_your_love=everget
A list of FREE indicators:
bit.ly/2S7EPuN
A list of PAID indicators:
bit.ly/33MA81f
Earn $15:
tradingview.com/pricing/?share_your_love=everget
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.