OPEN-SOURCE SCRIPT
Atualizado

zone trading strat

428
This only works for DOGEUSD , I made it for the 8cap chart so only use it for that.

If you want this for other symbols/charts you need to comment below or msg me.

# Price Zone Trading System: Technical Explanation

## Core Concept

The Price Zone Tracker is built on the concept that price tends to respect certain key levels or "zones" on the chart. These zones act as support and resistance areas where price may bounce or break through. The system combines zone analysis with multiple technical indicators to generate high-probability trading signals.

## Zone Analysis

The system tracks 9 predefined price zones. Each zone has both a high and low boundary, except for Zone 5 which is represented by a single line. When price enters a zone, the system monitors whether it stays within the zone, breaks above it (bullish), or breaks below it (bearish).

This zone behavior establishes the foundational bias of the system:
- When price closes above its previous zone: Zone State = Bullish
- When price closes below its previous zone: Zone State = Bearish
- When price remains within a zone: Zone State = Neutral

## Trend Analysis Components

The system performs multi-timeframe analysis using several technical components:

1. **Higher Timeframe Analysis** (±3 points in scoring)
- Uses 15-minute charts for sub-5-minute timeframes
- Uses 30-minute charts for 5-minute timeframes
- Uses 60-minute charts for timeframes above 5 minutes
- Evaluates candlestick patterns and EMA crossovers on the higher timeframe

2. **EMA Direction** (±1 point in scoring)
- Compares 12-period and 26-period EMAs
- Bullish when fast EMA > slow EMA
- Bearish when fast EMA < slow EMA

3. **MACD Analysis** (±1 point in scoring)
- Uses standard 12/26/9 MACD settings
- Bullish when MACD line crosses above signal line with positive histogram
- Bearish when MACD line crosses below signal line with negative histogram

4. **Price Action** (±2 points in scoring)
- Evaluates whether price is making higher highs/higher lows (uptrend)
- Or lower highs/lower lows (downtrend)
- Also considers ATR-based volatility and strength of movements

## Trend Score Calculation

All these components are weighted and combined into a trend score:
- Higher timeframe components have stronger weights (±2-3 points)
- Current timeframe components have moderate weights (±1 point)
- Price action components have varied weights (±0.5-2 points)

The final trend state is determined by thresholds:
- Score > +3: Trend Analysis State = Bullish
- Score < -3: Trend Analysis State = Bearish
- Score between -3 and +3: Trend Analysis State = Neutral

## Signal Generation Logic

The system combines the Zone State with the Trend Analysis State:

1. If Zone State and Trend Analysis State are both bullish:
- Combined State = Bullish
- Line Color = Green

2. If Zone State and Trend Analysis State are both bearish:
- Combined State = Bearish
- Line Color = Red

3. If Zone State and Trend Analysis State contradict each other:
- Combined State = Neutral
- Line Color = Black

This implements a safety mechanism requiring both zone analysis and technical indicators to agree before generating a directional signal.

## Trading Signals

Trading signals are generated based on changes in the Combined State:

- When Combined State changes from neutral/bearish to bullish:
- Trading Signal = LONG (green triangle appears on chart)

- When Combined State changes from neutral/bullish to bearish:
- Trading Signal = SHORT (red triangle appears on chart)

- When Combined State changes from bullish/bearish to neutral:
- Trading Signal = EXIT (yellow X appears on chart)

- When Combined State remains unchanged:
- Trading Signal = NONE (no new marker appears)

## Reversal Warning

The system also monitors for potential reversal conditions:
- When Combined State is bullish but both RSI and MFI are overbought (>70)
- When Combined State is bearish but both RSI and MFI are oversold (<30)

In these cases, a yellow diamond appears on the chart as a warning that a reversal might be imminent.

## Visual Elements

The indicator provides multiple visual elements:
1. Zone boundaries as translucent orange areas
2. A single colored line below price (green/red/black) showing the current signal
3. Trading signals as shapes on the chart
4. An information panel showing all relevant indicator values and signals

## Usage Limitations

The indicator is designed to work optimally on timeframes below 30 minutes. On higher timeframes, a warning appears and analysis is disabled.
Notas de Lançamento
Here's a summary of all the improvements and edits made to the indicator:

## 1. Timeframe Logic Modifications
- Implemented a custom higher timeframe mapping as requested:
- 1m chart → use 15m data
- 5m chart → use 30m data
- 15m chart → use 1h data
- 30m and 1h charts → use 4h data
- Created a dedicated function `get_calculation_timeframe()` to handle this mapping
- Made HTF timeframe adjustments visible in the info panel

## 2. Indicator Organization
- Separated the code into clearly defined sections for each indicator
- Added detailed explanations for each component explaining:
- What the indicator measures
- How calculations work
- How much it contributes to the trend score (±X.0)
- Why certain weights were chosen

## 3. Score Breakdown System
- Created a detailed score breakdown in the information table showing:
- Higher timeframe candle contribution (±2.0)
- Higher timeframe EMAs contribution (±3.0)
- Current timeframe EMAs contribution (±1.0)
- MACD signal contribution (±1.0)
- RSI position contribution (±1.0)
- Price action contribution (±1.5 max)
- Trend structure contribution (±2.0)
- Price band contribution (±1.0)
- Added clear labeling of which components add to the total score

## 4. Ticker-Specific Zone Features
- Added a "Calibrated For: DOGEUSD (8cap)" indicator in the info panel
- Added visual highlighting that changes color based on whether you're viewing the calibrated ticker
- Included a tooltip explaining that more symbols will be added in the future
- Fixed issues with variable definitions to avoid conflicts
- Addressed Pine Script limitations regarding conditional drawing

## 5. Information Display Enhancements
- Improved the table layout to show more detailed information
- Added tooltips to explain how each component works
- Added color coding to make trend signals more visible
- Added a "Zone Confidence" indicator to show when zones are most reliable
- Updated the explanation text to be clearer about supported tickers

## 6. Code Quality & Organization
- Added comprehensive comments explaining each section's purpose
- Fixed issues with global vs. local scope for drawing functions
- Improved variable naming for better readability
- Organized code flow to be more logical and consistent
- Made the code more maintainable for future updates

These improvements make the indicator more informative, better organized, and prepare it for future enhancements such as adding support for more ticker symbols.
Notas de Lançamento
Here's a summary of the changes made since my last summary:

## 1. Directional Bias Veto Implementation
- Changed the signal line color from yellow to black for veto situations
- Simplified complex conditional logic to avoid end-of-line continuation errors
- Ensured directional bias properly vetoes against conflicting trend signals

## 2. Ticker-Specific Enhancements
- Added "UNUSED" status for directional bias on non-calibrated tickers
- Created clearer separation between tickers with and without calibrated zones
- Improved tooltips explaining why directional bias is unused on some tickers

## 3. Information Display Improvements
- Reorganized the Final Signals panel to show directional bias status more clearly
- Added more descriptive messages for different directional bias states
- Enhanced explanation text to emphasize that directional bias has veto power

## 4. Code Simplification
- Rewrote the combined state logic with separate if/else branches to avoid errors
- Removed unnecessary explanatory comments that were causing formatting issues
- Maintained the same functionality while making the code more robust

These changes ensure that the indicator correctly implements the veto logic where directional bias takes precedence over trend analysis, with appropriate visual cues and clear explanations in the interface.
Notas de Lançamento
changed triangles

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.