All indicators
Levels & sessions / Price pane

Daily & Weekly Levels

Previous and current day and week open, high, low and close as levels, read from real daily and weekly bars.

  • D/W Levels
  • Built into Spectral
  • Updates every tick
  • previous day
  • previous week
  • daily levels
  • weekly levels
  • high low
  • open close
  • higher timeframe

By Spectral · v1.0.0

MIT-0: free to use, change and share, no attribution needed. What you build from it is yours.

Already in Spectral: add it from the Indicators toolbox. The file here is the same indicator written as a custom indicator, to change or learn from. Installed, it appears next to the built-in one, marked Custom.

Daily & Weekly Levels on a Spectral chart
Spectral chart with sample market data, default settings.

Overview

Daily & Weekly Levels marks the reference prices traders watch from the higher timeframes: the previous trading day's open, high, low and close (PDO, PDH, PDL, PDC), the current day's open, high and low (DO, DH, DL), and the same for the previous and current week (PWO, PWH, PWL, PWC and WO, WH, WL).

The values come from real daily and weekly regular-trading-hours bars that Spectral loads beside the chart's own bars, so they are correct on any bar size, even when the chart has loaded only a few hours of history.

How to read it

The previous day's and week's high and low frame the range the market accepted; a move beyond them, and whether price holds there or returns inside, tells you more than the touch itself. The prior close is where the last session settled, and the open is where the current period began, so price above or below the open shows who has controlled the period so far.

The current day and week high and low move as new extremes print. Levels are references for reaction, acceptance or rejection, not signals on their own.

Settings and limitations

Previous day, Current day, Previous week and Current week switch each group; Opens, Highs and lows, and Closes choose which values every enabled group draws. A switched-off group loads no bars.

The current day is the trading date of the chart's last bar, and the previous day is the trading date before it; the same applies to weeks (Monday to Friday). Values use regular trading hours, 09:30 to 16:00 New York time, so the open is the 09:30 open and the close is the 16:00 close (13:00 on early-close days). Before the regular session opens, the current-day levels are hidden.

Notes

Unlike the Previous Day and Previous Week levels computed from the chart's own bars, this indicator reads daily and weekly bars directly, so it also works on higher bar sizes and short histories. The current-day and current-week values update live while the chart is open. Weeks run Monday to Friday by New York date, as on stock exchanges; for markets with a Sunday-evening session, bars before Monday count toward the previous week. Needs a Spectral version with schemaVersion 2.

Settings

Each setting appears in the indicator's settings panel in Spectral, next to a color setting for every output.

SettingTypeDefaultRange or optionsWhat it does
Previous dayOn / offOn—Draw the previous trading day's levels (PDO, PDH, PDL, PDC).
Current dayOn / offOn—Draw the current trading day's open, high and low (DO, DH, DL).
Previous weekOn / offOn—Draw the previous week's levels (PWO, PWH, PWL, PWC).
Current weekOn / offOn—Draw the current week's open, high and low (WO, WH, WL).
OpensOn / offOn—Draw the open of each enabled day and week.
Highs and lowsOn / offOn—Draw the high and low of each enabled day and week.
ClosesOn / offOn—Draw the close of the previous day and the previous week.

What it draws

Levels

  • PDOdotted · 1 px · value on the axis#C4A46A
  • PDHsolid · 1 px · value on the axis#C4A46A
  • PDLsolid · 1 px · value on the axis#C4A46A
  • PDCdashed · 1 px · value on the axis#C4A46A
  • DOdotted · 1 px · value on the axis#B7A1C8
  • DHsolid · 1 px · value on the axis#B7A1C8
  • DLsolid · 1 px · value on the axis#B7A1C8
  • PWOdotted · 1 px · value on the axis#8AA9C3
  • PWHsolid · 1 px · value on the axis#8AA9C3
  • PWLsolid · 1 px · value on the axis#8AA9C3
  • PWCdashed · 1 px · value on the axis#8AA9C3
  • WOdotted · 1 px · value on the axis#7FB5A0
  • WHsolid · 1 px · value on the axis#7FB5A0
  • WLsolid · 1 px · value on the axis#7FB5A0

Source

Save it as daily-weekly-levels.js and add it with Indicators → Custom indicators → Add file…. The format is explained in the custom indicators guide.

