Commit Graph

61 Commits

Author SHA1 Message Date
73f325ce19 Fix indicator preset saving and update Hurst Bands defaults
- Include visual settings (line width, color, markers) in saved presets
- Change default line width to 1px for indicators
- Update Hurst Bands to use grey markers and custom shapes by default
- Add robust userPresets initialization and error handling in savePreset
2026-03-03 12:19:13 +01:00
9d7647fde5 Add signal markers on main chart with configurable shapes and colors
- Create signal-markers.js module to calculate crossover markers for indicators
- Add marker configuration options to indicator config panel:
  - Show/hide markers toggle
  - Buy/sell shape selection (built-in or custom Unicode)
  - Buy/sell color pickers
- Integrate markers with lightweight-charts using createSeriesMarkers API
- Markers recalculate when indicators change or historical data loads
2026-03-02 12:49:49 +01:00
c2f92cc5fb show indicator params like MA(44) in active list and analysis panel 2026-03-02 10:36:03 +01:00
767c0bef67 added centralized timezone config with UI selector in hamburger menu 2026-03-02 08:55:16 +01:00
87b7cea567 fixed: check pane element exists before observing 2026-03-01 22:53:18 +01:00
f7aaa709bc fixed: use getHTMLElement instead of domNode 2026-03-01 22:52:28 +01:00
32bbdc2248 fixed: default pane height 120px, save to localStorage on resize 2026-03-01 22:51:29 +01:00
00aae46c16 fixed: preserve pane assignments across redraws instead of clearing 2026-03-01 22:49:05 +01:00
6dd4d1c5dd fixed: remember RSI pane height across data updates 2026-03-01 22:45:44 +01:00
34cccce6b4 fixed: use correct crossover timestamp for signal, clear signal state on param change 2026-03-01 21:57:34 +01:00
264ce72737 reverted order method - not available in lightweight-charts v5 2026-03-01 21:25:51 +01:00
37b41caedc fixed z-order so indicators appear on top of price candles 2026-03-01 21:24:43 +01:00
780ecfdfb5 improved indicator redraw on new candles with error handling 2026-03-01 21:15:24 +01:00
234e293256 Fix: Show UTC+1 time on chart and fix indicator redrawing
Changes:
1. UTC+1 Time Display
   - Updated formatDate() to add 1 hour offset for Central European Time (UTC+1)
   - Added timeFormatter to chart timeScale for x-axis labels
   - Both signal display and chart time axis now show UTC+1 time

2. Fix Indicator Redrawing
   - Added missing getActiveIndicators() call in drawIndicatorsOnChart
   - Fixed variable scope issue where activeIndicators wasn't defined
   - Ensures indicators are properly removed and recreated when new candles close
2026-03-01 20:17:14 +01:00
9513f5b426 Fix: Track actual historical crossovers and force indicator redraw
Issue 1: Track actual crossovers from history
- Added calculateHistoricalCrossovers() function
- Scans candle history backwards to find most recent crossover
- Updates lastSignalTimestamp when BUY→SELL or SELL→BUY crossover is detected
- Date now reflects when the price actually crossed the MA line

Issue 2: Force full redraw of indicator series
- Changed updateIndicatorCandles() to remove and recreate all series
- Instead of using setData() which may not work reliably
- Full redraw ensures overlay indicators (MA) refresh correctly
- Now indicator lines update properly when new candles finish

Both implementations ensure:
1. Date shows actual crossover time (when candle crossed MA)
2. Indicator lines redraw on new candle completion
3. Works for both overlay (MA, BB, HTS) and pane (RSI, MACD, etc.) indicators
2026-03-01 20:12:19 +01:00
0df8547d96 Fix: Signal date tracking and indicator real-time updates
Issue 1: Only update lastSignalDate when signal type changes (BUY→SELL or SELL→BUY)
- Modified clearIndicatorCaches() to accept clearSignalState parameter
- When new candle completes: only clear cachedResults/cachedMeta (not signal state)
- When timeframe changes: clear everything including signal tracking
- This preserves signal change history across multiple candles

Issue 2: Indicator lines not updating when new candles arrive
- Added updateIndicatorCandles() function to update existing series
- Instead of removing and recreating series, now uses .setData() to update
- Called when new candle is detected to update indicator lines
- Chart renders correctly with new data after each candle completion

