OPEN-SOURCE SCRIPT

Performance Comparison (Zeiierman)

3 029
Overview
Performance Comparison (Zeiierman) is a period-mapping comparison engine that shows how the current month, quarter, or year is evolving relative to its historical structure.

It takes completed historical periods, compresses each into a normalized timeline, and overlays them on the active period so you can compare paths, pace, expansion, and finish. Instead of only asking where the price is now, the script asks how this period is behaving relative to past periods at the same stage of development.

The indicator displays all curves in Percentage Accumulated terms, meaning each period starts at the same zero point and then tracks total return from that period start. This makes it easier to compare period structure on an equal footing, regardless of the asset’s raw price level.
ảnh chụp nhanh
How It Works

1) Period Segmentation
The script groups price into repeating time buckets based on the selected Period:
  • Monthly
  • Quarterly
  • Yearly

Each new month, quarter, or year starts a fresh period, while completed periods are stored for later comparison.

2) Timeline Normalization
Because historical periods do not all contain the same number of bars, each is remapped to a shared normalized progress scale from start to end.

This allows the script to compare:
  • the beginning of one period to the beginning of another
  • the midpoint of one period to the midpoint of another
  • the final stage of one period to the final stage of another

So even if one quarter had more bars than another, both can still be compared on the same visual path.

3) Value Mapping
The script uses Percentage Accumulated only.

Each period begins at 0% and then tracks cumulative return from that period’s starting price:
  • Percentage Accumulated = current price/period starting price − 1

This means all periods are anchored to the same starting point, making relative path comparison much cleaner than raw price comparison.

4) Historical Curve Engine
Completed periods are collected into comparison buckets across the normalized timeline. From these buckets, the script can draw:
  • Historical paths
  • Median path
  • Average path

This creates a period-based structure model rather than a simple price overlay.

5) Current Period Tracking
The active period is plotted on top of the historical framework, so you can see:
  • whether the current action is stronger or weaker than normal
  • whether it is tracking near the median path
  • whether it is diverging from the average or historical range
  • where the current period sits in time through the timeline bar

6) Similarity Table
The table compares the current period against past visible periods using four path metrics:
  • MAE: Average distance from the current path. Lower is better.
  • Max Dev: Largest divergence at any point. Lower is better.
  • Dir Match %: How often did both paths move in the same direction? Higher is better.
  • End Diff: Difference at the latest comparable point. Closer to zero is better.

This helps identify which historical period most closely resembles the current one.

Why It Is Useful

Structural Context
The script does not just show whether the price is up or down. It shows whether the current period is unfolding in a way that is typical, weak, extended, delayed, or abnormal relative to history.

Period-Based Comparison
It is especially useful for traders and analysts who think in recurring cycles, such as:
  • monthly structure
  • quarterly seasonality
  • yearly progression

ảnh chụp nhanh
How to Use

Historical Comparison
Use the historical paths to see how prior periods behaved across the full normalized timeline.

Median Path
Use the median as the most typical historical path. This is often the cleanest benchmark for “normal” behavior.

Average Path
Use the average to measure the broad mean tendency of past periods.

Current Period
Use the current path to judge whether the live period is:
  • leading
  • lagging
  • tracking normally
  • diverging sharply from history

ảnh chụp nhanh
Similarity Table
Use the table to find the closest historical analog to the current period.
  • Low MAE and Max Dev suggest close path similarity.
  • High Dir Match % suggests similar movement behavior.
  • End Diff near zero suggests similar positioning at the current stage.

ảnh chụp nhanh
Settings
  • Period — groups data into Monthly, Quarterly, or Yearly periods.
  • Completed Periods to Compare — number of finished historical periods used in the comparison engine.
  • Chart Resolution — number of normalized steps used to draw each path.


-----------------
Disclaimer

The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.

All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.