// Copyright (c) 2026 Spectral
// SPDX-License-Identifier: MIT-0
// Free to use, copy, modify and share: https://spectral.trade/docs/custom-indicators/LICENSE.txt
/** @type {import('./spectral-indicator').IndicatorV2} */
export default {
  schemaVersion: 2,
  id: 'daily-weekly-levels',
  name: 'Daily & Weekly Levels',
  shortName: 'D/W Levels',
  version: '1.0.0',
  author: 'Spectral',
  description: 'Previous and current day and week open, high, low and close as levels, read from real daily and weekly bars.',
  pane: 'price',
  live: { lookback: 0 },
  inputs: {
    showPrevDay: { type: 'boolean', label: 'Previous day', default: true, description: 'Draw the previous trading day\'s levels (PDO, PDH, PDL, PDC).' },
    showToday: { type: 'boolean', label: 'Current day', default: true, description: 'Draw the current trading day\'s open, high and low (DO, DH, DL).' },
    showPrevWeek: { type: 'boolean', label: 'Previous week', default: true, description: 'Draw the previous week\'s levels (PWO, PWH, PWL, PWC).' },
    showThisWeek: { type: 'boolean', label: 'Current week', default: true, description: 'Draw the current week\'s open, high and low (WO, WH, WL).' },
    showOpen: { type: 'boolean', label: 'Opens', default: true, description: 'Draw the open of each enabled day and week.' },
    showHighLow: { type: 'boolean', label: 'Highs and lows', default: true, description: 'Draw the high and low of each enabled day and week.' },
    showClose: { type: 'boolean', label: 'Closes', default: true, description: 'Draw the close of the previous day and the previous week.' },
  },
  levels: {
    prevDayOpen: { label: 'PDO', color: '#C4A46A', lineStyle: 'dotted', showValue: true },
    prevDayHigh: { label: 'PDH', color: '#C4A46A', showValue: true },
    prevDayLow: { label: 'PDL', color: '#C4A46A', showValue: true },
    prevDayClose: { label: 'PDC', color: '#C4A46A', lineStyle: 'dashed', showValue: true },
    dayOpen: { label: 'DO', color: '#B7A1C8', lineStyle: 'dotted', showValue: true },
    dayHigh: { label: 'DH', color: '#B7A1C8', showValue: true },
    dayLow: { label: 'DL', color: '#B7A1C8', showValue: true },
    prevWeekOpen: { label: 'PWO', color: '#8AA9C3', lineStyle: 'dotted', showValue: true },
    prevWeekHigh: { label: 'PWH', color: '#8AA9C3', showValue: true },
    prevWeekLow: { label: 'PWL', color: '#8AA9C3', showValue: true },
    prevWeekClose: { label: 'PWC', color: '#8AA9C3', lineStyle: 'dashed', showValue: true },
    weekOpen: { label: 'WO', color: '#7FB5A0', lineStyle: 'dotted', showValue: true },
    weekHigh: { label: 'WH', color: '#7FB5A0', showValue: true },
    weekLow: { label: 'WL', color: '#7FB5A0', showValue: true },
  },
  auxiliary: {
    daily: { barSize: '1 day', duration: '1 M', useRth: true, keepUpToDate: true, when: { any: ['showPrevDay', 'showToday'] } },
    weekly: { barSize: '1 week', duration: '6 M', useRth: true, keepUpToDate: true, when: { any: ['showPrevWeek', 'showThisWeek'] } },
  },
  docs: {
    overview: 'Daily & Weekly Levels marks the reference prices traders watch from the higher timeframes: the previous trading day\'s open, high, low and close (PDO, PDH, PDL, PDC), the current day\'s open, high and low (DO, DH, DL), and the same for the previous and current week (PWO, PWH, PWL, PWC and WO, WH, WL).\n\nThe values come from real daily and weekly regular-trading-hours bars that Spectral loads beside the chart\'s own bars, so they are correct on any bar size, even when the chart has loaded only a few hours of history.',
    howToRead: 'The previous day\'s and week\'s high and low frame the range the market accepted; a move beyond them, and whether price holds there or returns inside, tells you more than the touch itself. The prior close is where the last session settled, and the open is where the current period began, so price above or below the open shows who has controlled the period so far.\n\nThe current day and week high and low move as new extremes print. Levels are references for reaction, acceptance or rejection, not signals on their own.',
    settings: 'Previous day, Current day, Previous week and Current week switch each group; Opens, Highs and lows, and Closes choose which values every enabled group draws. A switched-off group loads no bars.\n\nThe current day is the trading date of the chart\'s last bar, and the previous day is the trading date before it; the same applies to weeks (Monday to Friday). Values use regular trading hours, 09:30 to 16:00 New York time, so the open is the 09:30 open and the close is the 16:00 close (13:00 on early-close days). Before the regular session opens, the current-day levels are hidden.',
    notes: 'Unlike the Previous Day and Previous Week levels computed from the chart\'s own bars, this indicator reads daily and weekly bars directly, so it also works on higher bar sizes and short histories. The current-day and current-week values update live while the chart is open. Weeks run Monday to Friday by New York date, as on stock exchanges; for markets with a Sunday-evening session, bars before Monday count toward the previous week. Needs a Spectral version with schemaVersion 2.',
  },
  calculate(ctx) {
    const { bars, inputs, time, auxiliary } = ctx;
    const levels = {
      prevDayOpen: null, prevDayHigh: null, prevDayLow: null, prevDayClose: null,
      dayOpen: null, dayHigh: null, dayLow: null,
      prevWeekOpen: null, prevWeekHigh: null, prevWeekLow: null, prevWeekClose: null,
      weekOpen: null, weekHigh: null, weekLow: null,
    };
    const lastIndex = bars.length - 1;
    if (lastIndex < 0) return { levels };
    const now = time.ny(bars[lastIndex]);

    // The levels start at the first chart bar of the current day and of the current week.
    const dayStart = time.dayStart(bars[lastIndex]);
    const weekStart = time.weekStart(bars[lastIndex]);

    // The bar of the current period and the last bar of an earlier period, matched by New York date or week.
    const periodBars = (series, keyOf, current) => {
      let currentBar = null;
      for (let index = series.length - 1; index >= 0; index -= 1) {
        const key = keyOf(series[index]);
        if (key === current) currentBar = currentBar || series[index];
        else if (key < current) return { currentBar, previousBar: series[index] };
      }
      return { currentBar, previousBar: null };
    };
    const at = (price, fromTime) => (typeof price === 'number' && Number.isFinite(price) ? { price, fromTime } : null);

    if (inputs.showPrevDay || inputs.showToday) {
      const day = periodBars(auxiliary.daily, (bar) => time.ny(bar).dateKey, now.dateKey);
      if (inputs.showPrevDay && day.previousBar) {
        if (inputs.showOpen) levels.prevDayOpen = at(day.previousBar.open, dayStart);
        if (inputs.showHighLow) {
          levels.prevDayHigh = at(day.previousBar.high, dayStart);
          levels.prevDayLow = at(day.previousBar.low, dayStart);
        }
        if (inputs.showClose) levels.prevDayClose = at(day.previousBar.close, dayStart);
      }
      if (inputs.showToday && day.currentBar) {
        if (inputs.showOpen) levels.dayOpen = at(day.currentBar.open, dayStart);
        if (inputs.showHighLow) {
          levels.dayHigh = at(day.currentBar.high, dayStart);
          levels.dayLow = at(day.currentBar.low, dayStart);
        }
      }
    }

    if (inputs.showPrevWeek || inputs.showThisWeek) {
      const week = periodBars(auxiliary.weekly, (bar) => time.ny(bar).weekKey, now.weekKey);
      if (inputs.showPrevWeek && week.previousBar) {
        if (inputs.showOpen) levels.prevWeekOpen = at(week.previousBar.open, weekStart);
        if (inputs.showHighLow) {
          levels.prevWeekHigh = at(week.previousBar.high, weekStart);
          levels.prevWeekLow = at(week.previousBar.low, weekStart);
        }
        if (inputs.showClose) levels.prevWeekClose = at(week.previousBar.close, weekStart);
      }
      if (inputs.showThisWeek && week.currentBar) {
        if (inputs.showOpen) levels.weekOpen = at(week.currentBar.open, weekStart);
        if (inputs.showHighLow) {
          levels.weekHigh = at(week.currentBar.high, weekStart);
          levels.weekLow = at(week.currentBar.low, weekStart);
        }
      }
    }
    return { levels };
  },
};

Adapt it with an LLM

Paste this into your assistant and replace the second-to-last line with the change you want.

Start from this Spectral custom indicator: https://spectral.trade/indicators/daily-weekly-levels.js
Format reference: https://spectral.trade/docs/custom-indicators.llm.md
Keep the file format and every rule of the reference; give the result a new id, name, shortName and version, and update docs and input descriptions to match.
Keep its live updates exact and fast (section "Fast live updates" of the reference): carry values from bar to bar only through ctx.ta, and raise live.lookback if the change reads further back; Spectral rejects a file whose live updates differ from a full recalculation or are too slow.
Change I want: <describe the change>
Answer with the complete file in one code block, ready to save as <id>.js.