Besumetz

Future's spread with base contract (MOEX)

Besumetz 已更新   
English:
Indicator calculates spread between future and it's theoretical price baased on base contract, number of days to expiration and central bank key rate.
I didn't find any means of getting base contract of security on chart so I hardcoded futures and corresponding base contracts.
Hardcoded futures are MOEX (Moscow Exchange) only and key rate used in script is Russian Central Bank's key rate from 2013, but I believe you can easily adapt it to any other key rate history. I can share source code of tiny C++20 utility for easy generation of get_rate(time) function from more human-readable date format rather then UNIX timestamp used in PineScript.
Only quarterly futures are supported. Only in "SIU2022" like notation. "SI1!" like aliases are not supported.

Русский:
Индикатор отображает спред фьючерса к его теоретической цене с учётом усыхания на каждый день.
Не нашёл, как определить базовый актив фьючерса средствами TradingView - поэтому это соответствие захардкожено вручную.
Поддерживаются только квартальные фьючерсы, только MOEX, только хардкор.
Поддерживается история ключевой ставки ЦБ РФ с 2013 года.
Используйте коды фьючерсов вида "SIU2022".
Не поддерживаются альясы вроде "SI1!", "EU1!".
版本注释:
Syntactic changes in title and short title/
版本注释:
Refactored days_to_exp calculation
版本注释:
Added barstate.islastconfirmedhistory check before painting table
版本注释:
Updated get_rate function according to Russia's Central Bank decision
版本注释:
Updated get_rate function according to Russia's Central Bank decision(8.5% since 24.07.2023)
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?