OPEN-SOURCE SCRIPT

Candle DNA Strand

657
█ CANDLE DNA STRAND
A unique lower-panel indicator that visualizes candle structure as a stylized double-helix pattern. One strand represents body dominance (open-close range) while the other represents wick proportion (shadow-to-body ratio). The strands twist around a center axis with color encoding for bullish/bearish bias, revealing candle character patterns over time in an intuitive DNA-inspired format.

█ CONCEPT
Traditional candlestick analysis focuses on individual candle patterns. The Candle DNA Strand takes a different approach by decomposing every candle into two core metrics and plotting them as intertwined waves:
• Body Strand — Measures how much of each candle is "body" (the filled portion between open and close). High body ratios indicate conviction and directional commitment.
• Wick Strand — Measures how much of each candle is "shadow" (upper and lower wicks combined). High wick ratios indicate rejection, indecision, or failed attempts at direction.
These two strands are phase-offset by 180° to create the classic double-helix DNA appearance. As you scroll through the chart, you can visually identify periods of conviction (body-dominant) versus indecision (wick-dominant), and how candle character evolves over time.

█ HOW IT WORKS
The indicator calculates two normalized ratios for each candle:
  • Body Ratio = |Close - Open| / (High - Low)
  • Wick Ratio = (Upper Wick + Lower Wick) / (High - Low)

These ratios are smoothed and then modulated onto sine waves that twist around a center axis at the 50 level. The amplitude of each strand reflects the strength of that metric — larger bodies push the body strand further from center, and larger wicks push the wick strand further out.

The strands are color-coded by the current candle's bias:
• Bullish candles (close ≥ open) → Neon green tones
• Bearish candles (close < open) → Neon red tones

█ TRADE ZONES
The indicator includes an optional Trade Zone detection system based on candle character analysis:
◉ LONG ZONE (Green Background)
Triggers when:
• Average body ratio exceeds the Body Dominance Threshold (default 65%)
• Bullish momentum score > 40% (more bulls than bears in lookback period)
• Average wick ratio below the Wick Rejection Threshold (default 55%)

This identifies periods where price is moving up with conviction — strong bullish bodies with minimal rejection wicks.

◉ SHORT ZONE (Red Background)
Triggers when:
• Average body ratio exceeds the Body Dominance Threshold
• Bearish momentum score > 40% (more bears than bulls in lookback period)
• Average wick ratio below the Wick Rejection Threshold

This identifies periods where price is moving down with conviction — strong bearish bodies with minimal rejection wicks.

◉ CHOP/INDECISION
When the average wick ratio exceeds 60%, the market is showing high rejection and indecision. The DNA strands will show wick dominance during these periods.

Triangle markers appear at zone entry points:
• ▲ Green triangle below the helix = Long zone entry
• ▼ Red triangle above the helix = Short zone entry

█ VISUAL ELEMENTS
DNA Strands
Two intertwined lines representing body and wick ratios, twisting around the center axis with a configurable wavelength.

Base Pair Connectors
Vertical lines connecting the two strands at regular intervals, mimicking the "rungs" of a DNA ladder. These help visualize the spread between body and wick metrics.

Nucleotide Nodes
Small circular markers along each strand showing individual data points.

Fill Zone
Subtle gradient fill between the strands for visual depth. The fill color matches whichever strand is currently on top.

Info Label
Displays current values at the right edge of the chart:
• Current bias (BULL/BEAR)
• Body and Wick percentages
• Active trade zone (if any)

█ PATTERN DETECTION
The indicator automatically detects significant candle patterns based on DNA metrics:

DOJI — Body ratio < 15%
Very small body relative to total range. Indicates indecision.

MARUBOZU — Body ratio > 85%
Almost no wicks. Strong conviction candle with price closing near the high (bullish) or low (bearish).

HAMMER — Wick ratio > 60% with lower wick > 2× upper wick
Long lower shadow showing rejection of lower prices.

SHOOTING STAR — Wick ratio > 60% with upper wick > 2× lower wick
Long upper shadow showing rejection of higher prices.

█ SETTINGS
DNA Helix Settings
• Helix Wavelength — Number of bars for one complete DNA twist cycle (default: 20)
• Helix Amplitude — Vertical spread of the strands from center (default: 35)
• Show Base Pair Connectors — Toggle the connecting rungs (default: On)
• Connector Frequency — Draw a connector every N bars (default: 2)
• Data Smoothing — SMA length for smoothing ratios (default: 3)
• Strand Thickness — Line width for the DNA strands (default: 2)

Trade Zone Settings
• Show Trade Zones — Toggle background highlighting and entry signals (default: On)
• Zone Lookback — Bars to analyze for zone detection (default: 5)
• Body Dominance Threshold — Minimum avg body ratio for zone trigger (default: 0.65)
• Wick Rejection Threshold — Maximum avg wick ratio for zone trigger (default: 0.55)

Fluorescent Colors
• Bullish colors — Neon green and electric green variants
• Bearish colors — Neon red and hot pink variants
• Axis, connector, and zone colors are all customizable

Visual Settings
• Show Nucleotide Nodes — Toggle the small circles on strands (default: On)
• Show Info Labels — Toggle the right-side information label (default: On)
• Show DNA Analysis Table — Toggle detailed analysis table (default: Off)

█ ALERTS
Four alert conditions are available:
1. Long Zone Entry
"Entered LONG zone - strong bullish momentum with conviction candles"
2. Short Zone Entry
"Entered SHORT zone - strong bearish momentum with conviction candles"
3. Doji Pattern
"Doji detected - indecision"
4. Marubozu Pattern
"Marubozu detected - strong conviction"

█ INTERPRETATION GUIDE
Reading the DNA:
When body strand dominates (further from center):
• Market is moving with conviction
• Candles have strong bodies, minimal wicks
• Trend is likely to continue

When wick strand dominates (further from center):
• Market is showing rejection/indecision
• Candles have long shadows relative to bodies
• Potential reversal or consolidation

Strand crossovers:
• When strands cross, character is shifting
• Body crossing above wick → increasing conviction
• Wick crossing above body → increasing indecision

Color consistency:
• Long stretches of green → sustained bullish pressure
• Long stretches of red → sustained bearish pressure
• Alternating colors → choppy, mixed market

█ BEST PRACTICES
1. Use with price context — The DNA strand shows candle character, not direction. Combine with price action on the main chart.
2. Adjust wavelength to timeframe — Shorter wavelengths (10-15) for scalping, longer wavelengths (25-40) for swing trading.
3. Trade zones are filters, not signals — Use zone entries as confirmation for your existing strategy, not as standalone signals.
4. Watch for character shifts — When the dominant strand changes, market behavior is changing. This often precedes reversals.
5. Multiple timeframe analysis — Check DNA character on higher timeframes to understand the broader context.

█ CREDITS
Developed by Hash Capital Research
Pine Script™ v6

This indicator is provided for educational and informational purposes. Always conduct your own analysis and manage risk appropriately.

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。