106 Commits

Author SHA1 Message Date
218f0f5107 refactor: modularize dashboard strategies and enhance indicator engine
- 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.
2026-03-10 11:52:11 +01:00
8b167f8b2c docs: add technical description for Ping-Pong strategy with RSI and Hurst Bands 2026-03-05 21:12:06 +01:00
295bd3085c revert: remove database dependency from ping_pong_bot to fix aiohttp import error 2026-03-05 20:54:23 +01:00
2e901ac95e feat: refactor ping_pong_bot to use database for candles and sync crossover logic with dashboard 2026-03-05 15:09:14 +01:00
da7fbd1b49 feat: fix Bybit Unified Account support and enhance Docker logging for ping_pong_bot
- 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
2026-03-05 11:04:30 +01:00
30aeda0901 docs: add DOCKER_GUIDE.md and fix .env parsing; chore: update docker and script configurations 2026-03-05 08:20:18 +01:00
e41afcf005 feat: implement interactive Best Moving Averages panel based on 1D timeframe 2026-03-04 10:13:39 +01:00
756b1dbd65 feat: standardize date/time format to DD/MM/YYYY 24h and enhance simulation with stop date and auto-data fetching 2026-03-04 09:11:25 +01:00
35ebb0ae87 feat: enable interactive scrolling and time-scale sync for simulation result charts 2026-03-03 23:13:03 +01:00
9883d1bea9 feat: enhance strategy simulation with Inverse Perpetual support, effective leverage caps, and advanced charting 2026-03-03 23:07:03 +01:00
50c525a0bd Refactor strategy simulation to track BTC quantity and enhance chart markers
- 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
2026-03-03 16:05:46 +01:00
633a146e8e Refine strategy simulation with pyramiding, partial exits, and fixed marker logic
- 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
2026-03-03 15:39:59 +01:00
d92af6903d Implement Strategy tab with Ping-Pong backtesting and crossover-based signal logic
- 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
2026-03-03 13:15:29 +01:00
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
cf1aca8855 Add Hurst Bands indicator with buy/sell signal markers 2026-03-03 08:36:26 +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
d332748411 fixed params handling in analysis panel 2026-03-02 10:46:03 +01:00
b888c03e8e show only period param in analysis panel 2026-03-02 10:45:00 +01:00
7191cd293f fixed params display in analysis panel 2026-03-02 10:39:50 +01:00
c2f92cc5fb show indicator params like MA(44) in active list and analysis panel 2026-03-02 10:36:03 +01:00
ece1e8b56a added indicator params to analysis panel 2026-03-02 10:31:16 +01:00
cf190cf918 fixed: crosshair time now uses timezone config 2026-03-02 09:15:04 +01:00
3ffec846dc added RSI crossover detection in historical crossovers for timestamp 2026-03-02 09:09:20 +01:00
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