LibraryOpen sourceOther

CryptoCalendar

Funding times and countdown, UTC trading sessions, daily, weekly and monthly opens, and session highs and lows for your own scripts.

Copy and edit
CryptoCalendarLiveBinance data
Loading chart…

Crypto Calendar answers the time questions that come up on every crypto chart: when is the next funding payment, which session is trading now, where did the week and the month open, and how far has the current session moved? Every function works in UTC, so the answers are the same for every user and every exchange time zone.

How it works

Perpetual futures exchange a funding payment between long and short positions at fixed times. On most contracts this happens every 8 hours, at 00:00, 08:00 and 16:00 UTC; some contracts use 4 hours or 1 hour. The funding functions take the interval as a parameter and count from midnight UTC, so they follow the exchange schedule exactly.

The trading day is divided into three broad sessions, named after the regions where most trading takes place:

  • Asia: 00:00 to 08:00 UTC.
  • Europe: 07:00 to 16:00 UTC.
  • US: 13:00 to 22:00 UTC.

Europe overlaps Asia for one hour and the US for three hours. Between 22:00 and 24:00 UTC no session is active. The session functions read the opening time of each bar, so on an hourly chart the Europe session covers the bars that open from 07:00 to 15:00.

Period opens mark where the day, the week and the month began. Weeks start on Monday at 00:00 UTC. The session high and low grow bar by bar while a session is open and stay fixed after it closes, until the same session opens again the next day.

Reading the chart

The library draws a small demonstration on its own chart. Hover over an item below to see it on the chart.

  • Amber step line: the weekly open.
  • Purple step line: the monthly open. It appears after the first month start in the loaded history.
  • Blue step lines: the high and the low of the Asia session.
  • Green dots at the bottom: bars during which a funding payment takes place, on the 8-hour schedule.

Functions

sessionStart(s) / sessionEnd(s)
int
The UTC hour at which a session starts and ends. The bar that opens at the end hour is outside the session.
sessionName(s)
string
"Asia", "Europe" or "US".
inSessionOf(s)
bool
True while the opening time of the bar is inside the session.
sessionStarted(s) / sessionEnded(s)
bool
True on the first bar of the session, and on the first bar after it has closed.
sessionHigh(s) / sessionLow(s)
float
The running high and low while the session is open, and the final values after it has closed.
activeSessions()
string
The sessions the bar belongs to, such as "Asia", "Europe + US", or an empty text between sessions.
nextFundingTime(intervalHours)
int
The time of the next funding payment after the bar opens, in Unix milliseconds.
minutesToFunding(intervalHours)
float
The minutes from the opening time of the bar to the next funding payment.
isFundingBar(intervalHours)
bool
True on the bar during which a funding payment takes place.
newDay() / newWeek() / newMonth()
bool
True on the first bar of a new UTC day, week or month.
dailyOpen() / weeklyOpen() / monthlyOpen()
float
The opening price of the current day, week or month.
Session
enum
Asia, Europe or US.

Using it

Copy the import line from this page and give the library a short name. The example below draws the weekly open and the US session high, shades the US session and shows the minutes left to the next funding payment on the last bar:

indicator("Funding Countdown", overlay = true)
import MarkudaDev/CryptoCalendar/1 as cal

plot(cal.weeklyOpen(), "Weekly open", "#818692", style = "stepline")
plot(cal.sessionHigh(cal.Session.US), "US high", "#c084fc", style = "stepline")
bgcolor(cal.inSessionOf(cal.Session.US) ? "#c084fc14" : na)
left = cal.minutesToFunding(8)
if barstate.islast {
    labelNew(high, "Next funding in " + str(left) + " min", barIndex, "#818692")
}
ExampleOn an hourly chart, the bar that opens at 13:00 UTC belongs to both Europe and the US, so activeSessions returns "Europe + US", and minutesToFunding(8) returns 180 because the next funding payment is at 16:00 UTC.

Your time zone

