Electrified

Time

Electrified Uppdaterad   
Library "Time"
Utilities for measuring time.

bar() Gets the number of milliseconds per bar.
Versionsinformation:
v2 Added shortcut for getting the date.

Added:
date(datetime) Gets the start of the day for the provided time value.
  Parameters:
    datetime: The time of day to acquire the date from.
  Returns: The number of milliseconds representing the date for the given value.
Versionsinformation:
v3

Added:
timeOfDay(datetime) Gets milliseconds from the start of the day.
  Parameters:
    datetime: The date/time to acquire the time of day from.
  Returns: The number of milliseconds representing time of day.
Versionsinformation:
v4 Adds spanToLen functions
Versionsinformation:
v5

Added:
spanToLen(timespan, type, sessionMinutes)
  Returns the number (float) bars that represents the timespan provided.
  Parameters:
    timespan: The number of units to convert to bar count.
    type: The type of units to measure. ('Bar', 'Minute' or 'Day')
    sessionMinutes: Optional override for the number of minutes per session. (Default: Regular = 390, Extended = 1440)
  Returns: The number bars that represents the timespan provided.

spanToIntLen(timespan, type)
  Returns the number (int) bars that represents the timespan provided.
  Parameters:
    timespan: The number of units to convert to bar count.
    type: The type of units to measure. ('Bar', 'Minute' or 'Day')
  Returns: The number bars that represents the timespan provided.
Versionsinformation:
v6 improve spanToLen to allow for more types
Versionsinformation:
v7 cleanup bar() calculation
Pinebibliotek

I sann TradingView-anda har författaren publicerat denna Pine-kod som ett bibliotek med öppen källkod så att andra Pine-programmerare från vår community kan återanvända den. Hatten av för författaren! Du kan använda det här biblioteket privat eller i andra publikationer med öppen källkod, men återanvändning av den här koden i en publikation regleras av våra ordningsregler.

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.

Vill du använda det här biblioteket?

Kopiera följande rad och klistra in det i ditt skript.