${presets.map(p => {
const isApplied = meta.inputs.every(input =>
- (indicator.params[input.name] === (preset.values?.[input.name] ?? input.default))
+ (indicator.params[input.name] === (p.values?.[input.name] ?? input.default))
);
return `
-
-
${preset.name}
-
+
+ ${p.name}
+
`;
}).join('')}
@@ -851,11 +826,36 @@ export function drawIndicatorsOnChart() {
});
}
+function resetIndicator(id) {
+ const indicator = activeIndicators.find(a => a.id === id);
+ if (!indicator) return;
+
+ const IndicatorClass = IR[indicator.type];
+ if (!IndicatorClass) return;
+
+ const instance = new IndicatorClass({ type: indicator.type, params: {}, name: '' });
+ const meta = instance.getMetadata();
+ if (!meta || !meta.inputs) return;
+
+ meta.inputs.forEach(input => {
+ indicator.params[input.name] = input.default;
+ });
+
+ renderIndicatorPanel();
+ drawIndicatorsOnChart();
+}
+
+function removeIndicator(id) {
+ removeIndicatorById(id);
+}
+
// Export functions for module access
export { addIndicator, removeIndicatorById };
// Legacy compatibility functions
window.renderIndicatorList = renderIndicatorPanel;
+window.resetIndicator = resetIndicator;
+window.removeIndicator = removeIndicator;
window.toggleIndicator = addIndicator;
window.showIndicatorConfig = function(id) {
const ind = activeIndicators.find(a => a.id === id);