Files
2026-05-14 14:17:09 +08:00

39 lines
3.6 KiB
Markdown

# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Overview
This is a collection of TradingView Pine Script (v5/v6) indicators and strategies for technical analysis. All scripts are standalone `.pine` files with no build system, package manager, or dependencies — they are pasted directly into the TradingView Pine Editor.
## Working with Pine Script
- There is no local build, lint, or test toolchain. Pine Script can only be validated by pasting into the TradingView web editor.
- All files use `//@version=6` (or occasionally v5). Pine Script v6 is the current target.
- `indicator()` declares an indicator (overlay on chart), `strategy()` declares a backtestable strategy with order execution.
- Common overlay settings: `overlay=true`, `max_lines_count=500`, `max_labels_count=500`, `max_boxes_count=500`, `max_bars_back=5000`.
## File Organization by Category
- **缠论 (Chan Theory)**: `chan_theory*.pine` — Classic Chinese technical theory implementing 分型 (fractals), 笔 (strokes), 线段 (segments), 中枢 (pivot zones). The `chan_theory_complete.pine` is the most comprehensive version (~62KB), combining both Chan Theory and trend identification. Earlier files are iterative improvements.
- **EMA Strategies**: `ema_strategy_4lines.pine`, `ema_macd_trend_indicator.pine`, `ema_macd_trend_strategy.pine`, `ema26_ema52.pine`, `ema26_ema52_diff.pine` — EMA cross/alignment-based trading strategies with MACD confirmation.
- **Multi-Timeframe EMA52**: `多周期EMA52_Pro.pine`, `多周期MA52.pine` — Draws EMA/MA lines from higher/lower timeframes onto the current chart. `_Pro` is the latest and most feature-rich.
- **支撑压力位 (Support/Resistance)**: `支撑压力位*.pine` — Various support/resistance detection indicators (DeepSeek, QwenMax, optimized versions).
- **趋势判断 (Trend Detection)**: `趋势行情判断*.pine` — Trend condition assessment with optimized/super-optimized variants.
- **背驰/背离 (Divergence)**: `macd_divergence.pine`, `high_macd_divergence.pine`, `kdt_divergence.pine`, `last_divergence_simple.pine` — MACD and K-line momentum theory divergence detection.
- **Bollinger Bands**: `bollinger_atr_strategy.pine`, `bollinger_band_strategy_new.pine`.
- **Other**: `裸K趋势反转识别.pine` (naked candlestick pattern reversal), `close_fft_spectrum.pine` (FFT spectrum analysis), `三重滤网均线交易策略.pine` (triple-screen MA strategy), `自定义MACD柱子面积.pine` (custom MACD histogram area).
## Code Patterns
- All user-configurable parameters use `input.*()` grouped with the `group=` parameter (e.g., `group="显示设置"`).
- Display toggles follow the pattern: `showX = input.bool(true, "显示X", group="显示设置")` with conditional plotting via `plot(showX ? value : na, ...)`.
- Color configuration uses `input.color()` for user-customizable colors.
- Chinese is used for parameter labels, tooltips, and comments. Variable names are a mix of English and pinyin (e.g., `show_fenxing`, `color_bi_up`).
- `var` prefix is used for persistent state variables (e.g., `var bool cycle_in_progress = false`).
- Many scripts are iterative refinements — when making changes, prefer editing the latest/most complete version (look for `_Pro`, `_complete`, `_超级优化版`, `_优化版` suffixes).
## Multi-File Relationship
Files in the same category are typically evolutionary versions (simple → optimized → super-optimized → complete). When asked to fix or improve an indicator, identify the latest version first. The README.md and various `*.md` files contain usage instructions and comparison guides for different versions.