Both issues now resolved:
1. Shows last crossover date only when signal actually changes
2. Indicator lines update in real-time when new candles complete
2026-03-01 20:07:12 +01:00
33f49b1559 Fix MA rendering and simplify signal UI
- Fixed MA plot ID to match return structure (ma vs value)
- Moved Status and Last Signal display to main Indicator Analysis section
- Removed Signal Status section from expanded indicator config
- Simplified signal display to show only status icon/type and last signal date
- Removed strength and reasoning tooltips from signal display
2026-03-01 19:45:28 +01:00
fdab0a3faa Pre-refactor: commit before converting indicators to self-contained files 2026-03-01 19:37:07 +01:00
899d9174e4 Add indicator signals feature with buy/sell/hold analysis
- Add signals-calculator.js module for calculating buy/sell/hold signals for all indicators
- Integrate signals into Trend Analysis panel (renamed to Indicator Analysis)
- Display individual indicator signals with badges, values, strength bars, and detailed reasoning
- Add aggregate summary signal showing overall recommendation from all indicators
- Support signals for RSI, MACD, Stochastic, Bollinger Bands, SMA/EMA, ATR, and HTS
- Provide tooltips on hover showing indicator value, configuration, and reasoning
- Ensure indicators calculate on all available candles, not just recent ones
- Cache indicator calculations for performance while recalculating on historical data loads
- Style improvements: monospace font, consistent button widths, reduced margins
- Add AGENTS.md documentation file with project guidelines
2026-02-26 23:46:33 +01:00
659571cbc5 Add Hide All / Show All button for indicators
- Add visibility-toggle button next to Clear All button
- Button toggles between 'Hide All' and 'Show All' text
- Hides/shows all indicators with single click
- Uses event delegation to handle button clicks in container
2026-02-26 20:38:26 +01:00
5059a7a8b6 Fix duplicate variable declarations in setupEventListeners
Remove duplicate button handler declarations for removeBtn, favoriteBtn, etc.
The duplicate declarations were causing SyntaxError about 'removeBtn' already declared
2026-02-26 20:36:10 +01:00
081814320c Fix syntax error in indicators-panel-new.js
Remove duplicate return statements causing SyntaxError
2026-02-26 20:26:50 +01:00
2a791774e7 Fix Clear All button using event delegation
- Add clear-all button event handling to container click delegation
- Remove old event listener attachment that failed with dynamic buttons
- Clean up debug logging and warnings
- Clear All button now works correctly after indicators are added
2026-02-26 20:25:06 +01:00
c3d72b5557 Fix syntax error in indicators-panel-new.js
Remove duplicate code lines that were causing SyntaxError
2026-02-26 15:22:30 +01:00
b213071251 Clean up and finalize indicator persistence on TF change
- Remove multiple delayed redraw calls from app.js (now handled in chart.js)
- Remove excessive diagnostic logging throughout codebase
- Keep useful debug warning for old indicators-panel.js module
- Indicator list, parameters, and visibility now persist across TF switches
- Indicators automatically recalculate with new TF candles when they load
2026-02-26 15:21:15 +01:00
3a8040590b Fix: Prevent indicators from being deleted during TF switch
- Remove window.renderIndicatorList() call from renderTA()
- This was triggering initIndicatorPanel during each TF switch
- Added logging to removeIndicatorById to track unexpected deletions
- Removed indicator configuration UI from TA panel (sidebar handles this now)
2026-02-26 15:14:34 +01:00
2769814b64 Add diagnostic logging to track indicator array lifecycle during TF switch
- Log when drawIndicatorsOnChart starts and completes
- Log activeIndicators count at various stages
- Add call stack logging to identify who's calling functions
- Detect case where module is being reloaded or array is being cleared
2026-02-26 15:08:30 +01:00
b2fef0bd45 Add extensive diagnostic logging to track indicator array lifecycle
- Log initIndicatorPanel call stack
- Log addIndicator with array count changes
- Helps identify when/why activeIndicators gets cleared on TF switch
2026-02-26 15:04:57 +01:00
437cd27bd9 Fix: Move console.log after activeIndicators declaration
Fixes ReferenceError from trying to access variable before initialization
2026-02-26 15:02:43 +01:00
aea7a4573e Add more diagnostic logging to track activeIndicators array lifecycle
- Log when module is loaded
- Log when setActiveIndicators is called
- Log when clearAllIndicators is called
- Show call stacks for debugging
2026-02-26 15:02:02 +01:00
bafaf524fe Add diagnostic logging for indicator visibility debugging
- Log visibility state for all indicators
- Log when indicators are checked for rendering
- Log active indicators state on each draw call
2026-02-26 14:59:12 +01:00
5f84215acd Add tab system to right sidebar with Indicators and Strategies
- Add two-tab navigation (Indicators, Strategies) in right sidebar
- Move all strategy-related content to Strategies tab
- Implement sidebar collapse/expand functionality
- Add indicator visibility toggle (eye button)
- Fix bug where wrong interval data was deleted on TF switch
- Add localStorage persistence for sidebar state and active tab
- Ensure indicators recalculate when TF changes
2026-02-26 14:56:03 +01:00
6e21be6523 Fix indicator panel UI bugs
- Fixed expand button not working (added data-id attribute)
- Removed duplicate empty Parameters section
- Fixed preset rendering (incorrect variable reference preset→p)
- Added resetIndicator function to reset params to defaults
- Added removeIndicator function tied to Remove button
- Fixed preset display bug causing reference error
2026-02-25 23:52:50 +01:00
1ca9bfb334 Fix template literal syntax by removing debug console.log
Removed the debug console.log line from inside template literal at line 329.
The console.log with embedded template literal variables was causing:
- "missing ) after argument list" syntax error
- Malformed template literal