All times in this library are UTC. If your chart shows local time, add your offset when you read the hours. In Istanbul (UTC+3), for example, the Asia session runs from 03:00 to 11:00, Europe from 10:00 to 19:00, the US from 16:00 to 01:00, and 8-hour funding is paid at 03:00, 11:00 and 19:00.

Limits and points to note

  • The session hours are fixed UTC windows. Traditional markets move by an hour with daylight saving time, while these windows do not; they describe when activity is usually highest, not official opening hours.
  • The funding interval differs between contracts and can change. Please check the contract details on the exchange before relying on a schedule.
  • minutesToFunding counts from the opening time of the bar, not from the current moment. On the last bar of a 1-hour chart, the real time left can be up to one hour shorter.
  • On charts of 2 hours and above, a session starts with the first bar that opens inside it; on a 4-hour chart, for example, Europe starts with the 08:00 bar.
  • Period opens and session values appear after the first full period or session in the loaded history.
  • Sessions describe when trading happens, not which way price will move.

Crypto Calendar, her kripto grafiğinde akla gelen zaman sorularını cevaplar: bir sonraki funding ödemesi ne zaman, şu anda hangi seans işlem görüyor, hafta ve ay hangi fiyattan açıldı, açık seans ne kadar hareket etti? Bütün işlevler UTC ile çalışır; bu yüzden cevap her kullanıcı ve her borsa saat dilimi için aynıdır.

Nasıl çalışır

Süresiz vadeli sözleşmelerde long ve short pozisyonlar arasında belirli saatlerde funding ödemesi yapılır. Çoğu sözleşmede bu ödeme 8 saatte bir, UTC 00:00, 08:00 ve 16:00'da gerçekleşir; bazı sözleşmeler 4 ya da 1 saatlik aralık kullanır. Funding işlevleri aralığı parametre olarak alır ve UTC gece yarısından sayar; böylece borsanın takvimini birebir izler.

İşlem günü, işlemin en yoğun olduğu bölgelerin adını taşıyan üç geniş seansa ayrılır:

  • Asya: UTC 00:00 ile 08:00 arası.
  • Avrupa: UTC 07:00 ile 16:00 arası.
  • ABD: UTC 13:00 ile 22:00 arası.

Avrupa, Asya ile bir saat, ABD ile üç saat örtüşür. UTC 22:00 ile 24:00 arasında açık seans yoktur. Seans işlevleri her barın açılış saatine bakar; bu yüzden saatlik grafikte Avrupa seansı 07:00 ile 15:00 arasında açılan barları kapsar.

Dönem açılışları günün, haftanın ve ayın hangi fiyattan başladığını gösterir. Hafta pazartesi UTC 00:00'da başlar. Seansın en yüksek ve en düşük fiyatı seans açıkken bar bar güncellenir, seans kapanınca sabit kalır ve ertesi gün aynı seans açılana kadar korunur.

Grafiği okuma

Kitaplık kendi grafiğinde küçük bir gösterim çizer. Aşağıdaki bir maddenin üzerine geldiğinizde grafikte öne çıkar.

  • Amber basamaklı çizgi: haftalık açılış.
  • Mor basamaklı çizgi: aylık açılış. Yüklenen geçmişteki ilk ay başlangıcından sonra görünür.
  • Mavi basamaklı çizgiler: Asya seansının en yüksek ve en düşük fiyatı.
  • Alttaki yeşil noktalar: 8 saatlik takvimde funding ödemesinin gerçekleştiği barlar.

İşlevler

