data fixes, partial custom indicator support

This commit is contained in:
2026-04-08 21:28:31 -04:00
parent b701554996
commit a70dcd954f
81 changed files with 5438 additions and 1852 deletions

View File

@@ -367,6 +367,22 @@ export function useTradingViewIndicators(tvWidget: IChartingLibraryWidget) {
}
isChartReady = true
// Apply any indicators that arrived before chart was ready (e.g. from workspace sync on page load)
const pendingIndicators = Object.values(indicatorStore.indicators).filter(ind => !ind.tv_study_id)
if (pendingIndicators.length > 0) {
console.log('[Indicators] Chart ready, applying', pendingIndicators.length, 'pending indicators from store')
isApplyingTVUpdate = true
;(async () => {
try {
for (const indicator of pendingIndicators) {
await createTVStudy(indicator)
}
} finally {
isApplyingTVUpdate = false
}
})()
}
console.log('[Indicators] Setting up indicator event subscriptions')
console.log('[Indicators] Chart ready, widget:', tvWidget)
@@ -781,6 +797,10 @@ export function useTradingViewIndicators(tvWidget: IChartingLibraryWidget) {
async function createTVStudy(indicator: IndicatorInstance) {
if (!isChartReady) return
// Custom indicators (pandas_ta_name starts with "custom_") are handled by
// useCustomIndicators — they use TV createCustomStudy, not createStudy.
if (indicator.pandas_ta_name.startsWith('custom_')) return
try {
const chart = tvWidget.activeChart()
if (!chart) return