PROTECTED SOURCE SCRIPT
Cập nhật Optimus Pair Trader — Long/Short Two Symbols

This indicator implements a Pairs Trading Z-Score model to identify mean-reversion opportunities between two correlated assets. It allows you to select a second symbol in the settings, automatically calculates the hedge ratio (β) using rolling correlation, and computes a Z-score spread to visualize divergence and convergence between the pair.
When the Z-score rises above the +threshold, the spread is considered wide — signaling a Short A / Long B setup. When it falls below the −threshold, the spread is narrow — signaling a Long A / Short B setup. When the Z-score returns within the exit band, the trade is closed.
Features include:
• Dynamic hedge ratio (β) calculation
• Z-score chart with entry/exit bands
• One-time entry/exit signal labels per trade
• Synthetic cumulative P&L performance line
• Info table displaying active pair stats
• Built-in alert conditions for Long, Short, and Exit signals
Ideal for studying statistical arbitrage, market-neutral strategies, and algorithmic pair signals across stocks, ETFs, futures, or crypto.
When the Z-score rises above the +threshold, the spread is considered wide — signaling a Short A / Long B setup. When it falls below the −threshold, the spread is narrow — signaling a Long A / Short B setup. When the Z-score returns within the exit band, the trade is closed.
Features include:
• Dynamic hedge ratio (β) calculation
• Z-score chart with entry/exit bands
• One-time entry/exit signal labels per trade
• Synthetic cumulative P&L performance line
• Info table displaying active pair stats
• Built-in alert conditions for Long, Short, and Exit signals
Ideal for studying statistical arbitrage, market-neutral strategies, and algorithmic pair signals across stocks, ETFs, futures, or crypto.
Phát hành các Ghi chú
Change Z to 2.0/0.5Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.