OPEN-SOURCE SCRIPT

Futures Settlement [NeoButane]

מעודכן
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.
תמונת-בזק

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.
תמונת-בזק


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).
תמונת-בזק


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.
תמונת-בזק

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
הערות שחרור
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

תמונת-בזק
הערות שחרור
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

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?


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

Sorry if I haven't replied to your message yet, I'm a bit backlogged :)
גם על:

כתב ויתור