dixitramjendra commited on
Commit
054183d
·
1 Parent(s): 30b3c37

Fix: Sort history by recency of results (Exit/Entry Time)

Browse files
Files changed (1) hide show
  1. forex_macd_dashboard.html +5 -1
forex_macd_dashboard.html CHANGED
@@ -792,7 +792,11 @@
792
  }
793
  });
794
 
795
- const sortedTrades = Object.values(trades).sort((a, b) => b.last_update - a.last_update);
 
 
 
 
796
 
797
  let html = `
798
  <div class="history-table-container" style="grid-column: 1/-1;">
 
792
  }
793
  });
794
 
795
+ const sortedTrades = Object.values(trades).sort((a, b) => {
796
+ const timeA = a.exit_time ? new Date(a.exit_time).getTime() : new Date(a.entry_time).getTime();
797
+ const timeB = b.exit_time ? new Date(b.exit_time).getTime() : new Date(b.entry_time).getTime();
798
+ return timeB - timeA;
799
+ });
800
 
801
  let html = `
802
  <div class="history-table-container" style="grid-column: 1/-1;">