Skip to content
TradequixDocsOpen the terminal
OverviewStart here, search, progress
  • Introduction
  • Quickstart
  • How a script runs
  • Types and qualifiers
  • Operators, conditionals and loops
  • Functions and methods
  • Objects and enums
  • Arrays, matrices and maps
  • Strings and colours
  • Time and sessions
  • Bar states
  • Plotting
  • Inputs
  • Technical analysis
  • Drawings and tables
  • Multiple timeframes
  • Strategies
  • Alerts in scripts
  • Repainting
  • The Pine editor
  • Indicator settings
  • Coming from TradingView
  • The data
  • Publish and sell
  • Catalogue and community
  • Your dashboard and earnings
  • Errors and debugging
  • Limits
  • Coverage
  • Built-in catalogue
  • Cookbook
  • Write Pine with AI
  • FAQ
  • Glossary
  • Cheat sheet
  • Function reference
  • Will it run here?
  • Error index

Language

Time and sessions

The OTC feed trades around the clock on UTC. Reading bar time, filtering by hour, and what session variables mean here.

View as MarkdownOpen in ClaudeOpen in ChatGPT

The clock this feed runs on#

OTC pairs on Tradequix trade 24 hours a day, 7 days a week, and bars sit on a plain UTC grid. For a script that means:

  • syminfo.timezone is "Etc/UTC" and syminfo.session is "24x7".
  • There are no weekend gaps and no market open or close, so session.ismarket is always true and pre- and post-market are empty.
  • Symbols look like EURUSD_otc. For six-letter pairs, syminfo.basecurrency and syminfo.currency are filled from the name (EUR, USD).

Reading time#

time is the bar's open time in milliseconds. The calendar functions take a time and, optionally, a timezone:

FunctionGives
year(time), month(time), dayofmonth(time)The date
hour(time), minute(time), second(time)The time of day
dayofweek(time)1 (Sunday) to 7 (Saturday)
timestamp(...)A time from parts

They default to UTC here. Pass a timezone to shift: hour(time, "Asia/Dhaka").

Trading hours of your own#

Even on a round-the-clock feed you may only want to act at certain hours. Filter by hour:

RunnableLondon hours
1//@version=62indicator("London hours", overlay = true)3h = hour(time, "UTC")4inLondon = h >= 7 and h < 165bgcolor(inLondon ? color.new(#8b7cff, 90) : na)

Formatting a time#

str.format_time(time, "yyyy-MM-dd HH:mm", "UTC") turns a time into text for a label or a table.

PreviousStrings and coloursNext Bar states

On this page

  • The clock this feed runs on
  • Reading time
  • Trading hours of your own
  • Formatting a time

Use with AI

View as MarkdownOpen in ClaudeOpen in ChatGPT