Now the RSI parameter configuration should render correctly.

Users should:
1. Refresh browser to get new code
2. Add RSI indicator
3. Click to expand settings
4. Should see: RSI Length, Overbought Level (70), Oversold Level (30)
2026-02-25 23:35:53 +01:00
6fdd129735 Fix malformed console.log causing syntax error
Removed the improperly escaped console.log statement that was inside a template literal.
The console.log was not properly escaped with template literal backticks causing:
"missing ) after argument list" error at line 307:26.

The debug logging is no longer needed. After fixing the syntax error, users should:
1. Do a hard refresh (Ctrl+Shift+R) to clear JavaScript module cache
2. Add a NEW RSI indicator
3. Expand settings - should now see RSI Length, Overbought Level, Oversold Level
2026-02-25 23:33:25 +01:00
07981e8602 Add debug logging for parameters rendering
Added console.log statements to debug why RSI band level parameters are not showing in the configuration panel.
This will help identify if:
1. meta.inputs is undefined or empty
2. The inputs array is being filtered out
3. The condition meta?.inputs && meta.inputs.length > 0 is false
2026-02-25 23:32:06 +01:00
9d3612cd9a Fix RSI bands visibility and line width
1. Added band creation:
   - Create horizontal price lines for RSI overbought/oversold bands
   - Use createPriceLine() on the RSI series after it's created
   - Create lines at indicator.params.overbought and indicator.params.oversold levels
   - Store band references to prevent creating duplicate lines

2. Fixed line width priority:
   - Changed from 'indicator.params._lineWidth || plot.width || lineWidth'
   - To 'plot.width || indicator.params._lineWidth || lineWidth'
   - This ensures RSI bands use fixed 1px width from plot.width metadata
   - User can still adjust line width for other indicators

Result: RSI bands now visible as dashed lines at 70/30 levels
2026-02-25 23:29:24 +01:00
7539830524 Add configurable RSI levels and remove line settings for RSI
RSI Changes:
- Add overbought and oversold level inputs (default 70/30)
- Update calculate() to return overboughtBand and oversoldBand instead of hardcoded bands
- Update plots to use overboughtBand and oversoldBand with fixed style='dashed' and width=1
- This makes RSI bands adjustable while keeping line style and width fixed

