OPEN-SOURCE SCRIPT
Trade Time & Position Duration Monitor (Multi-Entry)

Overview
Active Position Hold Timer is a specialized risk management tool designed to track the "psychological time cost" of your trades. Beyond just monitoring price, it focuses on the precise duration your position stays in profit or loss.
Key Features:
Calculation Logic:
中文說明
本指標專為管理「心理時間成本」而設計。它不僅監控價格,更專注於記錄倉位處於盈虧狀態的精確時間,幫助交易者克服持倉時的心理壓力。
主要功能:
計算邏輯:
Active Position Hold Timer is a specialized risk management tool designed to track the "psychological time cost" of your trades. Beyond just monitoring price, it focuses on the precise duration your position stays in profit or loss.
Key Features:
- Real-time Duration Tracking: Automatically calculates total time in profit vs. loss.
- Max Loss Streak: Records the longest continuous time in a losing state.
- Multi-Entry Cost Averaging: Supports initial entry plus 2 scale-ins.
- Dual Language Interface: Switch between English and Traditional Chinese.
- Time-Based Alerts: Set custom alerts for total or consecutive duration.
Calculation Logic:
- Baseline Calculation: Starts accumulating once entry time is reached.
- Profit/Loss Detection: Compares Close Price to Average Cost on every bar.
- Live Update: Uses timenow for second-by-second dashboard updates.
中文說明
本指標專為管理「心理時間成本」而設計。它不僅監控價格,更專注於記錄倉位處於盈虧狀態的精確時間,幫助交易者克服持倉時的心理壓力。
主要功能:
- 即時時長統計:自動計算總浮盈/浮虧時間,以及當前連續狀態的持續時間。
- 歷史最大浮虧時長:記錄該筆交易中,最長一次連續虧損的時間壓力。
- 多筆進場計算:支援初始進場加上兩次加倉,自動繪製動態成本線。
- 雙語切換:表格界面支援中/英文切換。
- 多維度警報:可針對總時間或連續時間設定警報,提醒您交易是否持有過久。
計算邏輯:
- 基準計時:當時間超過進場點後,根據圖表週期累加時長。
- 盈虧判定:每根 K 棒收盤時,自動比較收盤價與平均成本。
- 即時秒級更新:加入 **Live Timer** 邏輯,計算當前 K 棒已跳動的時間,確保儀表板數據每秒更新。
- 壓力追蹤:持續追蹤並記錄最長的連續虧損時長。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。