sessionStart(s) / sessionEnd(s)
int
Seansın başladığı ve bittiği UTC saati. Bitiş saatinde açılan bar seansın dışındadır.
sessionName(s)
string
"Asia", "Europe" ya da "US".
inSessionOf(s)
bool
Barın açılış saati seansın içindeyken true.
sessionStarted(s) / sessionEnded(s)
bool
Seansın ilk barında ve seans kapandıktan sonraki ilk barda true.
sessionHigh(s) / sessionLow(s)
float
Seans açıkken o ana kadarki en yüksek ve en düşük fiyat, kapandıktan sonra son değerler.
activeSessions()
string
Barın ait olduğu seanslar: "Asia", "Europe + US" gibi; seans dışında boş metin.
nextFundingTime(intervalHours)
int
Barın açılışından sonraki ilk funding ödemesinin zamanı, Unix milisaniye cinsinden.
minutesToFunding(intervalHours)
float
Barın açılış saatinden bir sonraki funding ödemesine kalan dakika.
isFundingBar(intervalHours)
bool
Funding ödemesinin gerçekleştiği barda true.
newDay() / newWeek() / newMonth()
bool
Yeni UTC gününün, haftanın ya da ayın ilk barında true.
dailyOpen() / weeklyOpen() / monthlyOpen()
float
İçinde bulunulan günün, haftanın ya da ayın açılış fiyatı.
Session
enum
Asia, Europe ya da US.

Kullanımı

Bu sayfadaki içe aktarma satırını kopyalayın ve kitaplığa kısa bir ad verin. Aşağıdaki örnek haftalık açılışı ve ABD seansının en yüksek fiyatını çizer, ABD seansını gölgelendirir ve son barda bir sonraki funding ödemesine kalan dakikayı gösterir:

indicator("Funding Countdown", overlay = true)
import MarkudaDev/CryptoCalendar/1 as cal

plot(cal.weeklyOpen(), "Weekly open", "#818692", style = "stepline")
plot(cal.sessionHigh(cal.Session.US), "US high", "#c084fc", style = "stepline")
bgcolor(cal.inSessionOf(cal.Session.US) ? "#c084fc14" : na)
left = cal.minutesToFunding(8)
if barstate.islast {
    labelNew(high, "Next funding in " + str(left) + " min", barIndex, "#818692")
}
ÖrnekSaatlik grafikte UTC 13:00'te açılan bar hem Avrupa hem ABD seansına aittir; activeSessions "Europe + US" döner. Bir sonraki funding ödemesi UTC 16:00'da olduğu için minutesToFunding(8) 180 verir.

Saat diliminiz

Bu kitaplıktaki bütün saatler UTC'dir. Grafiğiniz yerel saati gösteriyorsa saatleri okurken farkı ekleyin. Örneğin İstanbul'da (UTC+3) Asya seansı 03:00 ile 11:00, Avrupa 10:00 ile 19:00, ABD 16:00 ile 01:00 arasındadır; 8 saatlik funding 03:00, 11:00 ve 19:00'da ödenir.

Sınırlar ve dikkat edilecekler

  • Seans saatleri sabit UTC aralıklarıdır. Geleneksel piyasalar yaz saati uygulamasıyla bir saat kayar, bu aralıklar kaymaz; resmî açılış saatlerini değil, işlemin genellikle en yoğun olduğu saatleri anlatırlar.
  • Funding aralığı sözleşmeden sözleşmeye değişir ve değiştirilebilir. Bir takvime dayanmadan önce sözleşme ayrıntılarını borsada kontrol etmenizi rica ederiz.
  • minutesToFunding o andan değil, barın açılış saatinden sayar. Saatlik grafiğin son barında gerçek kalan süre bir saate kadar daha kısa olabilir.
  • 2 saatlik ve daha büyük grafiklerde seans, içinde açılan ilk barla başlar; örneğin 4 saatlik grafikte Avrupa 08:00 barıyla başlar.
  • Dönem açılışları ve seans değerleri, yüklenen geçmişteki ilk tam dönemden ya da seanstan sonra görünür.
  • Seanslar işlemin ne zaman yapıldığını anlatır; fiyatın hangi yöne gideceğini anlatmaz.

Exports

Once the line is at the top of your code, you can reach the exported definitions through the alias.

