OPEN-SOURCE SCRIPT

Trigonometric Sine Cosine Waves

154
Trigonometric Sine Cosine Waves - Advanced Cyclical Analysis

Overview

This innovative indicator applies trigonometric mathematics to market analysis, generating dynamic sine and cosine waves that adapt to price movement and volatility. Unlike traditional oscillators, this tool visualizes market cycles directly on your chart using mathematical wave functions.

How It Works

The indicator calculates phase-based waves using:

• Phase Calculation: 2π × bar_index / cycle_length
• Adaptive Amplitude: EMA-based price + ATR volatility scaling
• Sine Wave: avgPrice + volatility × sin(phase)
• Cosine Wave: avgPrice + volatility × cos(phase)

Key Features

Dynamic Wave Generation
• Sine Wave: Primary cycle indicator with smooth transitions
• Cosine Wave: Leading indicator (90° phase difference from sine)
• Adaptive Amplitude: Automatically adjusts to market volatility using ATR

Turning Point Detection
• Anti-Repaint Signals: Uses confirmed values from previous bars
• Sine Bottom: Potential buy zones when wave transitions from down to up
• Sine Top: Potential sell zones when wave transitions from up to down

Advanced Analytics
• Price Correlation Angle: Shows relationship between price movement and cycle
• Phase Information: Current position in the mathematical cycle
• Real-time Values: Live sine/cosine values and phase degrees

Visual Enhancement
• Background Coloring: Changes based on sine wave position (above/below zero)
• Clean Overlay: Waves plot directly on price chart without cluttering

Parameters

Cycle Length (5-200): Controls wave frequency - shorter = more sensitive
Amplitude Multiplier (0.1-5.0): Adjusts wave height relative to volatility
Display Options: Toggle sine wave, cosine wave, and correlation table
Show Correlation: Optional table showing mathematical values

Trading Applications

Cycle Analysis
• Identify market rhythm and timing
• Spot potential reversal zones
• Understand price-to-cycle relationships

Entry/Exit Timing
• Buy Signals: Sine wave bottoms (cycle lows)
• Sell Signals: Sine wave tops (cycle highs)
• Confirmation: Use with other indicators for higher probability setups

Market Structure
• Visualize underlying market cycles
• Identify periods of high/low cyclical activity
• Track phase relationships between price and mathematical cycles

Pro Tips

1. Longer cycles (50-100) work better for swing trading
2. Shorter cycles (10-20) suitable for scalping
3. Combine with volume for stronger signal confirmation
4. Monitor correlation angle for trend strength assessment
5. Use background color as quick visual cycle reference

Important Notes

• Signals are anti-repaint using confirmed previous bar values
• Best used in trending or cyclical markets
• Consider market context when interpreting signals
Mathematical approach - not based on traditional TA concepts

Alerts Included

• Sine Wave Buy Signal: Triggered on wave bottom detection
• Sine Wave Sell Signal: Triggered on wave top detection

Technical Requirements

• Pine Script v6
• Works on all timeframes
• No external dependencies
• Optimized for performance

This is a free, open-source indicator. Feel free to modify and improve according to your trading needs!

Educational Value: Perfect for understanding how mathematical functions can be applied to market analysis and cycle detection.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.