custom indicators fixed
This commit is contained in:
@@ -6,6 +6,7 @@ import { useTradingViewShapes } from '../composables/useTradingViewShapes'
|
||||
import { useTradingViewIndicators } from '../composables/useTradingViewIndicators'
|
||||
import { useCustomIndicators, getCustomIndicatorsGetter } from '../composables/useCustomIndicators'
|
||||
import { useChartStore } from '../stores/chart'
|
||||
import { useIndicatorTypesStore } from '../stores/indicatorTypes'
|
||||
import type { IChartingLibraryWidget } from '../types/tradingview'
|
||||
import { intervalToSeconds } from '../utils'
|
||||
import { wsManager } from '../composables/useWebSocket'
|
||||
@@ -51,6 +52,9 @@ function initChart() {
|
||||
try {
|
||||
datafeed = createTradingViewDatafeed()
|
||||
|
||||
const indicatorTypesStore = useIndicatorTypesStore()
|
||||
console.log('[ChartView] indicator_types at widget init:', Object.keys(indicatorTypesStore.types))
|
||||
|
||||
tvWidget = new window.TradingView.widget({
|
||||
symbol: chartStore.symbol, // Use symbol from store
|
||||
datafeed: datafeed,
|
||||
@@ -58,104 +62,16 @@ function initChart() {
|
||||
container: chartContainer.value!,
|
||||
library_path: '/charting_library/',
|
||||
locale: 'en',
|
||||
// Register the two generic custom study dispatch types.
|
||||
// Register named studies (one per custom indicator type) plus generic fallbacks.
|
||||
// Must be provided here — TV has no dynamic study registration API.
|
||||
custom_indicators_getter: getCustomIndicatorsGetter(),
|
||||
// indicatorTypesStore is populated before widget creation (session ready guard).
|
||||
custom_indicators_getter: getCustomIndicatorsGetter(() => indicatorTypesStore.types),
|
||||
disabled_features: [
|
||||
'use_localstorage_for_settings',
|
||||
'header_symbol_search',
|
||||
'symbol_search_hot_key'
|
||||
],
|
||||
enabled_features: [],
|
||||
// Restrict indicators to only those supported by both TA-Lib and TradingView.
|
||||
// Custom AI-generated indicators (from custom_indicators_getter) must also be listed here.
|
||||
studies_access: {
|
||||
type: 'white',
|
||||
tools: [
|
||||
// AI custom indicator dispatch studies
|
||||
{ name: 'dxo_customstudy_overlay' },
|
||||
{ name: 'dxo_customstudy_pane' },
|
||||
// Overlap Studies (14)
|
||||
{ name: 'Moving Average' },
|
||||
{ name: 'Moving Average Exponential' },
|
||||
{ name: 'Weighted Moving Average' },
|
||||
{ name: 'DEMA' },
|
||||
{ name: 'TEMA' },
|
||||
{ name: 'Triangular Moving Average' },
|
||||
{ name: 'KAMA' },
|
||||
{ name: 'MESA Adaptive Moving Average' },
|
||||
{ name: 'T3' },
|
||||
{ name: 'Bollinger Bands' },
|
||||
{ name: 'Midpoint' },
|
||||
{ name: 'Midprice' },
|
||||
{ name: 'Parabolic SAR' },
|
||||
{ name: 'Hilbert Transform - Instantaneous Trendline' },
|
||||
// Momentum Indicators (21)
|
||||
{ name: 'Relative Strength Index' },
|
||||
{ name: 'Momentum' },
|
||||
{ name: 'Rate of Change' },
|
||||
{ name: 'TRIX' },
|
||||
{ name: 'Chande Momentum Oscillator' },
|
||||
{ name: 'Directional Movement Index' },
|
||||
{ name: 'Average Directional Movement Index' },
|
||||
{ name: 'Average Directional Movement Index Rating' },
|
||||
{ name: 'Absolute Price Oscillator' },
|
||||
{ name: 'Percentage Price Oscillator' },
|
||||
{ name: 'MACD' },
|
||||
{ name: 'Money Flow Index' },
|
||||
{ name: 'Stochastic' },
|
||||
{ name: 'Stochastic Fast' },
|
||||
{ name: 'Stochastic RSI' },
|
||||
{ name: 'Williams %R' },
|
||||
{ name: 'Commodity Channel Index' },
|
||||
{ name: 'Aroon' },
|
||||
{ name: 'Aroon Oscillator' },
|
||||
{ name: 'Balance Of Power' },
|
||||
{ name: 'Ultimate Oscillator' },
|
||||
// Volume Indicators (3)
|
||||
{ name: 'Chaikin A/D Line' },
|
||||
{ name: 'Chaikin A/D Oscillator' },
|
||||
{ name: 'On Balance Volume' },
|
||||
// Volatility Indicators (3)
|
||||
{ name: 'Average True Range' },
|
||||
{ name: 'Normalized Average True Range' },
|
||||
{ name: 'True Range' },
|
||||
// Price Transform (4)
|
||||
{ name: 'Average Price' },
|
||||
{ name: 'Median Price' },
|
||||
{ name: 'Typical Price' },
|
||||
{ name: 'Weighted Close Price' },
|
||||
// Cycle Indicators (5)
|
||||
{ name: 'Hilbert Transform - Dominant Cycle Period' },
|
||||
{ name: 'Hilbert Transform - Dominant Cycle Phase' },
|
||||
{ name: 'Hilbert Transform - Phasor Components' },
|
||||
{ name: 'Hilbert Transform - SineWave' },
|
||||
{ name: 'Hilbert Transform - Trend vs Cycle Mode' },
|
||||
// Statistic Functions (9)
|
||||
{ name: 'Beta' },
|
||||
{ name: 'Pearson\'s Correlation Coefficient' },
|
||||
{ name: 'Linear Regression' },
|
||||
{ name: 'Linear Regression Angle' },
|
||||
{ name: 'Linear Regression Intercept' },
|
||||
{ name: 'Linear Regression Slope' },
|
||||
{ name: 'Standard Deviation' },
|
||||
{ name: 'Time Series Forecast' },
|
||||
{ name: 'Variance' },
|
||||
// Custom Indicators (12)
|
||||
{ name: 'VWAP' },
|
||||
{ name: 'VWMA' },
|
||||
{ name: 'Hull Moving Average' },
|
||||
{ name: 'SuperTrend' },
|
||||
{ name: 'Donchian Channels' },
|
||||
{ name: 'Keltner Channels' },
|
||||
{ name: 'Chaikin Money Flow' },
|
||||
{ name: 'Vortex Indicator' },
|
||||
{ name: 'Awesome Oscillator' },
|
||||
{ name: 'Accelerator Oscillator' },
|
||||
{ name: 'Choppiness Index' },
|
||||
{ name: 'Mass Index' }
|
||||
]
|
||||
},
|
||||
fullscreen: false,
|
||||
autosize: true,
|
||||
theme: 'Dark',
|
||||
|
||||
@@ -326,6 +326,11 @@ const sendMessage = async (event: any) => {
|
||||
// Show typing indicator immediately (before first chunk arrives)
|
||||
isAgentProcessing.value = true
|
||||
|
||||
// Add thinking bubble in a macrotask so it runs in the same execution context
|
||||
// as the WebSocket handler (where tool bubbles work). nextTick / sync both fail
|
||||
// because vue-advanced-chat processes the send-message event asynchronously.
|
||||
setTimeout(() => addToolCallBubble('Thinking...'), 0)
|
||||
|
||||
// Mark as distributed (single checkmark) after confirming WS send
|
||||
setTimeout(() => {
|
||||
const msgIndex = messages.value.findIndex(m => m._id === messageId)
|
||||
|
||||
Reference in New Issue
Block a user