TradingView
StaticNoiseLog
May 12, 2021 6:19 AM

Last Friday of Month 

Bitcoin all time history indexINDEX

Description

This script marks the last Friday of the month in a daily chart because this is the day when BTC and ETH options expire according to Deribit.
I only found a script that highlights the 3rd Friday of the month, which is not what I wanted.
This script tries to figure out the correct number of days per month but is not aware of holidays which might displace the expiry date.

Release Notes

[Updated using a clean chart.]

This script tries to mark the last Friday of the month in the chart with a vertical line and/or a label.
It is meant for use on a daily BTC chart.

Price may tend toward a level known as the "max pain point" when options expire. See these articles:
coindesk.com/bitcoin-options-market-eyes-4-2b-expiry-on-friday
insights.deribit.com/education/maximum-pain-for-option-buyers-going-into-expiration/

Deribit is a place where you can trade BTC and ETH options. Monthly and quarterly options expiry
dates are relevant. From deribit.com/pages/information/Introduction_Policy:
Daily options expire every day at 08:00 UTC.
Weekly options expire on each Friday of each week at 08.00 UTC.
Monthly options expire on the last Friday of each calendar month at 08.00 UTC.
Quarterly options expire on the last Friday of each calendar quarter at 08.00 UTC.

Release Notes

UPDATE: Now also shows the expiration Friday for the current month even if it lies in the future.

Release Notes

Added the URL where you can look up the max pain point in the comment.
(It is metrics.deribit.com/options?index=BTC)

Release Notes

  • Fixed the logic for finding Fridays.
  • No output if timeframe is different from 1 day.
  • Extended the description in the header of the source code.

Apologies, dudes and dudesses. The previous version was pretty broken.
How hard can it be to find the Fridays? Well, pretty hard for me, it seems... :-)

Release Notes

Another bug fix for the future last Friday of the month (how embarrasing).
Added highlighting of past quadruple witching Fridays (future dates not working, yet).
Converted to Pine Script v5.

Release Notes

This is a complete rewrite that should solve all update problems.
Quadruple witching Fridays are now fully supported for the past and the future.
See also the updated documentation at the top of the script code.

Looking forward: I think it would be nice to receive an alert from this script some days before an upcoming special Friday. Let me know if you would find this useful.

Release Notes

Fix that makes the script work correctly with symbols that use a different time base (e.g. NIKKEI and NFTY).
Comments
and3groid
Brilliant for the past Fridays; Thanks very much.

However It does not seem to work for the current and future month for Indian NSE:Nifty index (I changed to Thursday for our exchange). Instead it shows two Fridays in the current month.
StaticNoiseLog
@and3groid, Thank you for the feedback. Yes, the script does not work correctly for some situations in the future.
I had started looking into it, but never had enough time. Hopefully I can fix it before the end of the year.
(Or feel free to copy/contribute anytime...).
and3groid
@StaticNoiseLog, Appreciate your reply. The script is still valuable and will continue to use. Look forward to your modifications when you find time.
StaticNoiseLog
@and3groid, I tried the new version of the script with symbol NFTY and timezone UTC+5:30.
I am really surprised to see that it highlights Mondays (!) now with these chart settings.
I assume you are in India.
If I understand it correctly, an options exiration Friday in the USA happens on a Saturday for you, right?
The problem seems to be that, because there are no "Saturday bars", the marker for the special Friday winds up on the next possible bar, which is a Monday.
Is that behavior useful for you? Marking "your Friday" (the Thursday in the USA, I guess) would also not be correct, as it would be premature.
The good news is that if you use a market that is open on US Fridays (like BTCUSD), things seem to work as expected with timezone UTC+5:30.
StaticNoiseLog
@and3groid, The most recent version that I have just published now works correctly with NFTY and other symbols.
thdcbboy
Thank you!
extratimber
Thank you very much. This is exactly what I want
StaticNoiseLog
@extratimber, Glad it is of use! Hopefully I will find the time to add future witching days (currently only shown for the past).
vandama
Thank you!
More