Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/viewer/app/tv-chart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ test('the widget follows the interval, theme and language, and never lets the sy
expect(c.allow_symbol_change).toBe(false);
// no volume bars under the price (owner 2026-12-03)
expect(c.hide_volume).toBe(true);
// drawn as after three clicks on the chart's +: Weekly eight months; the small m keeps our interval (a capital M switches it)
expect(c.range).toBe('8m');
expect(tvConfig('AAPL', 'D', true, 'en', 'x', '#000').range).toBe('2m');
expect(tvConfig('AAPL', 'M', true, 'en', 'x', '#000').range).toBe('33m');
// no range: TradingView's own view of the interval, the last candle near the price scale (a range left ~10 empty candles)
expect('range' in c).toBe(false);
expect(tvConfig('AAPL', 'D', false, 'en', 'tv-2', '#368727').theme).toBe('light');
});

Expand Down
14 changes: 5 additions & 9 deletions src/viewer/app/tv-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,11 @@ export function candleOverrides(c: CandleColors): Record<string, string | boolea
};
}

/**
* how much history each chart shows when drawn (owner 2026-12-03: "for daily 6 month range zoomed (press + 3 times)", then
* "lets use for that refresh button 3 times clicked +", showing the view after three clicks on the chart's +): Daily two
* months, Weekly eight months, Monthly 33 months, the spans of that view; a reload or ↻ draws it so again. Spelled with
* a small m on purpose: the widget keeps our interval for `2m`, while `6M` (its date-range button) switches the chart to
* 2 hours and `12M` or `60M` to its own interval (checked in Chrome 2026-12-03)
*/
export const TV_RANGE: Record<TvInterval, string> = { D: '2m', W: '8m', M: '33m' };
// No `range`: each chart opens on TradingView's own view of its interval, about 2.5 months of Daily, 9 months of Weekly
// and 3.5 years of Monthly, with the last candle 4 to 5 candles from the price scale. A `range` (2m, 8m, 33m from the
// owner's "press + 3 times", 2026-12-03) fit those spans but left about 10 empty candles at the right; the owner asked for
// the default look instead (2026-12-03: "we must checge this ... when click here [↻] to this"). The right room itself is
// not ours to set: tv.js passes overrides for it, the chart ignores them (checked in Chrome 2026-12-03)

/**
* the widget's settings: our interval, theme, language and card colour; no symbol change, no toolbar (our pills pick the
Expand All @@ -86,7 +83,6 @@ export function tvConfig(ticker: string, interval: TvInterval, dark: boolean, la
autosize: true,
symbol: tvSymbol(ticker),
interval,
range: TV_RANGE[interval],
timezone: 'America/New_York',
theme: dark ? 'dark' : 'light',
style: '1',
Expand Down
2 changes: 1 addition & 1 deletion src/viewer/ui/Fundamentals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function FundamentalsLink({ p, className, children }: { p: Position; clas
const sizes = asSplit(pr.fundamentalsSplit[set], shown.length);
const saveSizes = (v: number[]) => setPrefs({ fundamentalsSplit: { ...prefs.get().fundamentalsSplit, [set]: v } });
// ↻ draws the charts again as they open (owner 2026-12-03: "if i want to reset i will click refresh and it should
// refresh to standard"): each one's own history range, equal widths
// refresh to standard"): each in TradingView's own view of its interval, equal widths
const reset = () => {
const rest = { ...prefs.get().fundamentalsSplit };
delete rest[set];
Expand Down