PROTECTED SOURCE SCRIPT

Trend Drawing + OB Signal (MTF) [ASCII]

80
Script Description: Advanced Multi-Timeframe Trend Lines & OB/OS Signal [ASCII]
Overview
This advanced Pine Script indicator is designed to identify and project key support and resistance levels using pivot-based trend lines across multiple timeframes. It combines this powerful trend analysis with a sophisticated Overbought/Oversold (OB/OS) detection system using CCI and Bollinger Bands, providing clear trading signals with integrated alert functionality.

Key Features
1. Multi-Timeframe Trend Lines

Automated Pivot Detection: Automatically identifies significant swing highs and lows based on user-defined left/right bar parameters

Smart Timeframe Adaptation: Uses different sensitivity settings for each timeframe (15min to 1Week) for optimal pivot detection

Dynamic Line Projection: Draws trend lines connecting the two most recent pivots and extends them forward

Flexible Source Selection: Choose between Close price, Wick extremes, or Auto mode (Auto uses Wick for higher timeframes, Close for lower timeframes)

2. Advanced OB/OS Detection System

Dual Indicator Confirmation: Combines CCI momentum and Bollinger Band position for reliable signals

Customizable Parameters: Adjustable CCI length, OB/OS thresholds, and Bollinger Band settings

Bar Confirmation Option: Optional wait-for-close confirmation to avoid false signals

Visual Markers: Clear triangle markers above/below bars for quick signal identification

3. Timeframe Support

Available Timeframes: 15min, 30min, 1h, 2h, 4h, 8h, 12h, 1D, 1W

Independent Settings: Custom left/right bar parameters for each timeframe

Automatic Adaptation: Script automatically applies the correct settings for your current chart timeframe

Input Parameters
Trend Lines Configuration

Left/Right Bars: Defines the pivot detection sensitivity for each timeframe

Line Length: Controls how far trend lines extend into the future

Line Source: Choose between Close, Wick, or Auto selection

Colors: Customizable support/resistance line colors

OB/OS Signal Settings

CCI Parameters: Length and OB/OS thresholds

Bollinger Bands: Length and multiplier for band width

Plot Options: Toggle OB markers and bar confirmation

Signal Logic
OB UP Signal (Short Bias)

Conditions: CCI ≥ OB threshold AND Close ≥ Upper Bollinger Band

Marker: Red triangle down above bar

Alert Direction: SHORT

OB DOWN Signal (Long Bias)

Conditions: CCI ≤ OS threshold AND Close ≤ Lower Bollinger Band

Marker: Green triangle up below bar

Alert Direction: LONG

Alert System
The script includes pre-formatted JSON alerts for external integration:

Structured data format with symbol, timeframe, direction, and signal type

Secret key for authentication (replace "MY_SECRET" with your actual key)

Compatible with webhook services and custom alert handlers

Usage Tips
Timeframe Selection: Use higher timeframes (4H-Daily) for major levels, lower timeframes for precise entries

Parameter Tuning: Adjust left/right bars based on market volatility - increase for smoother trends, decrease for more reactive lines

Confirmation: Combine trend line breaks with OB/OS signals for high-probability setups

Risk Management: Always use proper stop losses - trend lines indicate potential areas, not guaranteed reversals

Technical Notes
Built with Pine Script v6

Maximum 200 lines/labels to maintain performance

Works on all asset types (forex, stocks, crypto)

Optimized for real-time and historical analysis

This script provides institutional-grade trend analysis with retail-friendly signals, making complex multi-timeframe analysis accessible to traders of all experience levels.

This description covers all the technical aspects while being accessible for users.

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.