- Refactored strategy-panel.js to use a modular registry system for trading strategies.
- Introduced PingPongStrategy and moved strategy-specific logic to a new strategies/ directory.
- Enhanced the indicator engine with Multi-Timeframe (MTF) support and robust forward-filling.
- Optimized BaseIndicator and RMA calculations for better performance.
- Updated UI components (chart.js, indicators-panel, signal-markers) to support the new architecture.
- Added markers-plugin.js for improved signal visualization.
- Added accountType='UNIFIED' to wallet balance requests
- Updated balance retrieval to support totalWalletBalance for UTA
- Replaced rich.Live with standard logging for better Docker compatibility
- Added PYTHONUNBUFFERED=1 to ensure real-time logs in containers
- Updated docker-compose to point to NAS database (20.20.20.20)
- Created GEMINI.md with comprehensive project context
- Switch simulation to track BTC quantity instead of USD notional only
- Use current candle price for entry/exit quantity and PnL calculations
- Correctly weight average entry price by BTC quantity
- Update chart markers to display total position in format: ( / BTC size)
- Improve equity chart accuracy by accounting for BTC value fluctuations
- Implement position pyramiding and 15% partial profit-taking
- Add mutual exclusion between entry and exit in the same candle
- Optimize simulation to use cached indicator results
- Revert Hurst Bands signal logic to cross-down (dip entry)
- Add safety filter for chart markers to prevent rendering errors
- Add 'Strategy' tab to sidebar for backtesting simulations
- Create strategy-panel.js for Ping-Pong and Accumulation mode simulations
- Refactor all indicators (MA, HTS, RSI, MACD, BB, STOCH, Hurst) to use strict crossover-based signal calculation
- Update chart.js with setSimulationMarkers and clearSimulationMarkers support
- Implement single-entry rule in Ping-Pong simulation mode
- 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
- 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
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.
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
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
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
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
- Changed date format to DD/MM/YY HH:mm format
- Removed 'Last: ' prefix from signal display
- Added formatDate() helper function for consistent formatting
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.