CryptoCalendar
Funding times and countdown, UTC trading sessions, daily, weekly and monthly opens, and session highs and lows for your own scripts.
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")
}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")
}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.
Dışa açılanlar
Satırı kodunuzun başına ekledikten sonra dışa açılan tanımlara takma adla ulaşabilirsiniz.
import MarkudaDev/CryptoCalendar/1 as cryptoCalendarenum SessionSayımThe three main trading sessions of the day.
- Asia
- Europe
- US
sessionStart(Session s)İşlevReturns the UTC hour at which a session starts.
- s
- Session
- The session.
Dönüş0 for Asia, 7 for Europe, 13 for US.
sessionEnd(Session s)İşlevReturns the UTC hour at which a session ends. The bar that opens at this hour is outside the session.
- s
- Session
- The session.
Dönüş8 for Asia, 16 for Europe, 22 for US.
sessionName(Session s)İşlevReturns the name of a session.
- s
- Session
- The session.
Dönüş"Asia", "Europe" or "US".
inSessionOf(Session s)İşlevReturns true while the opening time of the bar is inside the session.
- s
- Session
- The session.
DönüşTrue inside the session, false outside it.
sessionStarted(Session s)İşlevReturns true on the first bar of the session.
- s
- Session
- The session.
DönüşTrue on the bar that opens the session.
sessionEnded(Session s)İşlevReturns true on the first bar after the session has closed.
- s
- Session
- The session.
DönüşTrue on the bar after the last bar of the session.
sessionHigh(Session s)İşlevReturns the highest price of the session: the running high while it is open, the final high after it has closed.
- s
- Session
- The session.
DönüşThe session high, or na before the first session on the chart.
sessionLow(Session s)İşlevReturns the lowest price of the session: the running low while it is open, the final low after it has closed.
- s
- Session
- The session.
DönüşThe session low, or na before the first session on the chart.
activeSessions()İşlevReturns the names of the sessions the bar belongs to. Overlapping hours return both names.
DönüşFor example "Asia", "Europe + US", or an empty text between 22:00 and 24:00 UTC.
nextFundingTime(int intervalHours)İşlevReturns the time of the next funding payment after the bar opens.
- intervalHours
- int
- The funding interval in hours: 8 for most perpetual contracts, 4 or 1 for some.
DönüşThe funding time in Unix milliseconds.
minutesToFunding(int intervalHours)İşlevReturns the minutes from the opening time of the bar to the next funding payment.
- intervalHours
- int
- The funding interval in hours.
DönüşThe number of minutes.
isFundingBar(int intervalHours)İşlevReturns true on the bar during which a funding payment takes place.
- intervalHours
- int
- The funding interval in hours.
DönüşTrue when a funding time falls between the open and the close of the bar.
newDay()İşlevReturns true on the first bar of a new UTC day.
DönüşTrue on the bar that opens the day.
newWeek()İşlevReturns true on the first bar of a new week. Weeks start on Monday at 00:00 UTC.
DönüşTrue on the bar that opens the week.
newMonth()İşlevReturns true on the first bar of a new UTC month.
DönüşTrue on the bar that opens the month.
dailyOpen()İşlevReturns the opening price of the current UTC day.
DönüşThe daily open, or na before the first full day on the chart.
weeklyOpen()İşlevReturns the opening price of the current week.
DönüşThe weekly open, or na before the first full week on the chart.
monthlyOpen()İşlevReturns the opening price of the current UTC month.
DönüşThe monthly open, or na before the first full month on the chart.
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
// Funding times, trading sessions, period opens and session ranges for crypto charts. Every time is in UTC. 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 //@function Returns the name of a session.//@param s The session.//@returns "Asia", "Europe" or "US".export sessionName(Session s) => s == Session.Asia ? "Asia" : s == Session.Europe ? "Europe" : "US" //@function Returns true while the opening time of the bar is inside the session.//@param s The session.//@returns True inside the session, false outside it.export inSessionOf(Session s) => hour >= sessionStart(s) and hour < sessionEnd(s) //@function Returns true on the first bar of the session.//@param s The session.//@returns True on the bar that opens the session.export sessionStarted(Session s) { a = inSessionOf(s) a and not a[1]} //@function Returns true on the first bar after the session has closed.//@param s The session.//@returns True on the bar after the last bar of the session.export sessionEnded(Session s) { a = inSessionOf(s) a[1] and not a} //@function Returns the highest price of the session: the running high while it is open, the final high after it has closed.//@param s The session.//@returns The session high, or na before the first session on the chart.export sessionHigh(Session s) { var float hi = na a = inSessionOf(s) if a and not a[1] { hi := high } else if a { hi := max(hi, high) } hi} //@function Returns the lowest price of the session: the running low while it is open, the final low after it has closed.//@param s The session.//@returns The session low, or na before the first session on the chart.export sessionLow(Session s) { var float lo = na a = inSessionOf(s) if a and not a[1] { lo := low } else if a { lo := min(lo, low) } lo} //@function Returns the names of the sessions the bar belongs to. Overlapping hours return both names.//@returns For example "Asia", "Europe + US", or an empty text between 22:00 and 24:00 UTC.export activeSessions() { asia = inSessionOf(Session.Asia) europe = inSessionOf(Session.Europe) us = inSessionOf(Session.US) asia and europe ? "Asia + Europe" : europe and us ? "Europe + US" : asia ? "Asia" : europe ? "Europe" : us ? "US" : ""} //@function Returns the time of the next funding payment after the bar opens.//@param intervalHours The funding interval in hours: 8 for most perpetual contracts, 4 or 1 for some.//@returns The funding time in Unix milliseconds.export nextFundingTime(int intervalHours) { step = intervalHours * 3600000 (floor(time / step) + 1) * step} //@function Returns the minutes from the opening time of the bar to the next funding payment.//@param intervalHours The funding interval in hours.//@returns The number of minutes.export minutesToFunding(int intervalHours) => (nextFundingTime(intervalHours) - time) / 60000 //@function Returns true on the bar during which a funding payment takes place.//@param intervalHours The funding interval in hours.//@returns True when a funding time falls between the open and the close of the bar.export isFundingBar(int intervalHours) { step = intervalHours * 3600000 span = timeframeInSeconds(timeframe.period) * 1000 ceil(time / step) * step < time + span} //@function Returns true on the first bar of a new UTC day.//@returns True on the bar that opens the day.export newDay() => dayofmonth != dayofmonth[1] //@function Returns true on the first bar of a new week. Weeks start on Monday at 00:00 UTC.//@returns True on the bar that opens the week.export newWeek() { wk = floor((time - 345600000) / 604800000) wk != wk[1]} //@function Returns true on the first bar of a new UTC month.//@returns True on the bar that opens the month.export newMonth() => month != month[1] //@function Returns the opening price of the current UTC day.//@returns The daily open, or na before the first full day on the chart.export dailyOpen() => valuewhen(newDay(), open, 0) //@function Returns the opening price of the current week.//@returns The weekly open, or na before the first full week on the chart.export weeklyOpen() => valuewhen(newWeek(), open, 0) //@function Returns the opening price of the current UTC month.//@returns The monthly open, or na before the first full month on the chart.export monthlyOpen() => valuewhen(newMonth(), open, 0) plot(weeklyOpen(), "Weekly open", "#e3b341", style = "stepline")plot(monthlyOpen(), "Monthly open", "#c084fc", style = "stepline")plot(sessionHigh(Session.Asia), "Asia high", "#6d7cff", style = "stepline")plot(sessionLow(Session.Asia), "Asia low", "#6d7cff", style = "stepline")plotshape(isFundingBar(8), "Funding", style = "circle", location = "bottom", color = "#33d69f", size = "tiny")
Sürüm 119 Eki 2026Son sürüm
İlk yayın
Bu kitaplıkla ilgili henüz bir gönderi bulunmuyor. Bu kitaplık hakkındaki ilk gönderiyi siz yazabilirsiniz.


