Skip to content

Commit b70cfcc

Browse files
committed
decouple RSI pane eligibility from script name
1 parent e77500b commit b70cfcc

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

lib/compiler-v14.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,29 @@ const appendForceOverlay = (line: string): string => {
66
return `${line.slice(0, -1)}, force_overlay=true)`;
77
};
88

9-
const rsiPanePresetNames = new Set([
10-
"Balanced Intraday",
11-
"Fast EMA Scalper",
12-
"VWAP Session Trader",
13-
"4H Swing Trend",
14-
"RSI Divergence Reversal",
15-
"Spot Accumulation",
16-
"Breakout Momentum",
17-
"Selective Multi-Timeframe",
18-
"Long-Term Trend Guard"
9+
const rsiPanePresetIds = new Set<NonNullable<StrategyConfig["presetId"]>>([
10+
"balanced_intraday",
11+
"fast_ema_scalper",
12+
"vwap_session_trader",
13+
"swing_trend_4h",
14+
"rsi_divergence_reversal",
15+
"spot_accumulation",
16+
"breakout_momentum",
17+
"selective_multi_timeframe",
18+
"long_term_trend_guard"
1919
]);
2020

2121
export function compilePine(config: StrategyConfig): string {
2222
let code = compileBase(config);
2323
const useIntegratedRsiPane =
2424
config.outputMode === "indicator" &&
25-
rsiPanePresetNames.has(config.name) &&
25+
config.presetId !== undefined &&
26+
rsiPanePresetIds.has(config.presetId) &&
2627
(config.momentum.rsiEnabled || config.momentum.divergenceEnabled);
2728

2829
if (!useIntegratedRsiPane) return code;
2930

30-
const showHiddenByDefault = config.name === "4H Swing Trend";
31+
const showHiddenByDefault = config.presetId === "swing_trend_4h";
3132
const declaration = `indicator("${config.name}", overlay=true, max_labels_count=500, max_lines_count=500)`;
3233
const paneDeclaration = `indicator("${config.name}", overlay=false, max_labels_count=500, max_lines_count=500)`;
3334
if (!code.includes(declaration)) {

0 commit comments

Comments
 (0)