Usage
import MarkudaDev/CryptoCalendar/1 as cryptoCalendar
enum SessionEnum

The three main trading sessions of the day.

Members
Asia
Europe
US
sessionStart(Session s)Function

Returns the UTC hour at which a session starts.

Parameters
s
Session
The session.

Returns0 for Asia, 7 for Europe, 13 for US.

sessionEnd(Session s)Function

Returns the UTC hour at which a session ends. The bar that opens at this hour is outside the session.

Parameters
s
Session
The session.

Returns8 for Asia, 16 for Europe, 22 for US.

sessionName(Session s)Function

Returns the name of a session.

Parameters
s
Session
The session.

Returns"Asia", "Europe" or "US".

inSessionOf(Session s)Function

Returns true while the opening time of the bar is inside the session.

Parameters
s
Session
The session.

ReturnsTrue inside the session, false outside it.

sessionStarted(Session s)Function

Returns true on the first bar of the session.

Parameters
s
Session
The session.

ReturnsTrue on the bar that opens the session.

sessionEnded(Session s)Function

Returns true on the first bar after the session has closed.

Parameters
s
Session
The session.

ReturnsTrue on the bar after the last bar of the session.

sessionHigh(Session s)Function

Returns the highest price of the session: the running high while it is open, the final high after it has closed.

Parameters
s
Session
The session.

ReturnsThe session high, or na before the first session on the chart.

sessionLow(Session s)Function

Returns the lowest price of the session: the running low while it is open, the final low after it has closed.

Parameters
s
Session
The session.

ReturnsThe session low, or na before the first session on the chart.

activeSessions()Function

Returns the names of the sessions the bar belongs to. Overlapping hours return both names.

ReturnsFor example "Asia", "Europe + US", or an empty text between 22:00 and 24:00 UTC.

nextFundingTime(int intervalHours)Function

Returns the time of the next funding payment after the bar opens.

Parameters
intervalHours
int
The funding interval in hours: 8 for most perpetual contracts, 4 or 1 for some.

ReturnsThe funding time in Unix milliseconds.

minutesToFunding(int intervalHours)Function

Returns the minutes from the opening time of the bar to the next funding payment.

Parameters
intervalHours
int
The funding interval in hours.

ReturnsThe number of minutes.

isFundingBar(int intervalHours)Function

Returns true on the bar during which a funding payment takes place.

Parameters
intervalHours
int
The funding interval in hours.

ReturnsTrue when a funding time falls between the open and the close of the bar.

newDay()Function

Returns true on the first bar of a new UTC day.

ReturnsTrue on the bar that opens the day.

newWeek()Function

Returns true on the first bar of a new week. Weeks start on Monday at 00:00 UTC.

ReturnsTrue on the bar that opens the week.

newMonth()Function

Returns true on the first bar of a new UTC month.

ReturnsTrue on the bar that opens the month.

dailyOpen()Function

Returns the opening price of the current UTC day.

ReturnsThe daily open, or na before the first full day on the chart.

weeklyOpen()Function

Returns the opening price of the current week.

ReturnsThe weekly open, or na before the first full week on the chart.

monthlyOpen()Function

Returns the opening price of the current UTC month.

ReturnsThe monthly open, or na before the first full month on the chart.

CryptoCalendar135 linesVersion 1View full code
library("CryptoCalendar", overlay = true) //@enum The three main trading sessions of the day.export enum Session { Asia = "Asia", Europe = "Europe", US = "US" } //@function Returns the UTC hour at which a session starts.//@param s The session.//@returns 0 for Asia, 7 for Europe, 13 for US.export sessionStart(Session s) => s == Session.Asia ? 0 : s == Session.Europe ? 7 : 13 //@function Returns the UTC hour at which a session ends. The bar that opens at this hour is outside the session.//@param s The session.//@returns 8 for Asia, 16 for Europe, 22 for US.export sessionEnd(Session s) => s == Session.Asia ? 8 : s == Session.Europe ? 16 : 22