TradingView
Besumetz
6 สิงหา 2022 เวลา 21 นาฬิกา 44 นาที

Future's spread with base contract (MOEX) 

Euro-Ruble Futures (Sep 2022)MOEX

คำอธิบาย

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)
เพิ่มเติม