Premarket High/Low
Premarket high and low from 04:10 to 09:30 New York time, plus the opening-volatility extremes before 04:10.
- PMx
- Built into Spectral
- Updates every tick
- premarket
- pre-market high
- pre-market low
- gap
- opening
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.

Overview
PMx marks PMH and PML, the highest and lowest prices of the latest date's pre-market from 04:10 to 09:30 New York time. The first ten pre-market minutes are kept apart because that opening period can be unusually volatile.
How to read it
PMH and PML frame where the market traded before the open; the regular session often reacts at them. PMHvex is the highest wick from 04:00 to 04:09, shown only when it is above PMH; PMLvex is the lowest wick of that window, shown only when it is below PML. They are context levels, not replacements for PMH and PML.
Settings and limitations
There is nothing to set. The chart must show pre-market bars, and the bar size must be 10 minutes or less so the 04:00-04:10 window can be told apart; 1 minute matches the built-in exactly.
Notes
Computes the same levels as the built-in PMx in Spectral on a 1-minute chart. The built-in reads 1-minute pre-market bars on every bar size, which a custom indicator cannot do in schema v1.
What it draws
Levels
- PMHsolid · 1 px · value on the axis
#B7A1C8 - PMLsolid · 1 px · value on the axis
#B7A1C8 - PMHvexdotted · 1 px · value on the axis
#B7A1C8 - PMLvexdotted · 1 px · value on the axis
#B7A1C8
Source
Save it as pmx.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').IndicatorV1} */
export default {
schemaVersion: 1,
id: 'pmx',
name: 'Premarket High/Low',
shortName: 'PMx',
version: '1.0.0',
author: 'Spectral',
description: 'Premarket high and low from 04:10 to 09:30 New York time, plus the opening-volatility extremes before 04:10.',
pane: 'price',
live: { lookback: 0 },
levels: {
high: { label: 'PMH', color: '#B7A1C8', showValue: true },
low: { label: 'PML', color: '#B7A1C8', showValue: true },
highVex: { label: 'PMHvex', color: '#B7A1C8', lineStyle: 'dotted', showValue: true },
lowVex: { label: 'PMLvex', color: '#B7A1C8', lineStyle: 'dotted', showValue: true },
},
docs: {
overview: 'PMx marks PMH and PML, the highest and lowest prices of the latest date\'s pre-market from 04:10 to 09:30 New York time. The first ten pre-market minutes are kept apart because that opening period can be unusually volatile.',
howToRead: 'PMH and PML frame where the market traded before the open; the regular session often reacts at them. PMHvex is the highest wick from 04:00 to 04:09, shown only when it is above PMH; PMLvex is the lowest wick of that window, shown only when it is below PML. They are context levels, not replacements for PMH and PML.',
settings: 'There is nothing to set. The chart must show pre-market bars, and the bar size must be 10 minutes or less so the 04:00-04:10 window can be told apart; 1 minute matches the built-in exactly.',
notes: 'Computes the same levels as the built-in PMx in Spectral on a 1-minute chart. The built-in reads 1-minute pre-market bars on every bar size, which a custom indicator cannot do in schema v1.',
},
calculate(ctx) {
const { bars, ta, time } = ctx;
const OPEN = 4 * 60;
const MAIN = 4 * 60 + 10;
const END = 9 * 60 + 30;
if (bars.length === 0) return { levels: { high: null, low: null, highVex: null, lowVex: null } };
const widen = (range, bar) => {
if (range === null) return { high: bar.high, low: bar.low };
if (bar.high <= range.high && bar.low >= range.low) return range;
return { high: Math.max(range.high, bar.high), low: Math.min(range.low, bar.low) };
};
// The day's pre-market ranges carry from bar to bar through ta.scan; a new New York date starts them again.
const states = ta.scan(bars, { date: '', main: null, opening: null }, (state, bar) => {
const info = time.ny(bar);
const fresh = info.dateKey !== state.date;
const main = fresh ? null : state.main;
const opening = fresh ? null : state.opening;
const nextMain = info.minutes >= MAIN && info.minutes < END ? widen(main, bar) : main;
const nextOpening = info.minutes >= OPEN && info.minutes < MAIN ? widen(opening, bar) : opening;
// A bar that changes nothing returns the state itself, which ta.scan keeps without copying it.
if (!fresh && nextMain === state.main && nextOpening === state.opening) return state;
return { date: info.dateKey, main: nextMain, opening: nextOpening };
});
const { main, opening } = states[states.length - 1];
return {
levels: {
high: main === null ? null : main.high,
low: main === null ? null : main.low,
highVex: main !== null && opening !== null && opening.high > main.high ? opening.high : null,
lowVex: main !== null && opening !== null && opening.low < main.low ? opening.low : null,
},
};
},
};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/pmx.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.


