OPEN-SOURCE SCRIPT
更新済

PnL_EMA_TRACK12_PRO_3.3_full_adjusted

360
# Multi-Ticker Support

Manage up to 12 tickers simultaneously.

- For each symbol, input share quantities, entry prices, and two optional additional entry points (E2, E3) with their own shares and offset percentages.
- Dynamic handling of inputs using arrays for easier maintenance and scalability.

# Average Cost and PnL Calculation

- Computes weighted average entry costs across all position parts (E1 and optionally E2 and E3).
- Calculates real-time Profit & Loss (PnL) both in USD and percentage relative to the current price.
- Color-coded values: green for profit, red for loss — for quick visual feedback.

# Moving Averages as Benchmarks

- Uses daily EMAs (10, 21, 65) and 15-minute SMA 200 as reference levels.
- Calculates percentage deviations of these moving averages from the average entry price.
- Calculates dollar differences based on the total shares held.

# Chart Visualization

- Draws a dashed yellow line for the average cost of each position.
- Optionally draws two additional lines and labels for E2 (blue) and E3 (purple) if activated.
- Lines extend to the right to emphasize current relevance.
- Labels can be positioned left or right, with customizable horizontal offset.

# Interactive Table in Chart

- Positions the info table in any chosen corner or center of the chart (top/right/left/middle, etc.).
- Displays symbol, PnL (dollar and percentage), and deviations to key EMAs and SMA.
- Colors PnL values according to profit or loss for instant clarity.

# User-Friendly Settings

- Flexible font size options for both the table and labels.
- Customizable colors for positive and negative values (default green/red).
- Choice of label position and X-axis offset to fit your chart style.
リリースノート
# PnL EMA TRACK12 PRO v3.7

**Real-Time Portfolio Tracker with Dynamic Risk Management**

This indicator was developed to provide traders with a comprehensive real-time overview of their entire portfolio - directly within the chart. It addresses a fundamental challenge of active trading: the need to monitor multiple positions simultaneously while keeping track of both individual performance and overall portfolio risk.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
リリースノート
# PnL EMA TRACK12 PRO v3.7

**Real-Time Portfolio Tracker with Dynamic Risk Management**

This indicator was developed to provide traders with a comprehensive real-time overview of their entire portfolio - directly within the chart. It addresses a fundamental challenge of active trading: the need to monitor multiple positions simultaneously while keeping track of both individual performance and overall portfolio risk.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

### The Problem This Indicator Addresses

Active traders face several challenges:

**1. Fragmented Overview**
Broker platforms show individual positions, but rarely provide context relative to technical levels.

**2. Static Stop-Loss Orders**
Traditional stops remain at a fixed price while the market evolves. This could lead to either premature exits or unnecessarily large losses.

**3. Missing Risk Aggregation**
Without a clear view of total risk across all open positions, professional position management could become difficult.

**4. Time Delay**
Manually calculating PnL, average costs, and risk values could cost precious time in fast-moving markets.
リリースノート
### Core Features in Detail

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

#### 1. Multi-Ticker Portfolio Tracking (Up to 12 Positions)

**What it does:**
The indicator enables simultaneous monitoring of up to 12 different securities. For each position, symbol, share quantity, and entry price are recorded.

**Why this could matter:**
A diversified portfolio requires monitoring multiple positions. Instead of switching between different charts, the trader could see all relevant data at a glance - regardless of which chart is currently displayed.

**Technical Implementation:**
Through Pine Script v6 Dynamic Requests, real-time prices for all 12 tickers are queried simultaneously. This enables accurate portfolio calculations across all positions.
リリースノート
#### 3. Pyramiding Support (E1, E2, E3)

**What it does:**
For each position, up to three entry points (Entry 1, Entry 2, Entry 3) with different quantities and prices can be defined. The indicator automatically calculates the weighted average cost.

**Why this could matter:**
Professional traders often build positions gradually ("pyramiding"). Instead of buying the full position immediately, entries could be made in multiple tranches - for example, after initial confirmation and on successful pullbacks. The weighted average would be crucial for correct PnL calculation.

**Two Modes for E2/E3:**
```
Percentage Offset → E2 is automatically calculated X% above E1
Fixed Price → A specific entry price can be entered directly
```

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

#### 4. Moving Average Reference Points

**What it does:**
The indicator displays the distance of the current price to three important moving averages:
```
SMA200 (15-minute chart) → Very short-term trend filter
Daily EMA10 → Short-term trend
Daily EMA21 → Medium-term trend
```

**Why this could matter:**
These moving averages could serve as objective reference points for trend strength and potential support/resistance zones. The distance in dollars and percentage immediately shows how far the price is from these critical levels.

**Multi-Timeframe Approach:**
The EMAs are retrieved from the daily timeframe, the SMA200 from the 15-minute chart. This enables combining different time perspectives in one view.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
リリースノート
EMA-Offset Stop-Loss Fix (v3.7)
Problem: The stop line would initially display correctly, then jump to an incorrect position after a short time during live trading. Root Cause: When fetching EMA values from the Daily timeframe without lookahead, the EMA recalculates with every tick as the current day's candle updates. This causes the stop level to "repaint" throughout the trading day. Solution: Use close[1] combined with lookahead=barmerge.lookahead_on to fetch the EMA from the last completed daily bar:
[ema10, ema21] = request.security(syminfo.tickerid, "D", [ta.ema(close[1], 10), ta.ema(close[1], 21)], lookahead=barmerge.lookahead_on)
Result:
EMA values remain stable throughout the current trading day
Stop line no longer jumps or repaints
Values represent yesterday's closing EMA, which is the standard reference for intraday trading decisions

免責事項

この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。