fix: Improve TradingView UI compatibility and debugging for parameter…#276
fix: Improve TradingView UI compatibility and debugging for parameter…#276alorbach wants to merge 1 commit intoakumidv:mainfrom
Conversation
fba60eb to
340972e
Compare
|
44bffde to
d132608
Compare
… name mismatches This commit addresses critical issues with TradingView's evolving UI and adds robust debugging capabilities for parameter name mismatches that cause runtime errors. - Added comprehensive debugging instructions at the top of the file for troubleshooting "Net profit: All Error on runtime" issues - Implemented automatic parameter name detection and correction system: - `logAvailableParameters()`: Logs all available parameters from TradingView reports - `findBestNetProfitParam()`: Intelligently finds correct "Net profit" parameter variations - `setOptParamName()`: Manual parameter name override function for debugging - Enhanced error handling in `getInitBestValues()`, `getTestIterationResult()`, and `getResWithBestValue()` to handle parameter name mismatches gracefully - Added parameter name patterns matching for various TradingView versions: - 'Net profit: All', 'Net Profit: All', 'Net P&L: All', etc. - Improved fallback mechanisms when expected parameter names don't exist - Added new selectors for TradingView's updated deep backtesting UI: - `strategyDeepTestDateRangeButton`: Date range button selector - `strategyDeepTestCustomDateRangeButton`: Custom date range option - `strategyDeepTestDateInputs`: Date input fields - `strategyDeepTestSelectButton`: Select button for date confirmation - `strategyDeepTestUpdateReportButton`: Update report button - Added selectors for loading state detection: - `strategyReportLoadingSnackbar`: Loading indicator - `strategyReportSuccessSnackbar`: Success confirmation - Completely rewrote `setDeepTestDateRange()` function to handle new TradingView UI flow: 1. Click date range button → 2. Click "Custom date range..." → 3. Set dates → 4. Click "Select" - Added fallback support for older TradingView UI versions - Improved error handling with try/catch blocks and graceful degradation - Added comprehensive debug logging for troubleshooting date setting issues - Integrated "Update report" button handling into main process flow in `getPerformance()` - Added intelligent loading state detection with snackbar monitoring - Enhanced debug logging throughout the performance analysis process - Improved error detection and process state management - Added timeout handling for report update operations (30-second max wait) - Added 170+ lines of new functionality in backtest.js - Enhanced 27 selectors in selector.js for UI compatibility - Expanded 241 lines in tv.js for improved deep backtesting support - Comprehensive error handling and logging throughout - Backward compatibility maintained with older TradingView versions - Fixed parameter name mismatch errors causing "Net profit: All Error on runtime" - Resolved deep backtesting date range setting issues with new TradingView UI - Improved handling of TradingView's asynchronous report generation - Enhanced detection of completed backtesting processes This update ensures the extension continues to work reliably with TradingView's UI changes while providing better debugging capabilities for troubleshooting parameter-related issues. * Updated 2025-07-08 * Refactors the deep backtest date range setting functionality to be more resilient and robust against recent TradingView UI changes. - Updates selectors for the date picker dialog to be more specific, targeting buttons and inputs more accurately. - Implements a more reliable method for clearing date input fields by simulating keyboard events (Ctrl+A + Backspace). - Adds a pre-check to verify if the correct dates are already set, avoiding unnecessary changes by canceling the dialog. - Introduces logic to handle cases where an invalid date is selected. If the "Select" button is disabled, the "Select first available date" button is clicked automatically to correct the range. * Updated 2025-07-08 * - Fixed potentional memory leak - Fixed Backtest new UI Updating Report Button DIV detection if no Update Report button occurs.
d132608 to
04f03d0
Compare
|
Hi @alorbach, Thanks for the reply and for maintaining this tool - really appreciate the quick guidance. Unfortunately, I am still getting the 'error' in about 10% of iterations. I followed the suggested steps in this thread in order to switch the optimization metric to Sharpe ratio. Here’s exactly what I did:
So while everything seems correctly configured, the extension still seems to fail to recognize the optimization target. Please let me know if there’s another override or step I might have missed. Thanks again for the help so far! |
|
The new version fully reenginered with variables renaming too. Reviewing this pull request demand a lot of efforts and it will be zero results after deploying new version. Sorry. |
… name mismatches
This commit addresses critical issues with TradingView's evolving UI and adds robust debugging capabilities for parameter name mismatches that cause runtime errors.
Added comprehensive debugging instructions at the top of the file for troubleshooting "Net profit: All Error on runtime" issues
Implemented automatic parameter name detection and correction system:
logAvailableParameters(): Logs all available parameters from TradingView reportsfindBestNetProfitParam(): Intelligently finds correct "Net profit" parameter variationssetOptParamName(): Manual parameter name override function for debuggingEnhanced error handling in
getInitBestValues(),getTestIterationResult(), andgetResWithBestValue()to handle parameter name mismatches gracefullyAdded parameter name patterns matching for various TradingView versions:
Improved fallback mechanisms when expected parameter names don't exist
Added new selectors for TradingView's updated deep backtesting UI:
strategyDeepTestDateRangeButton: Date range button selectorstrategyDeepTestCustomDateRangeButton: Custom date range optionstrategyDeepTestDateInputs: Date input fieldsstrategyDeepTestSelectButton: Select button for date confirmationstrategyDeepTestUpdateReportButton: Update report buttonAdded selectors for loading state detection:
strategyReportLoadingSnackbar: Loading indicatorstrategyReportSuccessSnackbar: Success confirmationCompletely rewrote
setDeepTestDateRange()function to handle new TradingView UI flow:Added fallback support for older TradingView UI versions
Improved error handling with try/catch blocks and graceful degradation
Added comprehensive debug logging for troubleshooting date setting issues
Integrated "Update report" button handling into main process flow in
getPerformance()Added intelligent loading state detection with snackbar monitoring
Enhanced debug logging throughout the performance analysis process
Improved error detection and process state management
Added timeout handling for report update operations (30-second max wait)
Added 170+ lines of new functionality in backtest.js
Enhanced 27 selectors in selector.js for UI compatibility
Expanded 241 lines in tv.js for improved deep backtesting support
Comprehensive error handling and logging throughout
Backward compatibility maintained with older TradingView versions
Fixed parameter name mismatch errors causing "Net profit: All Error on runtime"
Resolved deep backtesting date range setting issues with new TradingView UI
Improved handling of TradingView's asynchronous report generation
Enhanced detection of completed backtesting processes
This update ensures the extension continues to work reliably with TradingView's UI changes while providing better debugging capabilities for troubleshooting parameter-related issues.