INVITE-ONLY SCRIPT
已更新 Market Average Long/Short

Market Average Long/Short
This indicator is designed to calculate and visualize average prices for long and short positions based on Open Interest (OI) and volume changes.
Key Features
How It Works
Use Case
This indicator is particularly useful for futures traders who:
What It Tells You
Example Scenarios
Advanced Notes
This indicator combines market sentiment analysis with price action and volume to provide a powerful tool for futures traders.
This indicator is designed to calculate and visualize average prices for long and short positions based on Open Interest (OI) and volume changes.
Key Features
- Open Interest-Based Analysis: Utilizes Open Interest (OI) data to track changes in positions.
Separates long and short positions based on the direction of the OI change. - Multiple Look-Back Periods: Short, medium, and long-term look-back periods are configurable.
Each period calculates average long and short prices for those timeframes. - Real-Time Updates: Plots the average prices as lines on the chart.
Displays labels for the most recent values at the last candle. - Customizable Settings:
- Allows users to enable/disable short, medium, and long look-back periods and adjust their lengths.
- Allows users to enable/disable short, medium, and long look-back periods and adjust their lengths.
How It Works
- Input Parameters:
Users can enable or disable the look-back periods (short, medium, long). Configurable periods define how many bars to look back for each calculation. - Fetching Data:
The script determines the correct Open Interest symbol (_OI) for the current chart symbol.
Open Interest (OI): Open, high, low, close values.
Volume: Total trading volume for each bar. - Open Interest Changes:
Calculates the change in Open Interest (oiChange) between the current and previous bar:
Positive OI Change: Represents long positions opening.
Negative OI Change: Represents short positions opening. - Volume Segmentation:
Separates the total trading volume into:
Open Volume: Volume associated with opening long or short positions.
Close Volume: Remaining volume (assumed to be closing positions). - Cumulative Long/Short Data:
Tracks cumulative long and short volumes and their respective values (price × volume).
Calculates the Max Average Prices:
Average Long Price Max: Total long value ÷ total long volume.
Average Short Price Max: Total short value ÷ total short volume. - Look-Back Calculations:
For each enabled period (short, medium, long):
A custom summation function (f_sum) calculates the sum of volumes and values over the specified look-back period.
Average prices for longs and shorts are computed:
averageLongPrice = lookBackLongValue / lookBackLongVolume
averageShortPrice = lookBackShortValue / lookBackShortVolume - Plotting Data:
- Lines:
Plots lines for Max Average Long/Short Prices.
Look-back period averages (short, medium, long). - Labels:
Labels are displayed for the most recent average prices at the last candle, including descriptions like "Max Avg Long" or "Short Avg Long".
- Lines:
Use Case
This indicator is particularly useful for futures traders who:
- Want to analyze the behavior of long and short positions in the market.
- Use Open Interest as a metric for sentiment (e.g., increasing OI = more positions opening).
- Need a visual representation of average entry prices for long and short positions across different time horizons.
What It Tells You
- Max Average Long/Short Prices:
Represents the overall average entry price of all open long/short positions in the market. Useful for understanding where the majority of traders are positioned. - Look-Back Periods:
Highlights recent trends in long/short positioning. Shorter look-back periods are more responsive to recent data, while longer periods show broader trends. - Volume Dynamics:
Helps identify whether the market is dominated by long or short volume. - Trend Reversals:
When the current price approaches the average price lines, it can indicate areas of potential support or resistance.
Example Scenarios
- Trend Analysis: If the price is above the average long price and trending upward, the market is dominated by longs.
Conversely, if the price is below the average short price, the market is dominated by shorts. - Support/Resistance:
Average prices often act as psychological levels for traders, where support or resistance may occur. - Volume Insights:
Significant increases in open/close volume can signal an impending breakout or trend change.
Advanced Notes
- Real-Time Data:
This indicator is most effective with intraday or daily timeframes for futures markets, as Open Interest is critical for short-term trading. - Customization:
Users can adjust the look-back periods and enable only the periods relevant to their trading style. - Open Interest Ticker:
The _OI ticker needs to exist for the current chart symbol; otherwise, the indicator won't fetch data.
This indicator combines market sentiment analysis with price action and volume to provide a powerful tool for futures traders.
發行說明
Open/Close Volume Calculation Fixed僅限邀請腳本
只有經作者授權的使用者才能訪問此腳本,且通常需付費。您可以將此腳本加入收藏,但需先向作者申請並獲得許可後才能使用 — 點擊此處了解更多。如需更多詳情,請依照作者說明或直接聯繫Angick。
除非您完全信任其作者並了解腳本的工作原理,否則TradingView不建議您付費或使用腳本。您也可以在我們的社群腳本中找到免費的開源替代方案。
作者的說明
Terms of Use:
"By requesting access to this script, you agree to use it for personal trading purposes only. Redistribution is prohibited."
Custom Request:
"Send me a private message on TradingView with your username and reason for requesting access."
提醒:在請求訪問權限之前,請閱讀僅限邀請腳本指南。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
僅限邀請腳本
只有經作者授權的使用者才能訪問此腳本,且通常需付費。您可以將此腳本加入收藏,但需先向作者申請並獲得許可後才能使用 — 點擊此處了解更多。如需更多詳情,請依照作者說明或直接聯繫Angick。
除非您完全信任其作者並了解腳本的工作原理,否則TradingView不建議您付費或使用腳本。您也可以在我們的社群腳本中找到免費的開源替代方案。
作者的說明
Terms of Use:
"By requesting access to this script, you agree to use it for personal trading purposes only. Redistribution is prohibited."
Custom Request:
"Send me a private message on TradingView with your username and reason for requesting access."
提醒:在請求訪問權限之前,請閱讀僅限邀請腳本指南。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。