{"record":{"id":"23f269652246f454","repo":"hsliuping/TradingAgents-CN","slug":"indicator-indicator-is-not-supported-please-cho","errorCode":null,"errorMessage":"Indicator {indicator} is not supported. Please choose from: {list(best_ind_params.keys())}","messagePattern":"Indicator (.+?) is not supported\\. Please choose from: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tradingagents/dataflows/interface.py","lineNumber":737,"sourceCode":"            \"ATR: Averages true range to measure volatility. \"\n            \"Usage: Set stop-loss levels and adjust position sizes based on current market volatility. \"\n            \"Tips: It's a reactive measure, so use it as part of a broader risk management strategy.\"\n        ),\n        # Volume-Based Indicators\n        \"vwma\": (\n            \"VWMA: A moving average weighted by volume. \"\n            \"Usage: Confirm trends by integrating price action with volume data. \"\n            \"Tips: Watch for skewed results from volume spikes; use in combination with other volume analyses.\"\n        ),\n        \"mfi\": (\n            \"MFI: The Money Flow Index is a momentum indicator that uses both price and volume to measure buying and selling pressure. \"\n            \"Usage: Identify overbought (>80) or oversold (<20) conditions and confirm the strength of trends or reversals. \"\n            \"Tips: Use alongside RSI or MACD to confirm signals; divergence between price and MFI can indicate potential reversals.\"\n        ),\n    }\n\n    if indicator not in best_ind_params:\n        raise ValueError(\n            f\"Indicator {indicator} is not supported. Please choose from: {list(best_ind_params.keys())}\"\n        )\n\n    end_date = curr_date\n    curr_date = datetime.strptime(curr_date, \"%Y-%m-%d\")\n    before = curr_date - relativedelta(days=look_back_days)\n\n    if not online:\n        # read from YFin data\n        data = pd.read_csv(\n            os.path.join(\n                DATA_DIR,\n                f\"market_data/price_data/{symbol}-YFin-data-2015-01-01-2025-03-25.csv\",\n            )\n        )\n        data[\"Date\"] = pd.to_datetime(data[\"Date\"], utc=True)\n        dates_in_df = data[\"Date\"].astype(str).str[:10]\n","sourceCodeStart":719,"sourceCodeEnd":755,"githubUrl":"https://github.com/hsliuping/TradingAgents-CN/blob/74783e8817d6cf6de29867880631cc555153f36b/tradingagents/dataflows/interface.py#L719-L755","documentation":"Raised by get_stock_stats_indicators_window when the requested indicator name is not a key of best_ind_params (the fixed indicator dictionary: RSI, MACD, boll, etc.). The message interpolates {indicator} and the list of valid keys at raise time.","triggerScenarios":"Calling get_stockstats_indicators_report(symbol, indicator='cci') or a case variant like 'BOLL' — anything not exactly matching a key in best_ind_params in interface.py.","commonSituations":"Assuming any stockstats/pandas-ta indicator name works, case mismatches, or copy-pasting indicator names from other libraries.","solutions":["Read the error message: it lists the supported indicators","Use one of the listed keys exactly (e.g. 'rsi', 'macd', 'boll')","Call get_stock_stats directly for custom indicators outside the curated set"],"exampleFix":"# before\nreport = get_stockstats_indicators_report('AAPL', 'CCI')\n# after\nreport = get_stockstats_indicators_report('AAPL', 'rsi')","handlingStrategy":"validation","validationCode":"import tradingagents.dataflows.interface as iface\nindicator = indicator.lower()\n# whitelist derived from the module's best_ind_params keys\nassert indicator in ('rsi','macd','boll','obv','mfi'), f'unsupported: {indicator}'\nreport = get_stockstats_indicators_report(symbol, indicator)","typeGuard":"def is_supported_indicator(name: str) -> bool:\n    return name.lower() in ('rsi','macd','boll','obv','mfi')","tryCatchPattern":"try:\n    report = get_stockstats_indicators_report(symbol, indicator)\nexcept ValueError as e:\n    if 'not supported' in str(e):\n        report = get_stockstats_indicators_report(symbol, 'rsi')  # default\n    else:\n        raise","preventionTips":["Lowercase user input before passing","Expose the supported list in your UI/validation layer","Wrap user-facing indicator params in an enum"],"tags":["python","indicators","validation"],"backgroundTag":"unsupported-parameter-value","analyzedSha":"74783e8817d6cf6de29867880631cc555153f36b","analyzedAt":"2026-08-28T11:39:07.729Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}