OPEN-SOURCE SCRIPT

Futures Settlement [NeoButane]

Cập nhật
Traders use settlement prices as both support/resistance and as a target for price to trend towards. The intention of this script is to provide possible entry and exit levels for swing and scalp trades by drawing horizontal lines of true settlement prices provided by TradingView.

The settlement price, which is calculated daily, is used to determine the profit/loss of a trader's futures position. Prior to the daily close, price settlement of futures contracts is performed by taking the average of its traded price during a specified period of time.

Usage
The settlement prices, shown as horizontal lines, serve as support or resistance for entry or exit. There are hundreds of ways to combine this with favorite indicators, or it can be used as levels for pure price action traders.

See how settlement price levels can be used in confluence with oscillators.
ảnh chụp nhanh

Configuration
Toggles to show each settlement. Reprint shows prior weeks or months after they've ended. Back-adjusted futures, which affect expired futures price history on continuous futures charts, should only be enabled on non-standard charts to match the user's chart settings.
ảnh chụp nhanh


What this script does
This script plots the daily, weekly, and monthly settlements for futures, including an average for the two most recent weekly or monthly settlements. The weekly settlement uses the last day of the week's daily settlement and the monthly settlement uses the last day of the month's daily settlement. For symbols that do not have settlement prices, which will be almost if not all symbols that are not futures, the settlement price instead becomes price at the last second before the daily/weekly/monthly close. In those cases, this script becomes a tool for automatically plotting daily/weekly/monthly closes.

See below for two different bitcoin charts. The chart on top is a non-futures chart and a futures chart is at the bottom. Note that CME bitcoin futures settle 4 hours (1500 CST) before bitcoin's daily close (UTC).
ảnh chụp nhanh


How this script works
TradingView has a built-in ability to display daily settlements instead of the actual daily close. This can be enabled in chart settings for futures on the daily timeframe and there is an argument for Pine Script to do so as well. Because settlement times are different for multiple products during the day, the script uses the settlement price from daily timeframe, which is guaranteed to be correct because TradingView is wonderful. I accidentally found the undocumented backadjustment and settlement_at_close when I was trying to use ticker.inherit() to create a symbol with its daily close time changed to another symbol's, which I still haven't figured out. TradingView has since added documentation for both of them, but there's still an ambiguous 'etc.' in the description of ticker.inherit() so maybe there's more secret arguments...

The script is able to be used on non-standard charts by using ticker.standard(), but back-adjustment will need to be changed by input to match chart settings.
ảnh chụp nhanh

References
Investopedia explanation of settlement price.
investopedia.com/terms/s/settlementprice.asp

Settlement prices for ES.
cmegroup.com/markets/equities/sp/e-mini-sandp500.settlements.html

CME summary of settlement price.
cmegroup.com/market-data/daily-settlements.html

How to enable settlement price as close for daily intervals in TradingView. This does not affect the use of this script.
tradingview.com/chart/?solution=43000685268

About back-adjustment for continuous futures charts in TradingView.
tradingview.com/chart/?solution=43000685266
Phát hành các Ghi chú
Update
  • Added the last settlement of the quarter as an option to enable.
  • Added the final settlement of quarterly contracts for the year as an option to enable.


The final settlement is the final value of an expired contract and occurs on the last Friday in its expiration month. The final settlement price is not affected by back-adjustment. It can be used in the same fashion as the other settlement "levels".

More information on final settlement prices here:
tradingview.com/chart/?solution=43000703820
cmegroup.com/trading/equity-index/settlement.html
cmegroup.com/market-data/final-settlements.html

ảnh chụp nhanh
Phát hành các Ghi chú
Bugfix: When charting an active session, the last values of the settlement prices all become last price of the symbol. The settlement prices now correctly show during an active session.
cbotCMEcomexfuturesmultitimeframenymexPivot points and levelssettlementSupport and Resistance

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


My published indicators: tradingview.com/u/NeoButane/

Sorry if I haven't replied to your message yet, I'm a bit backlogged :)
Ngoài ra, trên:

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