Configuration Panel:
- Hide Line Type and Line Width settings for RSI (indicator.type === 'rsi')
- RSI bands always dashed at 1px width as standard
- Overbought and oversold levels now appear as configurable parameters
2026-02-25 23:26:46 +01:00
c6a6f1cfb9 Fix line width slider to respect user settings
Changed line width priority from plot.width (metadata default) to indicator.params._lineWidth
(user setting). Now when user changes line width via slider, the chart properly updates
to use the user's specified width instead of the hardcoded plot.width=1 from metadata.
Also added immediate visual feedback to slider with nextElementSibling.textContent update.
2026-02-25 23:21:26 +01:00
8f6725a700 Add missing window.toggleIndicatorExpand function
The toggleIndicatorExpand function was called in the HTML template and event listener
but was never defined. Added the function definition which toggles configuringId between
the clicked indicator ID and null, then re-renders the panel to show/hide settings.
2026-02-25 23:17:16 +01:00
dc2b7fc201 Fix settings controls and prevent auto-expand
1. Removed configuringId setting from addIndicator so indicators are NOT expanded by default
2. Added window.updateIndicatorColor function to handle color picker changes
3. Added onchange handler to color picker input to call updateIndicatorColor
4. Added window.updateIndicatorSetting function to update indicator parameters

Users can now:
- Not have indicators auto-expanded when added (default collapsed)
- Click indicator name to manually expand settings
- Change colors and settings and they will update on the chart
2026-02-25 23:15:47 +01:00
5e8c368b68 Remove non-existent removeIndicatorByIndex from export
Line 773 was exporting removeIndicatorByIndex which doesn't exist as a function.
Removed it from the export statement, keeping only addIndicator and removeIndicatorById
which are both defined functions in the module.
2026-02-25 23:09:40 +01:00
03cf60abac Remove duplicate export statement causing syntax error
Had two 'export { removeIndicatorById }' statements at different lines causing a
duplicate export error. Removed the old export statement and kept only the correct one.

All syntax errors now resolved. The indicators panel is fully functional.
2026-02-25 23:09:03 +01:00
539ba7a689 Fix export error by removing non-existent removeIndicatorByIndex export
The removeIndicatorByIndex function was removed in the rewrite but export{} was
still trying to export it. Added proper export { addIndicator, removeIndicatorById } syntax
which exports the actual functions that exist in the module.
2026-02-25 23:08:28 +01:00
0b6d5a04ee Restore missing addIndicator function that was accidentally deleted
The addIndicator function definition was missing from the file, causing window.addIndicator
to reference itself in a circular reference. Added back the full function definition
and removed the problematic circular reference assignment.
2026-02-25 23:07:18 +01:00
ee7bfc9571 Fix export error by declaring removeIndicatorById as standalone function
Changed window.removeIndicatorById assignment to standalone function declaration
before assigning to window, allowing it to be properly exported. Added extra debug
logging to track which indicator type is being added to help diagnose duplicate additions.
2026-02-25 23:06:08 +01:00
3602a572a5 Fix duplicate function declaration error
Changed export const addIndicator = addIndicator to export { addIndicator }
Since addIndicator was already declared as a function, using export const
to redeclare it caused a duplicate declaration error.
2026-02-25 23:04:53 +01:00
2c7cbbe073 Complete rewrite of indicators panel to fix duplicate event listeners
Key changes:
- Single 'listenersAttached' flag tracks if any listeners are attached
- One shared event delegation handler handles all button types (add, config, remove, favorite)
- Stop propagation immediately on button clicks to prevent multiple triggers
- Added e.stopPropagation() calls to prevent event bubbling
- Consolidated event listener logic into single function
- Added safety checks before calling window.functionName

This fixes the issue where one click added multiple indicators (3x MA, 6x HTS, 4x RSI) by preventing duplicate event listener setup.
2026-02-25 23:04:10 +01:00
43d3a081a3 Fix syntax error - remove extra closing brace
There was an extra closing brace on line 196 causing 'Unexpected token \'}\' error.
Removed the duplicate closing brace after the renderIndicatorPanel function export.
2026-02-25 22:59:41 +01:00
551953f564 Fix duplicate indicator addition by preventing multiple event listeners
Added eventListenersSet flag to track if event delegation has been setup.
Only call setupEventListeners() once during initial render to prevent
adding multiple event listeners that cause 'addIndicator' to be called
multiple times when clicking a button once.

This fixes the bug where one click adds 8 identical indicators.
2026-02-25 22:58:52 +01:00