Commit Graph

83 Commits

Author SHA1 Message Date
dd1cc521e9 fixed syntax error in signals-calculator 2026-03-02 09:05:33 +01:00
a84a1c9091 added RSI crossover signals: BUY when crosses up oversold, SELL when crosses down overbought 2026-03-02 09:03:18 +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
ea49c9b15a fixed timezone: removed duplicate +1h from formatDate (tickMarkFormatter already handles it) 2026-03-01 22:33:54 +01:00
28abdb15a2 fixed: always update timestamp from current data, not stale cache 2026-03-01 22:25:59 +01:00
af79268621 simplified crossover detection: find first candle where price crosses MA 2026-03-01 22:16:12 +01:00
12689ad8f3 fixed: use correct candle timestamp (newer candle) for crossover 2026-03-01 22:06:22 +01:00
34cccce6b4 fixed: use correct crossover timestamp for signal, clear signal state on param change 2026-03-01 21:57:34 +01:00
38557e75d4 fixed: assign drawIndicatorsOnChart to window so it can be called from chart.js 2026-03-01 21:34:26 +01:00
e727f069e1 also call updateIndicatorCandles on new data 2026-03-01 21:28:21 +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
ef43b128d5 removed duplicate scrollToRealTime that may interfere with indicator redraw 2026-03-01 21:18:38 +01:00
780ecfdfb5 improved indicator redraw on new candles with error handling 2026-03-01 21:15:24 +01:00
9c560a5786 fixed time zone to UTC+1 for Warsaw 2026-03-01 20:29:18 +01:00
e52b177102 Fix: Move timeFormatter to localization object
The timeFormatter must be inside localization.timeScale to properly format
time axis labels. This ensures the x-axis time labels display UTC+1 time correctly.
2026-03-01 20:20:30 +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
61aaa2d122 Add indicator recalculation on timeframe change and new candle
Changes:
- Added lastCandleTimestamp to track candle completion
- Detect new candle when timestamp increases
- Clear indicator caches when new candle detected
- Clear indicator caches when timeframe changes
- Recalculate indicators and signals in both cases
- Refresh chart when new candle is detected

This ensures indicators are always recalculated with fresh data when:
1. Timeframe is switched
2. A new candle completes

Both cases now force:
- Cache clearing
- Indicator recalculation
- Chart refresh
- Signal recalculation
2026-03-01 19:58:14 +01:00
11c805917c Fix: Change datetime format in Indicator Analysis panel
- Changed date format to DD/MM/YY HH:mm format
- Removed 'Last: ' prefix from signal display
- Added formatDate() helper function for consistent formatting
2026-03-01 19:53:11 +01:00
3779e7c499 Fix: Remove duplicate code in moving_average.js
The file had duplicate calculate() and getMetadata() methods causing syntax errors.
Removed duplicate code from lines 214-251.
Now the file has a single proper implementation.
2026-03-01 19:46:41 +01:00
71bc034590 Fix: Missing closing brace in MAIndicator.calculate() 2026-03-01 19:45:56 +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
f789f3d4c1 Fix: Restore calculateSummarySignal function 2026-03-01 19:40:20 +01:00
a344a7f0da Refactor: Convert indicators to self-contained files
- Created moving_average.js consolidating ma.js, ma_indicator.js, sma.js, ema.js
- Made all indicators self-contained with embedded:
  * Math logic (no external dependencies)
  * Metadata (getMetadata())
  * Signal calculation (calculateXXXSignal)
  * Base class (inline BaseIndicator)
- Updated macd.js, hts.js to inline EMA/MA calculations
- Added signal functions to RSI, BB, Stochastic, ATR indicators
- Updated indicators/index.js to export both classes and signal functions
- Simplified signals-calculator.js to orchestrate using indicator signal functions
- Removed obsolete files: ma.js, base.js, ma_indicator.js, sma.js, ema.js

All indicators now fully self-contained with no external file dependencies
for math, signal calculation, or base class.
2026-03-01 19:39:28 +01:00
fdab0a3faa Pre-refactor: commit before converting indicators to self-contained files 2026-03-01 19:37:07 +01:00
e457ce3e20 feat: Implement HTS (Higher Timeframe Trend System) strategy
- Add HTS strategy engine with crossover and alignment-based entries
- Implement Auto HTS feature (computes on TF/4 from 1m data)
- Add 1H Red Zone filter to validate long signals
- Add channel-based stop loss with RTL functionality
- Enhanced visualization with 30% opacity channel lines
- Fixed data alignment in simulation (uses htsData instead of mismatched indices)
- Fixed syntax errors in hts-engine.js (malformed template literals)
- Fixed duplicate code in simulation.js
- Added showSimulationMarkers to window object for global access
- Enhanced logging for trade signals and simulation results
- Fix missing prevFastHigh/currFastHigh in hts-visualizer.js
- Disable trend zone overlays to prevent chart clutter
- Implement client-side visualization for trade markers using line series
- MA strategy indicator configuration fixed (was empty during engine run)
- Made entry conditions more permissive for shorter timeframes
- Added comprehensive error handling and console logging
2026-02-27 09:30:43 +01:00
286975b01a Add backup files to gitignore 2026-02-26 23:47:10 +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
cca89397cf Fix button positioning: Keep buttons on left side with 5px spacing
- Remove justify-content: space-between that centered buttons
- Change gap from 4px to 5px for spacing between buttons
- Buttons now appear after text on left side (not centered/center-right)
2026-02-26 21:24:14 +01:00
2dc9eb5461 Fix button overlap: Add spacing and styling for visibility-toggle
- Add gap: 4px to section-title to prevent button overlap
- Style visibility-toggle button with blue color (vs red for Clear All)
- Show/Hide both buttons on hover (previously only Clear All)
- Add hover effects for both buttons
2026-02-26 20:39:50 +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