Spaces:
Sleeping
Sleeping
File size: 156,661 Bytes
7f4b04c ba25022 f050c22 7f4b04c 5af4906 7f4b04c 5af4906 186cbc5 5af4906 7f4b04c ba25022 7f4b04c 07acef3 ba25022 7f4b04c ba25022 7f4b04c ba25022 7f4b04c ba25022 7f4b04c ba25022 7f4b04c ba25022 7f4b04c ba25022 7f4b04c ba25022 7f4b04c ba25022 7f4b04c ba25022 7f4b04c ba25022 7f4b04c ba25022 23d698f 7f4b04c ba25022 7f4b04c 23d698f 7f4b04c 607d7e5 7f4b04c b22d896 7f4b04c 144cd95 d4ca3f5 cc7f521 d4ca3f5 7f4b04c c7e0928 ba25022 c7e0928 ba25022 c7e0928 9cd2583 e77f782 51c75da 1c8d789 51c75da f050c22 5f6bb64 e77f782 5f6bb64 e77f782 5f6bb64 e77f782 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc e77f782 8b597cc 5f6bb64 e77f782 8b597cc 5f6bb64 8b597cc 5f6bb64 e77f782 5f6bb64 8b597cc 5f6bb64 e77f782 5f6bb64 e77f782 8b597cc e77f782 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 e77f782 8b597cc 5f6bb64 e77f782 8b597cc 5f6bb64 8b597cc e77f782 8b597cc 5f6bb64 8b597cc e77f782 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 5f6bb64 8b597cc 1c8d789 8b597cc 1c8d789 8b597cc 1c8d789 8b597cc e77f782 ff9e210 ba25022 ff9e210 ba25022 ff9e210 5ab71e4 186cbc5 5ab71e4 7f4b04c 186cbc5 07acef3 7f4b04c 07acef3 ba25022 07acef3 ba25022 f050c22 6e44540 9cd2583 08740d2 9cd2583 5af4906 1c8d789 01d413c f050c22 7f4b04c 07acef3 fc0bf1f 5af4906 fc0bf1f 51c75da 07acef3 5f6bb64 07acef3 30e2a89 07acef3 51c75da 7e2e62b d826280 51c75da 7e2e62b 51c75da d826280 51c75da 7e2e62b 51c75da 7e2e62b 51c75da 7e2e62b 51c75da 7e2e62b 51c75da 7e2e62b 51c75da 5af4906 07acef3 5f6bb64 07acef3 7f4b04c 07acef3 08740d2 7f4b04c 5af4906 4d15797 01d413c 4d15797 01d413c 1c8d789 08740d2 2b58c4b 08740d2 7f4b04c 08740d2 7f4b04c 6310df1 7f4b04c f0e4e80 7f4b04c cc7f521 cad8fe0 186cbc5 5af4906 144cd95 a6d5c77 c7e0928 2cf80b2 1f5b913 0048da7 1f5b913 a6d5c77 1f5b913 a6d5c77 1f5b913 c7e0928 08740d2 7f4b04c fb69074 bcf9821 1f5b913 2b58c4b 1c8d789 2b58c4b 08740d2 bcf9821 2b58c4b 08740d2 2b58c4b 08740d2 5502ec7 08740d2 2b58c4b 9cd2583 bcf9821 7f4b04c 2b58c4b 7f4b04c c7e0928 a7eeef4 a6d5c77 e77f782 5b43a94 ba25022 ad7b538 2a99be2 b22d896 a7eeef4 c7e0928 51c75da e77f782 1f5b913 51c75da 5af4906 51c75da 5af4906 51c75da 5af4906 ff9e210 1f5b913 51c75da 5af4906 e77f782 1f5b913 51c75da 5af4906 51c75da e77f782 c7e0928 bcf9821 08740d2 9b9b68f 186cbc5 08740d2 4d5d843 a6d5c77 ce66634 aeac648 71af200 b22d896 08740d2 4d5d843 c7e0928 aeac648 08740d2 30b3c37 08740d2 7f4b04c 08740d2 8ea05dc 08740d2 8ea05dc 08740d2 8b71d20 08740d2 144cd95 08740d2 144cd95 08740d2 144cd95 08740d2 f050c22 08740d2 7f4b04c 08740d2 7f4b04c 08740d2 d4ca3f5 08740d2 7f4b04c 08740d2 7f4b04c 08740d2 cc7f521 b22d896 08740d2 b22d896 08740d2 b22d896 08740d2 b22d896 08740d2 cad8fe0 7f4b04c 08740d2 d4ca3f5 08740d2 cc7f521 08740d2 2b58c4b 08740d2 7f4b04c 8b597cc 1f5b913 e77f782 08740d2 e77f782 fb69074 e77f782 1f5b913 e77f782 08740d2 30b3c37 08740d2 054183d 08740d2 2cf80b2 5f6bb64 08740d2 2cf80b2 5f6bb64 08740d2 5f6bb64 08740d2 b97b936 08740d2 5f6bb64 08740d2 5f6bb64 08740d2 5f6bb64 08740d2 ff9e210 08740d2 e77f782 08740d2 e77f782 bcf9821 1f5b913 ff9e210 1f5b913 ff9e210 1f5b913 ff9e210 1f5b913 ff9e210 bcf9821 08740d2 1f5b913 08740d2 9cd2583 5f6bb64 9cd2583 5f6bb64 9cd2583 5f6bb64 9cd2583 5f6bb64 9cd2583 5f6bb64 9cd2583 5f6bb64 9cd2583 5f6bb64 9cd2583 f050c22 7f4b04c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<!-- Favicon and Mobile Icons -->
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/png" sizes="192x192" href="biasbuster_icon_192.png">
<link rel="apple-touch-icon" sizes="192x192" href="biasbuster_icon_192.png">
<link rel="icon" type="image/png" sizes="512x512" href="biasbuster_icon_512.png">
<!-- PWA Manifest -->
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#0f172a">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="BiasBuster">
<title>BiasBuster Market Dashboard</title>
<style>
:root {
--bg-color: #0f172a;
--card-bg: #1e293b;
--text-primary: #f8fafc;
--text-secondary: #94a3b8;
--bullish: #10b981;
--bearish: #ef4444;
--neutral: #64748b;
--accent: #3b82f6;
--border-color: #334155;
}
/* Light Theme */
:root.light-theme {
--bg-color: #f8fafc;
--card-bg: #ffffff;
--text-primary: #1e293b;
--text-secondary: #64748b;
--bullish: #059669;
--bearish: #dc2626;
--neutral: #6b7280;
--accent: #2563eb;
--border-color: #e2e8f0;
}
/* ========== PRICE TICKER STYLES ========== */
.ticker-container {
width: 100%;
background: linear-gradient(90deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
border-bottom: 1px solid var(--border-color);
overflow: hidden;
position: relative;
}
:root.light-theme .ticker-container {
background: linear-gradient(90deg, rgba(248, 250, 252, 0.98) 0%, rgba(241, 245, 249, 0.98) 100%);
}
.ticker-wrapper {
display: flex;
animation: ticker-scroll 60s linear infinite;
}
.ticker-wrapper:hover {
animation-play-state: paused;
}
@keyframes ticker-scroll {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-50%);
}
}
.ticker-item {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1.5rem;
white-space: nowrap;
border-right: 1px solid var(--border-color);
font-size: 0.85rem;
}
.ticker-flag {
font-size: 1rem;
}
.ticker-name {
color: var(--text-primary);
font-weight: 600;
}
.ticker-price {
color: var(--accent);
font-family: 'Courier New', monospace;
font-weight: 700;
}
.ticker-change {
padding: 0.15rem 0.4rem;
border-radius: 0.25rem;
font-size: 0.75rem;
font-weight: 600;
}
.ticker-up {
background: rgba(16, 185, 129, 0.2);
color: var(--bullish);
}
.ticker-down {
background: rgba(239, 68, 68, 0.2);
color: var(--bearish);
}
.ticker-signal {
padding: 0.15rem 0.4rem;
border-radius: 0.25rem;
font-size: 0.7rem;
font-weight: 700;
text-transform: uppercase;
}
.ticker-buy {
background: rgba(16, 185, 129, 0.3);
color: #10b981;
}
.ticker-sell {
background: rgba(239, 68, 68, 0.3);
color: #ef4444;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', system-ui, sans-serif;
}
body {
background-color: var(--bg-color);
color: var(--text-primary);
padding: 1rem;
min-height: 100vh;
}
/* ========== ACCESSIBILITY STYLES ========== */
/* Visually hidden but accessible to screen readers */
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
/* Skip to main content link for keyboard users */
.skip-link {
position: absolute;
top: -40px;
left: 0;
background: var(--accent);
color: white;
padding: 12px 24px;
text-decoration: none;
z-index: 100;
border-radius: 0 0 8px 0;
font-weight: 600;
transition: top 0.3s;
}
.skip-link:focus {
top: 0;
outline: 3px solid #fbbf24;
outline-offset: 2px;
}
/* Enhanced focus indicators for all interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
outline: 3px solid #3b82f6;
outline-offset: 2px;
}
/* Remove default outline for mouse users */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
outline: none;
}
/* Mobile Responsive Adjustments */
@media (min-width: 768px) {
body {
padding: 2rem;
}
}
.container {
max-width: 1600px;
margin: 0 auto;
}
header {
text-align: center;
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid #334155;
}
.logo-container {
display: flex;
align-items: center;
justify-content: center;
gap: 1rem;
margin-bottom: 1rem;
flex-wrap: wrap;
}
.logo-img {
width: 80px;
height: 80px;
object-fit: contain;
border-radius: 0.75rem;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
@media (min-width: 768px) {
header {
margin-bottom: 3rem;
}
.logo-img {
width: 100px;
height: 100px;
}
}
h1 {
font-size: 1.75rem;
margin-bottom: 0.5rem;
background: linear-gradient(to right, #60a5fa, #a78bfa);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
}
@media (min-width: 768px) {
h1 {
font-size: 2.5rem;
}
}
.subtitle {
color: var(--text-secondary);
font-size: 0.9rem;
}
@media (min-width: 768px) {
.subtitle {
font-size: 1.1rem;
}
}
.grid {
display: grid;
grid-template-columns: 1fr;
gap: 1.5rem;
}
@media (min-width: 640px) {
.grid {
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
}
@media (min-width: 1024px) {
.grid {
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
gap: 2rem;
}
}
.card {
background-color: var(--card-bg);
border-radius: 1rem;
padding: 1.25rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
border: 1px solid #334155;
}
@media (min-width: 768px) {
.card {
padding: 2rem;
}
}
.card-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 1.5rem;
}
.instrument-name {
font-size: 1.4rem;
font-weight: 700;
}
@media (min-width: 768px) {
.instrument-name {
font-size: 1.8rem;
}
}
.current-price {
font-size: 1.1rem;
color: var(--accent);
margin-top: 0.25rem;
font-weight: 600;
}
.status-badge {
padding: 0.5rem 1rem;
border-radius: 9999px;
font-weight: 600;
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.status-waiting {
background: rgba(100, 116, 139, 0.2);
color: var(--neutral);
border: 1px solid var(--neutral);
}
.status-buy {
background: rgba(16, 185, 129, 0.2);
color: var(--bullish);
border: 1px solid var(--bullish);
}
.status-sell {
background: rgba(239, 68, 68, 0.2);
color: var(--bearish);
border: 1px solid var(--bearish);
}
.analysis-grid {
display: grid;
grid-template-columns: 1fr;
gap: 0.5rem;
margin-bottom: 2rem;
}
@media (min-width: 480px) {
.analysis-grid {
grid-template-columns: repeat(3, 1fr);
}
}
.tf-box {
background: rgba(15, 23, 42, 0.5);
padding: 0.75rem 0.5rem;
border-radius: 0.5rem;
text-align: center;
border-top: 3px solid transparent;
}
.tf-label {
color: var(--text-secondary);
font-size: 0.85rem;
margin-bottom: 0.5rem;
text-transform: uppercase;
}
.tf-value {
font-weight: 700;
font-size: 0.9rem;
word-wrap: break-word;
line-height: 1.2;
}
.tf-detail {
font-size: 0.8rem;
color: var(--text-secondary);
margin-top: 0.25rem;
}
.signal-panel {
background: rgba(15, 23, 42, 0.8);
border-radius: 0.75rem;
padding: 1.5rem;
margin-top: 1rem;
border-left: 4px solid transparent;
}
.signal-panel.buy {
border-left-color: var(--bullish);
}
.signal-panel.sell {
border-left-color: var(--bearish);
}
.signal-row {
display: flex;
justify-content: space-between;
margin-bottom: 0.5rem;
font-size: 0.95rem;
}
.signal-row:last-child {
margin-bottom: 0;
}
.signal-label {
color: var(--text-secondary);
}
.signal-val {
font-weight: 600;
font-family: 'Courier New', monospace;
}
.bullish {
color: var(--bullish);
}
.bearish {
color: var(--bearish);
}
.neutral {
color: var(--neutral);
}
.border-bullish {
border-top-color: var(--bullish);
}
.border-bearish {
border-top-color: var(--bearish);
}
.border-neutral {
border-top-color: var(--neutral);
}
/* Lifecycle Status Badges */
.lifecycle-badge {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
font-size: 0.85rem;
font-weight: 700;
margin-top: 0.5rem;
letter-spacing: 0.3px;
}
.lifecycle-new {
background: rgba(16, 185, 129, 0.2);
color: #10b981;
border: 1px solid #10b981;
}
.lifecycle-reentry {
background: rgba(139, 92, 246, 0.2);
color: #8b5cf6;
border: 1px solid #8b5cf6;
}
.lifecycle-partial-tp {
background: rgba(251, 191, 36, 0.2);
color: #fbbf24;
border: 1px solid #fbbf24;
}
.lifecycle-trailing {
background: rgba(59, 130, 246, 0.2);
color: #3b82f6;
border: 1px solid #3b82f6;
}
.lifecycle-active {
background: rgba(156, 163, 175, 0.2);
color: #9ca3af;
border: 1px solid #9ca3af;
}
/* Reentry Opportunity Styling */
.reentry-panel {
background: rgba(59, 130, 246, 0.08);
border: 2px dashed rgba(59, 130, 246, 0.4);
border-radius: 0.75rem;
padding: 1.25rem;
margin-top: 1rem;
transition: all 0.3s ease;
}
.reentry-panel:hover {
background: rgba(59, 130, 246, 0.12);
border-color: rgba(59, 130, 246, 0.6);
}
.reentry-header {
display: flex;
justify-content: space-between;
align-items: center;
font-weight: 700;
color: var(--accent);
margin-bottom: 1rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid rgba(59, 130, 246, 0.3);
font-size: 0.95rem;
}
.strength-badge {
padding: 0.35rem 0.85rem;
border-radius: 1.25rem;
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 0.5px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.strength-high {
background: linear-gradient(135deg, var(--bullish) 0%, #059669 100%);
color: white;
}
.strength-medium {
background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
color: white;
}
.strength-low {
background: linear-gradient(135deg, #64748b 0%, #475569 100%);
color: white;
}
.reentry-details {
display: flex;
flex-direction: column;
gap: 0.65rem;
}
.reentry-row {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.9rem;
padding: 0.4rem 0;
}
.reentry-row span:first-child {
color: var(--text-secondary);
font-weight: 500;
}
.reentry-row span:last-child {
font-weight: 600;
font-family: 'Courier New', monospace;
}
.reentry-reason {
margin-top: 0.75rem;
padding-top: 0.75rem;
border-top: 1px dashed rgba(59, 130, 246, 0.3);
font-size: 0.85rem;
color: var(--text-secondary);
font-style: italic;
line-height: 1.5;
}
.reentry-confirmation {
margin-top: 0.5rem;
padding: 0.6rem;
background: rgba(15, 23, 42, 0.5);
border-radius: 0.5rem;
font-size: 0.8rem;
color: var(--text-secondary);
font-family: 'Courier New', monospace;
}
/* Sparkline Mini Charts */
.sparkline-container {
width: 100%;
height: 40px;
margin: 0.75rem 0;
background: rgba(15, 23, 42, 0.3);
border-radius: 0.5rem;
padding: 0.25rem;
border: 1px solid var(--border-color);
}
.sparkline-canvas {
width: 100%;
height: 100%;
}
.last-updated {
text-align: center;
margin-top: 3rem;
color: var(--text-secondary);
font-size: 0.9rem;
}
/* Tabs Styling */
.tabs-container {
display: flex;
justify-content: center;
gap: 1rem;
margin-bottom: 2.5rem;
flex-wrap: wrap;
}
.tab-btn {
background: var(--card-bg);
color: var(--text-secondary);
border: 1px solid #334155;
padding: 0.5rem 1rem;
border-radius: 0.75rem;
cursor: pointer;
font-weight: 600;
transition: all 0.2s ease;
font-size: 0.85rem;
}
@media (min-width: 768px) {
.tab-btn {
padding: 0.75rem 1.5rem;
font-size: 1rem;
}
}
.tab-btn:hover {
border-color: var(--accent);
color: var(--text-primary);
}
.tab-btn.active {
background: var(--accent);
color: white;
border-color: var(--accent);
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.instrument-card-container {
display: block;
}
.instrument-card-container.hidden {
display: none;
}
/* Feedback Form Styling */
.feedback-section {
margin-top: 4rem;
padding: 2rem;
background: var(--card-bg);
border-radius: 1rem;
border: 1px solid #334155;
max-width: 800px;
margin-left: auto;
margin-right: auto;
}
.feedback-section h2 {
margin-bottom: 1rem;
color: var(--accent);
}
.feedback-form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.feedback-form textarea {
background: var(--bg-color);
border: 1px solid #334155;
color: var(--text-primary);
padding: 1rem;
border-radius: 0.5rem;
resize: vertical;
min-height: 100px;
}
.feedback-form button {
background: var(--accent);
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 0.5rem;
cursor: pointer;
font-weight: 600;
transition: background 0.2s;
}
.feedback-form button:hover {
background: #2563eb;
}
#feedbackStatus {
margin-top: 1rem;
font-size: 0.9rem;
text-align: center;
}
/* Help Section Styles */
.help-section {
padding: 2rem 1rem;
}
.help-card {
background: var(--card-bg);
border-radius: 1rem;
border: 1px solid var(--border-color);
padding: 2rem;
margin-bottom: 2rem;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.help-card h2 {
color: var(--accent);
margin-bottom: 1rem;
font-size: 1.5rem;
}
.help-card h3 {
color: var(--text-primary);
margin-top: 1.5rem;
margin-bottom: 0.75rem;
font-size: 1.2rem;
}
.help-card h4 {
color: var(--accent);
margin-bottom: 0.5rem;
}
.help-card p {
color: var(--text-secondary);
line-height: 1.6;
margin-bottom: 0.75rem;
}
.help-card ul,
.help-card ol {
color: var(--text-secondary);
line-height: 1.8;
margin-left: 1.5rem;
margin-bottom: 1rem;
}
.help-card li {
margin-bottom: 0.5rem;
}
.faq-item {
border-left: 3px solid var(--accent);
padding-left: 1rem;
margin-bottom: 1.5rem;
}
.faq-item h3 {
color: var(--text-primary);
font-size: 1.1rem;
margin-top: 0;
margin-bottom: 0.5rem;
}
.faq-item p {
color: var(--text-secondary);
margin: 0;
}
/* History Table Styling - Enhanced Professional Design */
.history-table-container {
width: 100%;
overflow-x: auto;
background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
border-radius: 1rem;
border: 1px solid #475569;
padding: 1.5rem;
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}
/* Signal History - Professional Table Styling */
.history-container {
background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
border-radius: 1rem;
padding: 2rem;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
margin: 1rem 0;
border: 1px solid #475569;
}
.history-table-wrapper {
overflow-x: auto;
border-radius: 0.75rem;
border: 2px solid #475569;
max-height: 600px;
overflow-y: auto;
background: rgba(15, 23, 42, 0.5);
}
.history-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
min-width: 1400px;
}
.history-table thead {
position: sticky;
top: 0;
background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
z-index: 10;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.history-table th {
padding: 1.25rem 1rem;
text-align: left;
font-weight: 700;
color: #60a5fa;
border-bottom: 3px solid #3b82f6;
font-size: 0.9rem;
text-transform: uppercase;
letter-spacing: 1px;
background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
}
.history-table th.numeric {
text-align: right;
}
.history-table tbody tr {
background: rgba(30, 41, 59, 0.6);
transition: all 0.3s ease;
border-bottom: 1px solid #334155;
}
.history-table tbody tr:nth-child(even) {
background: rgba(51, 65, 85, 0.3);
}
.history-table tbody tr:hover {
background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
transform: translateX(4px);
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
border-left: 4px solid #3b82f6;
}
.history-table td {
padding: 1rem;
border-bottom: 1px solid #334155;
font-size: 0.9rem;
color: var(--text-primary);
}
.history-table td.numeric {
text-align: right;
font-family: 'Courier New', monospace;
font-weight: 600;
}
/* Result Badges - Enhanced Professional */
.result-badge {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 0.5px;
white-space: nowrap;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.badge-entry {
background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(37, 99, 235, 0.3) 100%);
color: #60a5fa;
border: 1px solid #3b82f6;
}
.badge-tp {
background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(5, 150, 105, 0.3) 100%);
color: #34d399;
border: 1px solid #10b981;
}
.badge-sl {
background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(220, 38, 38, 0.3) 100%);
color: #f87171;
border: 1px solid #ef4444;
}
.badge-trail {
background: linear-gradient(135deg, rgba(251, 146, 60, 0.3) 0%, rgba(249, 115, 22, 0.3) 100%);
color: #fb923c;
border: 1px solid #f97316;
}
/* P/L Styling - Enhanced */
.pnl-positive {
color: #10b981;
font-weight: 700;
text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}
.pnl-negative {
color: #ef4444;
font-weight: 700;
text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}
.pnl-neutral {
color: var(--text-secondary);
}
/* Type Badge Styling */
.type-buy {
color: #10b981;
font-weight: 700;
text-transform: uppercase;
}
.type-sell {
color: #ef4444;
font-weight: 700;
text-transform: uppercase;
}
/* Instrument Name Styling */
.instrument-name-cell {
font-weight: 700;
color: #60a5fa;
font-size: 0.95rem;
}
/* Performance Summary Bar */
.perf-summary {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 1rem;
margin-bottom: 1.5rem;
}
.perf-card {
background: var(--card-bg);
padding: 1.25rem;
border-radius: 0.75rem;
border: 1px solid var(--border-color);
transition: all 0.2s;
}
.perf-card:hover {
border-color: var(--accent);
transform: translateY(-2px);
}
.perf-label {
font-size: 0.75rem;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 0.5rem;
}
.perf-value {
font-size: 1.75rem;
font-weight: 700;
font-family: 'Courier New', monospace;
color: var(--text-primary);
}
/* Filters Bar */
.filters-bar {
display: flex;
gap: 0.75rem;
margin-bottom: 1.5rem;
flex-wrap: wrap;
align-items: center;
}
.filter-input,
.filter-select {
background: var(--card-bg);
border: 1px solid #334155;
color: var(--text-primary);
padding: 0.625rem 0.875rem;
border-radius: 0.5rem;
font-size: 0.875rem;
transition: all 0.2s;
}
.filter-input:focus,
.filter-select:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.filter-input::placeholder {
color: var(--text-secondary);
}
.export-btn {
background: var(--accent);
color: white;
border: none;
padding: 0.625rem 1.25rem;
border-radius: 0.5rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
font-size: 0.875rem;
}
.export-btn:hover {
background: #2563eb;
transform: translateY(-1px);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}
/* Expandable Row Details */
.expanded-details {
background: rgba(59, 130, 246, 0.05);
padding: 1.5rem;
border-left: 3px solid var(--accent);
margin: 0.5rem 0;
}
.detail-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
}
.detail-item {
padding: 0.75rem;
background: rgba(255, 255, 255, 0.02);
border-radius: 0.5rem;
}
.detail-label {
font-size: 0.75rem;
color: var(--text-secondary);
margin-bottom: 0.25rem;
}
.detail-value {
font-weight: 600;
color: var(--text-primary);
}
/* Loading Skeleton */
.skeleton {
background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
background-size: 200% 100%;
animation: loading 1.5s ease-in-out infinite;
}
@keyframes loading {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
/* Past Trades Styling */
.past-trades-controls {
display: flex;
justify-content: center;
gap: 1rem;
margin-bottom: 2rem;
align-items: center;
}
.date-select {
background: var(--card-bg);
color: var(--text-primary);
border: 1px solid #334155;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
cursor: pointer;
}
.screenshot-grid {
display: grid;
grid-template-columns: 1fr;
gap: 1.5rem;
}
@media (min-width: 640px) {
.screenshot-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (min-width: 1024px) {
.screenshot-grid {
grid-template-columns: repeat(3, 1fr);
}
}
.screenshot-card {
background: var(--card-bg);
border-radius: 1rem;
overflow: hidden;
border: 1px solid #334155;
transition: transform 0.2s;
}
.screenshot-card:hover {
transform: scale(1.02);
}
.screenshot-card img {
width: 100%;
height: auto;
display: block;
}
.screenshot-info {
padding: 1rem;
border-top: 1px solid #334155;
}
.screenshot-name {
font-weight: 600;
font-size: 0.9rem;
color: var(--text-primary);
}
/* ========== MOBILE RESPONSIVE FIXES ========== */
@media (max-width: 768px) {
/* Mobile Ticker Optimization */
.ticker-container {
border-bottom-width: 1px;
}
.ticker-item {
padding: 0.4rem 1rem;
font-size: 0.75rem;
gap: 0.35rem;
}
.ticker-flag {
font-size: 0.85rem;
}
.ticker-name {
max-width: 80px;
overflow: hidden;
text-overflow: ellipsis;
}
.ticker-price {
font-size: 0.75rem;
}
.ticker-wrapper {
animation-duration: 40s !important;
/* Faster on mobile */
}
/* Fix feedback form grid overflow on mobile */
.feedback-section {
padding: 1rem;
margin-top: 2rem;
}
.feedback-form>div[style*="grid-template-columns"] {
display: flex !important;
flex-direction: column !important;
gap: 1rem !important;
}
.feedback-form input,
.feedback-form select,
.feedback-form textarea {
width: 100% !important;
box-sizing: border-box;
}
/* Fix history table overflow on mobile */
.history-table {
min-width: 100% !important;
font-size: 0.85rem;
}
.history-table th,
.history-table td {
padding: 0.5rem !important;
white-space: nowrap;
}
/* Make table scrollable horizontally on mobile */
.history-table-container {
padding: 0.75rem;
-webkit-overflow-scrolling: touch;
}
.history-table-wrapper {
max-height: 400px;
}
/* Adjust tab buttons for mobile */
.tabs-container {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
gap: 0.5rem;
}
.tab-btn {
font-size: 0.85rem;
padding: 0.5rem 0.75rem;
white-space: nowrap;
}
}
@media (max-width: 480px) {
/* Extra small screens */
.feedback-section {
padding: 0.75rem;
}
.history-table {
font-size: 0.75rem;
}
.history-table th,
.history-table td {
padding: 0.4rem !important;
}
.tab-btn {
font-size: 0.75rem;
padding: 0.4rem 0.6rem;
}
/* Reduce card padding on very small screens */
.card {
padding: 1rem;
}
h1 {
font-size: 1.5rem;
}
h2 {
font-size: 1.25rem;
}
}
</style>
</head>
<body>
<!-- Price Ticker -->
<div class="ticker-container" id="tickerContainer">
<div class="ticker-wrapper" id="tickerWrapper">
<div class="ticker-item">Loading prices...</div>
</div>
</div>
<!-- Skip to main content link for keyboard users -->
<a href="#main-content" class="skip-link">Skip to main content</a>
<div class="container">
<header role="banner">
<div class="logo-container">
<img src="biasbuster_logo.jpg" alt="BiasBuster Market Dashboard - MACD Multi-Timeframe Trading Strategy"
class="logo-img">
</div>
<h1>💱 BiasBuster Market Dashboard</h1>
<div class="subtitle">Multi-Timeframe Analysis: Trend • Momentum • Entry (Varies by Category)</div>
<div id="visitorCounter"
style="margin-top: 0.5rem; font-size: 0.9rem; color: var(--accent); font-weight: 600;">
👥 Visitors: <span id="activeCount">...</span> Active • <span id="visitorCount">...</span> Total
</div>
<!-- Theme Toggle Button -->
<button id="themeToggle" onclick="toggleTheme()"
style="margin-top: 0.75rem; padding: 0.5rem 1rem; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 0.5rem; color: var(--text-primary); cursor: pointer; font-size: 1rem; transition: all 0.3s ease;"
aria-label="Toggle dark/light mode">
<span id="themeIcon">🌙</span> <span id="themeText">Dark</span>
</button>
<!-- Sound Alert Toggle Button -->
<button id="soundToggle" onclick="toggleSoundAlerts()"
style="margin-top: 0.75rem; margin-left: 0.5rem; padding: 0.5rem 1rem; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 0.5rem; color: var(--text-primary); cursor: pointer; font-size: 1rem; transition: all 0.3s ease;"
aria-label="Toggle sound alerts">
<span id="soundIcon">🔔</span> <span id="soundText">Alerts On</span>
</button>
<!-- PWA Install Count Badge -->
<span id="pwaInstallBadge"
style="display: none; margin-top: 0.75rem; margin-left: 0.5rem; padding: 0.4rem 0.8rem; background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%); border-radius: 1rem; color: white; font-size: 0.85rem; font-weight: 600; align-items: center; gap: 0.3rem;">
📲 <span id="pwaInstallCount">0</span> installs
</span>
</header>
<main id="main-content" role="main">
<nav class="tabs-container" id="tabs" role="navigation" aria-label="Category filters">
<button class="tab-btn active" onclick="filterCategory('LiveSignal')" aria-label="Show live signals"
aria-pressed="true">🔴 Live Signal</button>
<button class="tab-btn" onclick="filterCategory('NSE Live')" aria-label="Show NSE live signals"
aria-pressed="false">🇮🇳 NSE Live</button>
<button class="tab-btn" onclick="filterCategory('World Index')" aria-label="Show world index signals"
aria-pressed="false">🌎 World Index</button>
<button class="tab-btn" onclick="filterCategory('Indian Indices & Commodities')"
aria-label="Show commodities signals" aria-pressed="false">🏭 Commodities
Live</button>
<button class="tab-btn" onclick="filterCategory('Crypto Scalping')" aria-label="Show crypto signals"
aria-pressed="false">💰 Crypto Live</button>
<button class="tab-btn" onclick="filterCategory('Indian Stocks')"
aria-label="Show Indian stocks signals" aria-pressed="false">Indian Stocks</button>
<button class="tab-btn" onclick="filterCategory('Forex')" aria-label="Show forex pairs signals"
aria-pressed="false">Forex Pairs</button>
<button class="tab-btn" onclick="filterCategory('Metals/Energy')"
aria-label="Show metals and energy signals" aria-pressed="false">Metals & Energy</button>
<button class="tab-btn" onclick="filterCategory('History')" aria-label="Show signal history"
aria-pressed="false">Signal History</button>
<!-- Performance tab temporarily disabled
<button class="tab-btn" onclick="filterCategory('Stats')" aria-label="Show performance statistics"
aria-pressed="false">📊 Performance</button>
-->
<button class="tab-btn" onclick="filterCategory('Help')" aria-label="Show help and instructions"
aria-pressed="false">📚 Help & FAQ</button>
</nav>
<div id="dashboard" class="grid">
<div style="grid-column: 1/-1; text-align: center; padding: 4rem;">
Loading analysis data...
</div>
</div>
<div class="last-updated" id="lastUpdated"></div>
<span id="backendStatus" style="color: var(--text-secondary); font-size: 0.8rem;">Backend:
Checking...</span>
<!-- Help & FAQ Section -->
<section id="helpSection" class="help-section" style="display: none;">
<div style="max-width: 1200px; margin: 0 auto;">
<h1
style="text-align: center; margin-bottom: 2rem; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">
📚 Help & Trading Guide
</h1>
<!-- Quick Start -->
<div class="help-card">
<h2>🚀 Quick Start Guide</h2>
<p>Welcome to BiasBuster Forex Trading Dashboard! This system analyzes 100 instruments across
multiple markets using a sophisticated multi-timeframe strategy.</p>
<h3>How It Works:</h3>
<ol>
<li><strong>Multi-Timeframe Analysis</strong>: Combines 1D (Trend), 4H (Momentum), and 1H
(Entry) timeframes</li>
<li><strong>Signal Generation</strong>: Only generates signals when all timeframes align
</li>
<li><strong>Risk Management</strong>: Automatic SL, TP1, TP2, TP3, and trailing stop loss
</li>
<li><strong>Alerts</strong>: Telegram and email notifications for all events</li>
</ol>
</div>
<!-- Understanding Signals -->
<div class="help-card">
<h2>📊 Understanding Trading Signals</h2>
<h3>Signal Card Components:</h3>
<div
style="background: rgba(255,255,255,0.05); padding: 1.5rem; border-radius: 0.5rem; margin: 1rem 0;">
<p><strong>🔴 BUY Signal</strong> or <strong>🟢 SELL Signal</strong></p>
<ul>
<li><strong>Entry Price</strong>: Recommended entry point</li>
<li><strong>Stop Loss (SL)</strong>: Maximum loss level (1.5x ATR for Forex, 2.5x for
NSE)</li>
<li><strong>Take Profit 1 (TP1)</strong>: 1.5R - First profit target (50% exit)</li>
<li><strong>Take Profit 2 (TP2)</strong>: 3R - Second profit target (30% exit)</li>
<li><strong>Take Profit 3 (TP3)</strong>: 5R - Final profit target (20% exit)</li>
<li><strong>Current SL</strong>: Trailing stop loss (moves with price)</li>
</ul>
</div>
<h3>Timeframe Analysis:</h3>
<ul>
<li><strong>1D Trend</strong>: Overall market direction (BULLISH/BEARISH/NEUTRAL)</li>
<li><strong>4H Momentum</strong>: Medium-term momentum confirmation</li>
<li><strong>1H Entry</strong>: Precise entry timing</li>
</ul>
<h3>Signal Status:</h3>
<ul>
<li><strong>New Signal</strong>: Just generated (< 1 hour old)</li>
<li><strong>Active</strong>: Trade is running</li>
<li><strong>Partial TP Hit</strong>: TP1 or TP2 reached</li>
<li><strong>Trailing SL Active</strong>: Stop loss moved to protect profits</li>
<li><strong>Reentry Opportunity</strong>: Price pulled back for second entry</li>
</ul>
</div>
<!-- Risk Management -->
<div class="help-card">
<h2>⚠️ Risk Management Guide</h2>
<h3>Position Sizing:</h3>
<div
style="background: #1e293b; padding: 1rem; border-left: 4px solid #ef4444; margin: 1rem 0;">
<p><strong>Recommended:</strong> Risk only 1-2% of your account per trade</p>
<p><strong>Formula:</strong> Position Size = (Account × Risk%) ÷ (Entry - SL)</p>
<p><strong>Example:</strong> $10,000 account, 1% risk = $100 risk per trade</p>
</div>
<h3>Trailing Stop Loss:</h3>
<ul>
<li><strong>At TP1</strong>: SL moves to breakeven (entry price)</li>
<li><strong>At TP2</strong>: SL moves to TP1 level</li>
<li><strong>Benefit</strong>: Locks in profits, reduces risk to zero</li>
</ul>
<h3>Exit Strategy:</h3>
<ul>
<li><strong>TP1 (1.5R)</strong>: Exit 50% of position</li>
<li><strong>TP2 (3R)</strong>: Exit 30% of position</li>
<li><strong>TP3 (5R)</strong>: Exit remaining 20%</li>
<li><strong>SL Hit</strong>: Exit entire position</li>
</ul>
<h3>Risk Warnings:</h3>
<div style="background: #7f1d1d; padding: 1rem; border-radius: 0.5rem; margin: 1rem 0;">
<p>⚠️ <strong>Never risk more than you can afford to lose</strong></p>
<p>⚠️ <strong>Don't over-leverage</strong> - Max 5 concurrent positions recommended</p>
<p>⚠️ <strong>Set daily loss limits</strong> - Stop trading if you lose 5% in a day</p>
<p>⚠️ <strong>Trading involves risk</strong> - Past performance doesn't guarantee future
results</p>
</div>
</div>
<!-- Market Coverage -->
<div class="help-card">
<h2>🌍 Market Coverage</h2>
<div
style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin: 1rem 0;">
<div style="background: rgba(255,255,255,0.05); padding: 1rem; border-radius: 0.5rem;">
<h4>💱 Forex (18 pairs)</h4>
<p>Major pairs, crosses, and exotics</p>
<p><small>24/5 trading</small></p>
</div>
<div style="background: rgba(255,255,255,0.05); padding: 1rem; border-radius: 0.5rem;">
<h4>🇮🇳 Indian Stocks (50)</h4>
<p>All Nifty 50 constituents</p>
<p><small>9:15 AM - 3:30 PM IST</small></p>
</div>
<div style="background: rgba(255,255,255,0.05); padding: 1rem; border-radius: 0.5rem;">
<h4>💰 Crypto (10)</h4>
<p>Major cryptocurrencies</p>
<p><small>24/7 trading</small></p>
</div>
<div style="background: rgba(255,255,255,0.05); padding: 1rem; border-radius: 0.5rem;">
<h4>🏭 Commodities (14)</h4>
<p>Metals, energy, MCX</p>
<p><small>Various hours</small></p>
</div>
<div style="background: rgba(255,255,255,0.05); padding: 1rem; border-radius: 0.5rem;">
<h4>📊 Indices (6)</h4>
<p>World indices</p>
<p><small>Market hours vary</small></p>
</div>
<div style="background: rgba(255,255,255,0.05); padding: 1rem; border-radius: 0.5rem;">
<h4>📈 NSE Futures (2)</h4>
<p>Nifty & Bank Nifty</p>
<p><small>Auto-rollover</small></p>
</div>
</div>
</div>
<!-- FAQ -->
<div class="help-card">
<h2>❓ Frequently Asked Questions</h2>
<div class="faq-item">
<h3>Q: How often are signals updated?</h3>
<p><strong>A:</strong> The dashboard updates every 60 seconds. New signals are generated
when market conditions align across all three timeframes.</p>
</div>
<div class="faq-item">
<h3>Q: What does "Retail Sentiment" mean?</h3>
<p><strong>A:</strong> We integrate retail trader positioning data. When
retail traders are heavily long, we look for SELL signals (contrarian approach), and
vice versa. This provides an edge as retail traders are often wrong at extremes.</p>
</div>
<div class="faq-item">
<h3>Q: How do I know when to enter a trade?</h3>
<p><strong>A:</strong> Enter at the "Entry Price" shown on the signal card. You'll receive
Telegram/email alerts when new signals are generated. Signals marked as "New Signal" are
less than 1 hour old.</p>
</div>
<div class="faq-item">
<h3>Q: What if I miss the entry price?</h3>
<p><strong>A:</strong> Wait for a "Reentry Opportunity" - the system detects when price
pulls back to favorable levels. Don't chase the market!</p>
</div>
<div class="faq-item">
<h3>Q: How do trailing stop losses work?</h3>
<p><strong>A:</strong> When TP1 is hit, your SL automatically moves to breakeven (entry
price). When TP2 is hit, SL moves to TP1 level. This protects your profits while letting
winners run.</p>
</div>
<div class="faq-item">
<h3>Q: What happens when TP3 is hit?</h3>
<p><strong>A:</strong> The trade automatically closes and moves to "Signal History". You'll
receive a notification with final P/L and trade metrics.</p>
</div>
<div class="faq-item">
<h3>Q: Can I use this for live trading?</h3>
<p><strong>A:</strong> Yes, but start with a demo account first. Test the strategy,
understand the signals, and build confidence before risking real money. Always use
proper risk management.</p>
</div>
<div class="faq-item">
<h3>Q: What's the expected win rate?</h3>
<p><strong>A:</strong> Multi-timeframe strategies typically achieve 55-65% win rate.
With retail sentiment confirmation, this can improve to 60-70%. However, past
performance doesn't guarantee future results.</p>
</div>
<div class="faq-item">
<h3>Q: How many trades should I take simultaneously?</h3>
<p><strong>A:</strong> Recommended maximum: 5 concurrent positions. This prevents
over-leverage and allows proper risk management.</p>
</div>
<div class="faq-item">
<h3>Q: What are the NSE-specific features?</h3>
<p><strong>A:</strong> For NSE futures: (1) Auto-rollover before expiry, (2) Wider SL (2.5x
ATR) for 3-4 day swings, (3) Volume filter (1.2x average), (4) Opening Range Breakout
detection, (5) Pre-market global cues filter.</ </div>
<div class="faq-item">
<h3>Q: How do I set up Telegram alerts?</h3>
<p><strong>A:</strong> Telegram alerts are avaliable you need to connect via mail to
biasbuster2026@gmail.com. You'll receive
notifications for: New signals, TP hits, SL hits, and reentry opportunities.</p>
</div>
<div class="faq-item">
<h3>Q: Is this strategy suitable for beginners?</h3>
<p><strong>A:</strong> The system is automated and user-friendly, but understanding
risk management, and market basics is essential. Start with small positions and
paper
trading to learn.</p>
</div>
</div>
<!-- Disclaimer -->
<div class="help-card"
style="background: rgba(239, 68, 68, 0.1); border-left: 4px solid #ef4444;">
<h2>⚖️ Disclaimer</h2>
<p><strong>IMPORTANT:</strong> This dashboard provides trading signals based on technical
analysis. It is for informational and educational purposes only.</p>
<ul>
<li>Trading involves substantial risk of loss</li>
<li>Past performance does not guarantee future results</li>
<li>You are solely responsible for your trading decisions</li>
<li>Never invest money you cannot afford to lose</li>
<li>Consult a financial advisor before trading</li>
<li>The creators are not liable for any trading losses</li>
</ul>
</div>
<!-- Contact -->
<div class="help-card" style="text-align: center;">
<h2>📧 Need More Help?</h2>
<p>Use the feedback form below to ask questions or report issues.</p>
<p>Email: <strong>biasbuster2026@gmail.com</strong></p>
</div>
</div>
</section>
<!-- Performance Statistics Section -->
<section id="statsSection" class="help-section" style="display: none;">
<div style="max-width: 1200px; margin: 0 auto;">
<h1
style="text-align: center; margin-bottom: 2rem; background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;">
📊 Performance Statistics
</h1>
<!-- Stats Summary Cards -->
<div class="perf-summary" id="perfSummary">
<div class="perf-card">
<div class="perf-label">Total Trades</div>
<div class="perf-value" id="statsTotalTrades">--</div>
</div>
<div class="perf-card">
<div class="perf-label">Win Rate</div>
<div class="perf-value" id="statsWinRate" style="color: var(--bullish)">--%</div>
</div>
<div class="perf-card">
<div class="perf-label">Total P/L</div>
<div class="perf-value" id="statsTotalPL">--</div>
</div>
<div class="perf-card">
<div class="perf-label">Best Trade</div>
<div class="perf-value" id="statsBestTrade" style="color: var(--bullish)">--</div>
</div>
<div class="perf-card">
<div class="perf-label">Worst Trade</div>
<div class="perf-value" id="statsWorstTrade" style="color: var(--bearish)">--</div>
</div>
<div class="perf-card">
<div class="perf-label">Avg Duration</div>
<div class="perf-value" id="statsAvgDuration">--</div>
</div>
</div>
<!-- Win/Loss Breakdown -->
<div class="help-card">
<h2>🎯 Win/Loss Breakdown</h2>
<div
style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem;">
<div
style="text-align: center; padding: 1rem; background: rgba(16, 185, 129, 0.1); border-radius: 0.5rem;">
<div style="font-size: 2rem; font-weight: bold; color: var(--bullish);" id="statsWins">0
</div>
<div style="color: var(--text-secondary);">Wins (TP Hits)</div>
</div>
<div
style="text-align: center; padding: 1rem; background: rgba(239, 68, 68, 0.1); border-radius: 0.5rem;">
<div style="font-size: 2rem; font-weight: bold; color: var(--bearish);"
id="statsLosses">0</div>
<div style="color: var(--text-secondary);">Losses (SL Hits)</div>
</div>
<div
style="text-align: center; padding: 1rem; background: rgba(59, 130, 246, 0.1); border-radius: 0.5rem;">
<div style="font-size: 2rem; font-weight: bold; color: var(--accent);" id="statsActive">
0</div>
<div style="color: var(--text-secondary);">Active Trades</div>
</div>
</div>
<!-- Win Rate Progress Bar -->
<div style="margin-top: 1.5rem;">
<div style="display: flex; justify-content: space-between; margin-bottom: 0.5rem;">
<span>Win Rate</span>
<span id="statsWinRateBar">0%</span>
</div>
<div
style="height: 12px; background: rgba(239, 68, 68, 0.3); border-radius: 6px; overflow: hidden;">
<div id="winRateProgress"
style="height: 100%; background: linear-gradient(90deg, #10b981, #059669); width: 0%; transition: width 0.5s ease;">
</div>
</div>
</div>
</div>
<!-- Category Breakdown -->
<div class="help-card">
<h2>📊 Performance by Category</h2>
<div id="categoryBreakdown" style="margin-top: 1rem;">
<p style="color: var(--text-secondary);">Loading category data...</p>
</div>
</div>
<!-- Recent Trades -->
<div class="help-card">
<h2>📅 Recent Closed Trades</h2>
<div id="recentTrades" style="margin-top: 1rem;">
<p style="color: var(--text-secondary);">Loading trades...</p>
</div>
</div>
</div>
</section>
<section class="feedback-section">
<h2>📧 Share Your Feedback</h2>
<p style="color: var(--text-secondary); margin-bottom: 1.5rem;">How is the strategy performing for you?
Any
suggestions for improvement?</p>
<form class="feedback-form" id="feedbackForm">
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;">
<div>
<label for="feedbackName" class="visually-hidden">Your Name</label>
<input type="text" id="feedbackName" placeholder="Your Name (required)" required
aria-required="true"
style="background: var(--bg-color); border: 1px solid #334155; color: var(--text-primary); padding: 0.75rem; border-radius: 0.5rem;">
</div>
<div>
<label for="feedbackEmail" class="visually-hidden">Your Email</label>
<input type="email" id="feedbackEmail" placeholder="Your Email (optional)"
style="background: var(--bg-color); border: 1px solid #334155; color: var(--text-primary); padding: 0.75rem; border-radius: 0.5rem;">
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;">
<div>
<label for="feedbackCategory" class="visually-hidden">Feedback Category</label>
<select id="feedbackCategory" required aria-required="true"
style="background: var(--bg-color); border: 1px solid #334155; color: var(--text-primary); padding: 0.75rem; border-radius: 0.5rem;">
<option value="">Select Category</option>
<option value="Bug Report">🐛 Bug Report</option>
<option value="Feature Request">💡 Feature Request</option>
<option value="Performance">⚡ Performance Issue</option>
<option value="UI/UX">🎨 UI/UX Feedback</option>
<option value="Strategy">📈 Strategy Feedback</option>
<option value="General">💬 General Comment</option>
<option value="Other">📝 Other</option>
</select>
</div>
<div
style="display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem; background: var(--bg-color); border: 1px solid #334155; border-radius: 0.5rem;">
<label style="color: var(--text-secondary); white-space: nowrap;">Rating:</label>
<div class="star-rating" id="starRating" style="display: flex; gap: 0.25rem;"
role="radiogroup" aria-label="Rating from 1 to 5 stars">
<span class="star" data-value="1" role="radio" aria-checked="false" tabindex="0"
style="cursor: pointer; font-size: 1.5rem; color: #64748b;">★</span>
<span class="star" data-value="2" role="radio" aria-checked="false" tabindex="0"
style="cursor: pointer; font-size: 1.5rem; color: #64748b;">★</span>
<span class="star" data-value="3" role="radio" aria-checked="false" tabindex="0"
style="cursor: pointer; font-size: 1.5rem; color: #64748b;">★</span>
<span class="star" data-value="4" role="radio" aria-checked="false" tabindex="0"
style="cursor: pointer; font-size: 1.5rem; color: #64748b;">★</span>
<span class="star" data-value="5" role="radio" aria-checked="true" tabindex="0"
style="cursor: pointer; font-size: 1.5rem; color: #64748b;">★</span>
</div>
<input type="hidden" id="feedbackRating" value="5">
</div>
</div>
<div>
<label for="feedbackText" class="visually-hidden">Your Feedback</label>
<textarea id="feedbackText" placeholder="Enter your detailed feedback here..." required
aria-required="true"></textarea>
</div>
<button type="submit" aria-label="Submit feedback">📨 Send Feedback</button>
</form>
<div id="feedbackStatus" role="status" aria-live="polite"></div>
</section>
</main>
</div>
<!-- Live region for dynamic status announcements -->
<div aria-live="polite" aria-atomic="true" class="visually-hidden" id="status-announcer"></div>
<div id="debugInfo"
style="display: none; background: #450a0a; color: #fecaca; padding: 1rem; margin: 1rem; border-radius: 0.5rem; border: 1px solid #991b1b; font-family: monospace; font-size: 0.8rem; white-space: pre-wrap;">
</div>
<script>
// ========== THEME TOGGLE ==========
function toggleTheme() {
const root = document.documentElement;
const isLight = root.classList.toggle('light-theme');
localStorage.setItem('theme', isLight ? 'light' : 'dark');
updateThemeButton(isLight);
}
function updateThemeButton(isLight) {
const icon = document.getElementById('themeIcon');
const text = document.getElementById('themeText');
if (icon && text) {
icon.textContent = isLight ? '☀️' : '🌙';
text.textContent = isLight ? 'Light' : 'Dark';
}
}
// Initialize theme on page load
(function initTheme() {
const saved = localStorage.getItem('theme');
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
const isLight = saved === 'light' || (!saved && !prefersDark);
if (isLight) {
document.documentElement.classList.add('light-theme');
}
// Update button after DOM loads
document.addEventListener('DOMContentLoaded', () => updateThemeButton(isLight));
})();
// ========== PWA SERVICE WORKER ==========
let deferredInstallPrompt = null;
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/service-worker.js')
.then((registration) => {
console.log('✅ Service Worker registered:', registration.scope);
})
.catch((error) => {
console.log('❌ Service Worker registration failed:', error);
});
});
}
// Capture install prompt for later use
window.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
deferredInstallPrompt = e;
console.log('📲 Install prompt captured - app can be installed!');
// Show install button if desired
showInstallButton();
});
function showInstallButton() {
// Add install button to header if it doesn't exist
const header = document.querySelector('header');
if (header && !document.getElementById('installBtn')) {
const btn = document.createElement('button');
btn.id = 'installBtn';
btn.innerHTML = '📲 Install App';
btn.style.cssText = 'margin-top: 0.75rem; margin-left: 0.5rem; padding: 0.5rem 1rem; background: var(--bullish); border: none; border-radius: 0.5rem; color: white; cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: all 0.3s ease;';
btn.onclick = installPWA;
header.appendChild(btn);
}
}
async function installPWA() {
if (!deferredInstallPrompt) {
alert('App is already installed or not supported on this browser.');
return;
}
deferredInstallPrompt.prompt();
const { outcome } = await deferredInstallPrompt.userChoice;
console.log('Install prompt outcome:', outcome);
if (outcome === 'accepted') {
console.log('🎉 User installed the app!');
}
deferredInstallPrompt = null;
// Hide install button
const btn = document.getElementById('installBtn');
if (btn) btn.remove();
}
// Handle successful install
window.addEventListener('appinstalled', () => {
console.log('🎉 BiasBuster installed successfully!');
deferredInstallPrompt = null;
// Record install on server
recordPWAInstall();
});
// Record PWA install on server
async function recordPWAInstall() {
try {
const res = await fetch('/api/pwa-install', { method: 'POST' });
const data = await res.json();
if (data.success) {
console.log(`📲 Install recorded! Total: ${data.count}`);
updatePWAInstallCount(data.count);
}
} catch (e) {
console.log('Could not record install:', e);
}
}
// Load and display PWA install count
async function loadPWAInstallCount() {
try {
const res = await fetch('/api/pwa-installs');
const data = await res.json();
updatePWAInstallCount(data.count);
} catch (e) {
// Silently fail - not critical
}
}
// Update PWA install count display
function updatePWAInstallCount(count) {
const countEl = document.getElementById('pwaInstallCount');
if (countEl) {
countEl.textContent = count;
countEl.parentElement.style.display = count > 0 ? 'inline-flex' : 'none';
}
}
// Load count on page load
document.addEventListener('DOMContentLoaded', loadPWAInstallCount);
// ========== SOUND ALERTS & BROWSER NOTIFICATIONS ==========
let soundAlertsEnabled = localStorage.getItem('soundAlerts') !== 'false'; // Default: enabled
let previousSignals = new Set(); // Track known signals to detect new ones
let notificationPermission = 'default';
// Initialize sound alerts
(function initSoundAlerts() {
// Request notification permission on page load
if ('Notification' in window) {
notificationPermission = Notification.permission;
if (notificationPermission === 'default') {
// Will request when user clicks the button
}
}
// Update button state after DOM loads
document.addEventListener('DOMContentLoaded', () => updateSoundButton());
})();
function toggleSoundAlerts() {
soundAlertsEnabled = !soundAlertsEnabled;
localStorage.setItem('soundAlerts', soundAlertsEnabled);
updateSoundButton();
// Request notification permission if enabling
if (soundAlertsEnabled && 'Notification' in window && Notification.permission === 'default') {
Notification.requestPermission().then(permission => {
notificationPermission = permission;
if (permission === 'granted') {
showNotification('🔔 Alerts Enabled', 'You will now receive notifications for new trading signals!');
}
});
}
// Play test sound when enabling
if (soundAlertsEnabled) {
playAlertSound('enable');
}
}
function updateSoundButton() {
const icon = document.getElementById('soundIcon');
const text = document.getElementById('soundText');
const btn = document.getElementById('soundToggle');
if (icon && text && btn) {
icon.textContent = soundAlertsEnabled ? '🔔' : '🔕';
text.textContent = soundAlertsEnabled ? 'Alerts On' : 'Alerts Off';
btn.style.borderColor = soundAlertsEnabled ? 'var(--bullish)' : 'var(--border-color)';
}
}
function playAlertSound(type = 'newSignal') {
if (!soundAlertsEnabled) return;
try {
// Create audio context for generating sounds
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
// Resume audio context if suspended (browser policy)
if (audioContext.state === 'suspended') {
audioContext.resume();
}
// Different sounds for different events
switch (type) {
case 'newSignal':
// Loud attention-grabbing 3-beep alert
playBeepSequence(audioContext, [
{ freq: 880, duration: 0.15, volume: 0.8 },
{ freq: 0, duration: 0.1, volume: 0 }, // Pause
{ freq: 1047, duration: 0.15, volume: 0.8 },
{ freq: 0, duration: 0.1, volume: 0 }, // Pause
{ freq: 1320, duration: 0.25, volume: 0.9 }
]);
break;
case 'tpHit':
// Happy ascending melody for TP hit
playBeepSequence(audioContext, [
{ freq: 523, duration: 0.15, volume: 0.7 }, // C5
{ freq: 659, duration: 0.15, volume: 0.7 }, // E5
{ freq: 784, duration: 0.15, volume: 0.7 }, // G5
{ freq: 1047, duration: 0.3, volume: 0.8 } // C6
]);
break;
case 'slHit':
// Deep warning beeps for SL hit
playBeepSequence(audioContext, [
{ freq: 250, duration: 0.3, volume: 0.8 },
{ freq: 0, duration: 0.1, volume: 0 },
{ freq: 200, duration: 0.4, volume: 0.8 }
]);
break;
case 'enable':
// Confirmation double-beep
playBeepSequence(audioContext, [
{ freq: 800, duration: 0.1, volume: 0.5 },
{ freq: 0, duration: 0.05, volume: 0 },
{ freq: 1000, duration: 0.15, volume: 0.6 }
]);
break;
}
} catch (e) {
console.log('Audio playback not supported:', e);
}
}
// Helper function to play a sequence of beeps
function playBeepSequence(audioContext, beeps) {
let currentTime = audioContext.currentTime;
beeps.forEach(beep => {
if (beep.freq > 0) {
const oscillator = audioContext.createOscillator();
const gainNode = audioContext.createGain();
oscillator.connect(gainNode);
gainNode.connect(audioContext.destination);
oscillator.frequency.setValueAtTime(beep.freq, currentTime);
oscillator.type = 'sine';
gainNode.gain.setValueAtTime(beep.volume, currentTime);
gainNode.gain.exponentialRampToValueAtTime(0.01, currentTime + beep.duration);
oscillator.start(currentTime);
oscillator.stop(currentTime + beep.duration);
}
currentTime += beep.duration;
});
}
function showNotification(title, body, icon = '📊') {
if (!soundAlertsEnabled) return;
if ('Notification' in window && Notification.permission === 'granted') {
try {
const notification = new Notification(title, {
body: body,
icon: 'biasbuster_icon_192.png',
badge: 'biasbuster_icon_192.png',
tag: 'biasbuster-signal',
requireInteraction: false,
silent: false
});
notification.onclick = function () {
window.focus();
notification.close();
};
// Auto close after 10 seconds
setTimeout(() => notification.close(), 10000);
} catch (e) {
console.log('Notification error:', e);
}
}
}
// Check for new signals and trigger alerts
function checkForNewSignals(data) {
if (!data || !data.data) return;
const currentSignals = new Set();
let newSignalCount = 0;
const newSignalNames = [];
data.data.forEach(item => {
if (item.signal) {
const signalKey = `${item.instrument}-${item.signal.type}-${item.signal.entry_time || ''}`;
currentSignals.add(signalKey);
// Check if this is a new signal we haven't seen
if (!previousSignals.has(signalKey) && previousSignals.size > 0) {
newSignalCount++;
newSignalNames.push(`${item.signal.type} ${item.instrument}`);
}
}
});
// Alert for new signals
if (newSignalCount > 0 && soundAlertsEnabled) {
playAlertSound('newSignal');
if (newSignalCount === 1) {
showNotification('🆕 New Signal!', newSignalNames[0]);
} else {
showNotification(`🆕 ${newSignalCount} New Signals!`, newSignalNames.slice(0, 3).join(', ') + (newSignalCount > 3 ? '...' : ''));
}
}
// Update previous signals set
previousSignals = currentSignals;
}
// Global error handler
window.onerror = function (msg, url, lineNo, columnNo, error) {
const debug = document.getElementById('debugInfo');
if (debug) {
debug.style.display = 'block';
// Replace instead of append to avoid accumulation
debug.textContent = `⚠️ JavaScript Error: ${msg}\nLine: ${lineNo}\nCol: ${columnNo}\n`;
}
return false;
};
function formatPrice(price, instrument) {
if (price === null || price === undefined || isNaN(price)) return '---';
if (instrument.includes('JPY')) {
return price.toFixed(3);
} else if (instrument.includes('Oil') || instrument.includes('Gold') || instrument.includes('Bitcoin') || instrument.includes('Ethereum') || instrument.includes('Nifty') || instrument.includes('Sensex')) {
return price.toFixed(2);
} else if (instrument.includes('Silver')) {
return price.toFixed(3);
} else {
return price.toFixed(5);
}
}
// ========== SPARKLINE MINI CHARTS ==========
function renderSparklines() {
const canvases = document.querySelectorAll('.sparkline-canvas');
canvases.forEach(canvas => {
const pricesStr = canvas.dataset.prices;
if (!pricesStr) return;
const prices = pricesStr.split(',').map(Number).filter(p => !isNaN(p));
if (prices.length < 2) return;
const ctx = canvas.getContext('2d');
const container = canvas.parentElement;
const width = container.clientWidth - 8; // Account for padding
const height = container.clientHeight - 4;
// Set canvas dimensions
canvas.width = width;
canvas.height = height;
// Calculate scale
const min = Math.min(...prices);
const max = Math.max(...prices);
const range = max - min || 1;
const padding = 2;
// Determine trend color
const isUp = prices[prices.length - 1] >= prices[0];
const lineColor = isUp ? '#10b981' : '#ef4444'; // Green or Red
const fillColor = isUp ? 'rgba(16, 185, 129, 0.15)' : 'rgba(239, 68, 68, 0.15)';
// Calculate points
const stepX = (width - padding * 2) / (prices.length - 1);
const points = prices.map((price, i) => ({
x: padding + i * stepX,
y: height - padding - ((price - min) / range) * (height - padding * 2)
}));
// Draw fill
ctx.beginPath();
ctx.moveTo(points[0].x, height);
points.forEach(p => ctx.lineTo(p.x, p.y));
ctx.lineTo(points[points.length - 1].x, height);
ctx.closePath();
ctx.fillStyle = fillColor;
ctx.fill();
// Draw line
ctx.beginPath();
ctx.moveTo(points[0].x, points[0].y);
points.forEach((p, i) => {
if (i === 0) return;
ctx.lineTo(p.x, p.y);
});
ctx.strokeStyle = lineColor;
ctx.lineWidth = 1.5;
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
ctx.stroke();
// Draw end dot
const lastPoint = points[points.length - 1];
ctx.beginPath();
ctx.arc(lastPoint.x, lastPoint.y, 3, 0, Math.PI * 2);
ctx.fillStyle = lineColor;
ctx.fill();
});
}
function formatDate(dateStr) {
const date = new Date(dateStr);
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
const day = String(date.getDate()).padStart(2, '0');
const month = months[date.getMonth()];
const year = date.getFullYear();
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${day}/${month}/${year}, ${hours}:${minutes}:${seconds}`;
}
// ========== PRICE TICKER ==========
function renderTicker(data) {
if (!data || !data.data || data.data.length === 0) return;
const wrapper = document.getElementById('tickerWrapper');
if (!wrapper) return;
// Select diverse instruments for ticker (max 20)
const categories = {};
data.data.forEach(item => {
if (!categories[item.category]) categories[item.category] = [];
categories[item.category].push(item);
});
// Get 3-4 items from each category
let tickerItems = [];
Object.keys(categories).forEach(cat => {
const items = categories[cat].slice(0, 4);
tickerItems = tickerItems.concat(items);
});
// Limit to 25 items
tickerItems = tickerItems.slice(0, 25);
// Build ticker HTML
let html = '';
tickerItems.forEach(item => {
const price = formatPrice(item.ltp, item.instrument);
const bias = item.daily?.bias || '';
const isUp = bias === 'BULLISH';
const isDown = bias === 'BEARISH';
const hasSignal = item.signal !== null;
const signalType = item.signal?.type || '';
html += `
<div class="ticker-item">
<span class="ticker-flag">${item.flag || ''}</span>
<span class="ticker-name">${item.instrument}</span>
<span class="ticker-price">${price}</span>
${isUp ? '<span class="ticker-change ticker-up">▲</span>' : ''}
${isDown ? '<span class="ticker-change ticker-down">▼</span>' : ''}
${hasSignal ? `<span class="ticker-signal ticker-${signalType.toLowerCase()}">${signalType}</span>` : ''}
</div>
`;
});
// Duplicate for seamless scrolling
wrapper.innerHTML = html + html;
// Adjust animation speed based on content width
const itemWidth = wrapper.scrollWidth / 2;
const duration = Math.max(30, itemWidth / 50); // pixels per second
wrapper.style.animationDuration = `${duration}s`;
}
// ========== PERFORMANCE STATISTICS ==========
async function loadPerformanceStats() {
try {
// Fetch signal history
const historyRes = await fetch('signal_history.json?t=' + Date.now());
const history = historyRes.ok ? await historyRes.json() : [];
// Fetch active signals count
const signalsRes = await fetch('forex_macd_signals.json?t=' + Date.now());
const signalsData = signalsRes.ok ? await signalsRes.json() : { data: [] };
const activeCount = signalsData.data ? signalsData.data.filter(d => d.signal).length : 0;
// Calculate statistics
const wins = history.filter(h => h.event && (h.event.includes('TP') || h.event === 'TP1_HIT' || h.event === 'TP2_HIT' || h.event === 'TP3_HIT'));
const losses = history.filter(h => h.event === 'SL_HIT');
const totalClosed = wins.length + losses.length;
const winRate = totalClosed > 0 ? ((wins.length / totalClosed) * 100).toFixed(1) : 0;
// Calculate P/L
let totalPL = 0;
let bestTrade = null;
let worstTrade = null;
history.forEach(trade => {
if (trade.pnl_percent !== undefined) {
totalPL += trade.pnl_percent;
if (!bestTrade || trade.pnl_percent > bestTrade.pnl_percent) bestTrade = trade;
if (!worstTrade || trade.pnl_percent < worstTrade.pnl_percent) worstTrade = trade;
}
});
// Update UI elements
document.getElementById('statsTotalTrades').textContent = history.length;
document.getElementById('statsWinRate').textContent = winRate + '%';
document.getElementById('statsWinRate').style.color = winRate >= 50 ? 'var(--bullish)' : 'var(--bearish)';
const plElement = document.getElementById('statsTotalPL');
plElement.textContent = (totalPL >= 0 ? '+' : '') + totalPL.toFixed(2) + '%';
plElement.style.color = totalPL >= 0 ? 'var(--bullish)' : 'var(--bearish)';
document.getElementById('statsBestTrade').textContent = bestTrade ?
(bestTrade.instrument + ' +' + (bestTrade.pnl_percent || 0).toFixed(2) + '%') : 'N/A';
document.getElementById('statsWorstTrade').textContent = worstTrade ?
(worstTrade.instrument + ' ' + (worstTrade.pnl_percent || 0).toFixed(2) + '%') : 'N/A';
// Average duration
const durations = history.filter(h => h.duration).map(h => h.duration);
document.getElementById('statsAvgDuration').textContent = durations.length > 0 ?
durations[Math.floor(durations.length / 2)] : 'N/A';
// Win/Loss breakdown
document.getElementById('statsWins').textContent = wins.length;
document.getElementById('statsLosses').textContent = losses.length;
document.getElementById('statsActive').textContent = activeCount;
document.getElementById('statsWinRateBar').textContent = winRate + '%';
document.getElementById('winRateProgress').style.width = winRate + '%';
// Category breakdown
const categories = {};
history.forEach(trade => {
const cat = trade.category || 'Unknown';
if (!categories[cat]) categories[cat] = { wins: 0, losses: 0, pl: 0 };
if (trade.event && trade.event.includes('TP')) categories[cat].wins++;
if (trade.event === 'SL_HIT') categories[cat].losses++;
if (trade.pnl_percent) categories[cat].pl += trade.pnl_percent;
});
let categoryHTML = '<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem;">';
Object.entries(categories).forEach(([cat, data]) => {
const catTotal = data.wins + data.losses;
const catWinRate = catTotal > 0 ? ((data.wins / catTotal) * 100).toFixed(0) : 0;
categoryHTML += `
<div style="padding: 1rem; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 0.5rem;">
<div style="font-weight: 600; margin-bottom: 0.5rem;">${cat}</div>
<div style="display: flex; justify-content: space-between; font-size: 0.9rem;">
<span style="color: var(--bullish);">W: ${data.wins}</span>
<span style="color: var(--bearish);">L: ${data.losses}</span>
<span style="color: ${data.pl >= 0 ? 'var(--bullish)' : 'var(--bearish)'};">${data.pl >= 0 ? '+' : ''}${data.pl.toFixed(1)}%</span>
</div>
<div style="margin-top: 0.5rem; height: 6px; background: rgba(239,68,68,0.3); border-radius: 3px;">
<div style="height: 100%; width: ${catWinRate}%; background: var(--bullish); border-radius: 3px;"></div>
</div>
</div>
`;
});
categoryHTML += '</div>';
document.getElementById('categoryBreakdown').innerHTML = Object.keys(categories).length > 0 ?
categoryHTML : '<p style="color: var(--text-secondary);">No category data available yet.</p>';
// Recent trades list
const recentTrades = history.slice(-10).reverse();
let tradesHTML = '';
if (recentTrades.length > 0) {
tradesHTML = '<div style="display: flex; flex-direction: column; gap: 0.5rem;">';
recentTrades.forEach(trade => {
const isWin = trade.event && trade.event.includes('TP');
const color = isWin ? 'var(--bullish)' : (trade.event === 'SL_HIT' ? 'var(--bearish)' : 'var(--accent)');
tradesHTML += `
<div style="display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; background: var(--bg-color); border-radius: 0.5rem; border-left: 3px solid ${color};">
<div>
<span style="font-weight: 600;">${trade.instrument}</span>
<span style="color: var(--text-secondary); font-size: 0.85rem; margin-left: 0.5rem;">${trade.type || ''}</span>
</div>
<div style="text-align: right;">
<span style="color: ${color}; font-weight: 600;">${trade.event}</span>
${trade.pnl_percent !== undefined ?
`<span style="margin-left: 0.5rem; color: ${trade.pnl_percent >= 0 ? 'var(--bullish)' : 'var(--bearish)'};">${trade.pnl_percent >= 0 ? '+' : ''}${trade.pnl_percent.toFixed(2)}%</span>`
: ''}
</div>
</div>
`;
});
tradesHTML += '</div>';
} else {
tradesHTML = '<p style="color: var(--text-secondary);">No closed trades yet.</p>';
}
document.getElementById('recentTrades').innerHTML = tradesHTML;
} catch (error) {
console.error('Error loading performance stats:', error);
document.getElementById('categoryBreakdown').innerHTML = '<p style="color: var(--bearish);">Error loading statistics.</p>';
}
}
function getLifecycleBadge(signal, hasReentry) {
if (!signal) return '';
const status = signal.lifecycle_status || 'Active';
const badges = {
'New Signal': { class: 'lifecycle-new', emoji: '🟢', text: 'New Signal' },
'Reentry Opportunity': { class: 'lifecycle-reentry', emoji: '🔁', text: 'Reentry Opportunity' },
'Partial TP Hit': { class: 'lifecycle-partial-tp', emoji: '🟡', text: 'Partial TP Hit' },
'Trailing SL Active': { class: 'lifecycle-trailing', emoji: '🔵', text: 'Trailing SL Active' },
'Active': { class: 'lifecycle-active', emoji: '⚪', text: 'Active' }
};
const badge = badges[status] || badges['Active'];
return `<div class="lifecycle-badge ${badge.class}">${badge.emoji} ${badge.text}</div>`;
}
let currentCategory = 'LiveSignal';
let cachedData = null;
let selectedHistoryDate = null;
let lastFetchTimes = {
'signals': 0,
'history': 0,
'pastTrades': {} // {date: timestamp}
};
const SYNC_INTERVAL_ACTIVE = 30000; // 30 seconds for Active Signals
const SYNC_INTERVAL_OTHER = 900000; // 15 minutes for others
async function fetchData(force = false) {
const now = Date.now();
const isOtherTab = currentCategory !== 'LiveSignal';
// Only fetch if forced, or if it's the Active tab (10s), or if 15m passed for other tabs
if (!force) {
const interval = (currentCategory === 'LiveSignal') ? SYNC_INTERVAL_ACTIVE : SYNC_INTERVAL_OTHER;
if (now - lastFetchTimes.signals < interval) {
return;
}
}
const debug = document.getElementById('debugInfo');
try {
// Fetch signals with cache busting
const signalsRes = await fetch('forex_macd_signals.json?t=' + Date.now());
if (signalsRes.ok) {
cachedData = await signalsRes.json();
lastFetchTimes.signals = Date.now();
// Check for new signals and trigger alerts
checkForNewSignals(cachedData);
// Hide debug panel on successful fetch
if (debug) {
debug.style.display = 'none';
}
} else {
throw new Error(`Failed to fetch signals: ${signalsRes.status}`);
}
// Fetch visitor count (optional - gracefully fail if not available)
try {
const visitorRes = await fetch('/api/visitor-count', {
signal: AbortSignal.timeout(3000) // 3 second timeout
});
if (visitorRes.ok) {
const stats = await visitorRes.json();
// Use new API response format
document.getElementById('visitorCount').textContent = stats.unique_visitors || stats.unique || 0;
document.getElementById('activeCount').textContent = stats.active_visitors || stats.active || 0;
}
} catch (vErr) {
// Silently fail for visitor count - it's optional
// Only log to console, don't show to user
console.debug('Visitor count unavailable (expected on remote deployments)');
}
renderDashboard();
} catch (error) {
console.error('Error fetching data:', error);
if (debug) {
debug.style.display = 'block';
// Clear previous errors and show only the latest
debug.textContent = `⚠️ Signal Fetch Error: ${error.message}\n\nRetrying automatically...\n`;
}
}
}
function filterCategory(category) {
currentCategory = category;
// Update active tab button
const buttons = document.querySelectorAll('.tab-btn');
buttons.forEach(btn => {
const btnText = btn.textContent.trim();
if (btnText === category ||
(category === 'LiveSignal' && btnText.includes('Live Signal')) ||
(category === 'History' && btnText === 'Signal History') ||
(category === 'Crypto Scalping' && btnText.includes('Crypto Live')) ||
(category === 'NSE Live' && btnText.includes('NSE Live')) ||
(category === 'World Index' && btnText.includes('World Index')) ||
(category === 'Indian Indices & Commodities' && btnText.includes('Commodities Live')) ||
(category === 'Indian Stocks' && btnText === 'Indian Stocks') ||
(category === 'Stock Scalping' && btnText.includes('Stock Scalping')) ||
(category === 'Metals/Energy' && btnText === 'Metals & Energy')) {
btn.classList.add('active');
} else {
btn.classList.remove('active');
}
});
if (category === 'History') {
renderHistory(true); // Force fetch on tab click
document.getElementById('helpSection').style.display = 'none';
document.getElementById('statsSection').style.display = 'none';
} else if (category === 'Help') {
// Show help section, hide dashboard
document.getElementById('helpSection').style.display = 'block';
document.getElementById('dashboard').style.display = 'none';
document.getElementById('statsSection').style.display = 'none';
// Update active button
buttons.forEach(btn => {
if (btn.textContent.includes('Help \u0026 FAQ')) {
btn.classList.add('active');
btn.setAttribute('aria-pressed', 'true');
} else {
btn.classList.remove('active');
btn.setAttribute('aria-pressed', 'false');
}
});
return; // Don't fetch data
} else if (category === 'Stats') {
// Show stats section, hide dashboard and help
document.getElementById('statsSection').style.display = 'block';
document.getElementById('helpSection').style.display = 'none';
document.getElementById('dashboard').style.display = 'none';
// Update active button
buttons.forEach(btn => {
if (btn.textContent.includes('Performance')) {
btn.classList.add('active');
btn.setAttribute('aria-pressed', 'true');
} else {
btn.classList.remove('active');
btn.setAttribute('aria-pressed', 'false');
}
});
loadPerformanceStats();
return; // Don't fetch data
} else if (category === 'PastTrades') {
renderPastTrades(null, true); // Force fetch on tab click
document.getElementById('helpSection').style.display = 'none';
document.getElementById('statsSection').style.display = 'none';
} else {
fetchData(true); // Force fetch on tab click
document.getElementById('helpSection').style.display = 'none';
document.getElementById('statsSection').style.display = 'none';
document.getElementById('dashboard').style.display = 'grid';
}
}
function renderDashboard() {
try {
if (!cachedData) return;
const data = cachedData;
const container = document.getElementById('dashboard');
const lastUpdated = document.getElementById('lastUpdated');
container.innerHTML = '';
container.className = 'grid'; // Ensure grid layout
lastUpdated.textContent = `Last Updated: ${new Date(data.last_updated).toLocaleString()}`;
const backendStatus = document.getElementById('backendStatus');
if (data.backend_heartbeat) {
backendStatus.textContent = `Backend Last Run: ${data.backend_heartbeat}`;
backendStatus.style.color = 'var(--bullish)';
} else {
backendStatus.textContent = 'Backend: Status Unknown';
backendStatus.style.color = 'var(--bearish)';
}
// Update price ticker
renderTicker(data);
// Filter by category
let filteredData = data.data;
console.log('Total instruments:', data.data.length);
console.log('Current category:', currentCategory);
if (currentCategory === 'LiveSignal') {
// Show ALL instruments with active signals across all categories EXCEPT Crypto
filteredData = data.data.filter(inst => inst.signal !== null && inst.category !== 'Crypto Scalping');
} else if (currentCategory === 'NSELive') {
// Show only NSE Live futures
filteredData = data.data.filter(inst => inst.category === 'NSE Live');
} else if (currentCategory === 'Indian Indices & Commodities') {
// Show MCX commodities and US Metals/Energy, but exclude Indian indices
const excludeIndices = ['Nifty 50', 'Bank Nifty', 'Sensex'];
filteredData = data.data.filter(inst =>
(inst.category === 'Indian Indices & Commodities' && !excludeIndices.includes(inst.instrument)) ||
inst.category === 'Metals/Energy'
);
} else {
filteredData = data.data.filter(inst => inst.category === currentCategory);
}
console.log('Filtered instruments:', filteredData.length);
if (filteredData.length === 0) {
container.innerHTML = `<div style="grid-column: 1/-1; text-align: center; padding: 4rem; color: var(--text-secondary);">No instruments found for category: ${currentCategory}</div>`;
return;
}
// Add NSE Live contract info banner
if (currentCategory === 'NSELive' && filteredData.length > 0 && filteredData[0].contract_info) {
const contractInfo = filteredData[0].contract_info;
const daysClass = contractInfo.days_to_expiry <= 1 ? 'bearish' : (contractInfo.days_to_expiry <= 7 ? 'status-waiting' : 'bullish');
const banner = document.createElement('div');
banner.style.cssText = 'grid-column: 1/-1; background: rgba(59, 130, 246, 0.1); padding: 1rem; border-radius: 0.5rem; margin-bottom: 1rem; border: 1px solid rgba(59, 130, 246, 0.3);';
banner.innerHTML = `
<div style="font-size: 0.875rem; color: var(--text-secondary); display: flex; gap: 2rem; flex-wrap: wrap; align-items: center; justify-content: center;">
<div>📅 <strong>Current Contract:</strong> <span style="color: var(--accent);">${contractInfo.contract}</span></div>
<div>📆 <strong>Expiry:</strong> <span style="color: var(--text-primary);">${contractInfo.expiry}</span></div>
<div>⏳ <strong>Days to Expiry:</strong> <span class="${daysClass}" style="font-weight: 700;">${contractInfo.days_to_expiry}</span></div>
</div>
`;
container.appendChild(banner);
}
// Environment detection: Local vs Hugging Face
const isLocal = window.location.hostname === 'localhost' ||
window.location.hostname === '127.0.0.1' ||
window.location.hostname.includes('hf.space') ||
window.location.hostname.includes('huggingface.co') ||
window.location.protocol === 'file:';
if (isLocal) {
// Local Sort: Prioritize signals, then sort everything by recency (signal time or analysis timestamp)
filteredData.sort((a, b) => {
const getPriority = (inst) => {
if (inst.signal) return 2;
if (inst.overall_status.startsWith('ACTIVE_') || inst.overall_status.startsWith('LOOKING_')) return 1;
return 0;
};
const pA = getPriority(a);
const pB = getPriority(b);
if (pA !== pB) return pB - pA;
// Within same priority, sort by recency
const timeA = a.signal ? new Date(a.signal.time).getTime() : new Date(a.timestamp).getTime();
const timeB = b.signal ? new Date(b.signal.time).getTime() : new Date(b.timestamp).getTime();
if (isNaN(timeA)) return 1;
if (isNaN(timeB)) return -1;
return timeB - timeA;
});
} else {
// Original Sort: Signals first (by time descending), then active status, then others
filteredData.sort((a, b) => {
const getPriority = (inst) => {
if (inst.signal) return 2;
if (inst.overall_status.startsWith('ACTIVE_') || inst.overall_status.startsWith('LOOKING_')) return 1;
return 0;
};
const priorityA = getPriority(a);
const priorityB = getPriority(b);
if (priorityA !== priorityB) {
return priorityB - priorityA;
}
// If both have signals, sort by signal time descending
if (a.signal && b.signal) {
const tA = new Date(a.signal.time).getTime();
const tB = new Date(b.signal.time).getTime();
if (isNaN(tA)) return 1;
if (isNaN(tB)) return -1;
return tB - tA;
}
return 0;
});
}
filteredData.forEach(inst => {
try {
const card = document.createElement('div');
card.className = 'card';
let statusClass = 'status-waiting';
if (inst.overall_status.includes('BUY')) statusClass = 'status-buy';
if (inst.overall_status.includes('SELL')) statusClass = 'status-sell';
const getBiasClass = (bias) => {
if (!bias) return 'neutral';
if (bias.includes('BULLISH')) return 'bullish';
if (bias.includes('BEARISH')) return 'bearish';
return 'neutral';
};
const getTfClass = (bias) => {
if (!bias) return 'neutral';
if (bias.includes('BULLISH')) return 'bullish';
if (bias.includes('BEARISH')) return 'bearish';
return 'neutral';
};
const getBorderClass = (bias) => {
if (!bias) return 'border-neutral';
if (bias.includes('BULLISH')) return 'border-bullish';
if (bias.includes('BEARISH')) return 'border-bearish';
return 'border-neutral';
};
let signalHtml = '';
if (inst.signal) {
const typeClass = inst.signal.type === 'BUY' ? 'buy' : 'sell';
const typeColor = inst.signal.type === 'BUY' ? 'bullish' : 'bearish';
const entryPrice = inst.signal.entry_price || inst.signal.price;
const isTrailing = inst.signal.current_sl && inst.signal.current_sl !== inst.signal.sl;
const lifecycleBadge = getLifecycleBadge(inst.signal, inst.re_entry !== null);
signalHtml = `
<div class="signal-panel ${typeClass}">
<div class="signal-row" style="margin-bottom: 1rem; border-bottom: 1px solid #334155; padding-bottom: 0.5rem;">
<span class="signal-val ${typeColor}" style="font-size: 1.2rem;">${inst.signal.type} SIGNAL</span>
</div>
${lifecycleBadge}
<div class="signal-row">
<span class="signal-label">Entry Price</span>
<span class="signal-val">${formatPrice(entryPrice, inst.instrument)}</span>
</div>
<div class="signal-row" style="${isTrailing ? 'opacity: 0.6; font-size: 0.85rem;' : ''}">
<span class="signal-label">Initial SL</span>
<span class="signal-val" style="color: var(--bearish)">${formatPrice(inst.signal.sl, inst.instrument)}</span>
</div>
${isTrailing ? `
<div class="signal-row">
<span class="signal-label">Trailing SL 🛡️</span>
<span class="signal-val" style="color: var(--bullish)">${formatPrice(inst.signal.current_sl, inst.instrument)}</span>
</div>` : ''}
<div style="margin-top: 0.5rem; border-top: 1px dashed #334155; padding-top: 0.5rem;">
<div class="signal-row">
<span class="signal-label">TP 1 (1.5x) ${inst.signal.tp_hits && inst.signal.tp_hits[0] ? '<span style="color: var(--bullish); font-weight: bold; margin-left: 5px;">✓</span>' : ''}</span>
<span class="signal-val" style="color: var(--bullish)">${formatPrice(inst.signal.tp1 || inst.signal.tp, inst.instrument)}</span>
</div>
<div class="signal-row">
<span class="signal-label">TP 2 (3.0x) ${inst.signal.tp_hits && inst.signal.tp_hits[1] ? '<span style="color: var(--bullish); font-weight: bold; margin-left: 5px;">✓</span>' : ''}</span>
<span class="signal-val" style="color: var(--bullish)">${formatPrice(inst.signal.tp2 || 0, inst.instrument)}</span>
</div>
<div class="signal-row">
<span class="signal-label">TP 3 (5.0x) ${inst.signal.tp_hits && inst.signal.tp_hits[2] ? '<span style="color: var(--bullish); font-weight: bold; margin-left: 5px;">✓</span>' : ''}</span>
<span class="signal-val" style="color: var(--bullish)">${formatPrice(inst.signal.tp3 || 0, inst.instrument)}</span>
</div>
</div>
<div class="signal-row" style="margin-top: 0.5rem; border-top: 1px solid #334155; padding-top: 0.5rem;">
<span class="signal-label">Detection Time</span>
<span class="signal-val" style="color: var(--text-secondary); font-size: 0.85rem;" title="Candle Time: ${inst.signal.candle_time ? formatDate(inst.signal.candle_time) : 'N/A'}">${formatDate(inst.signal.time)}</span>
</div>
</div>
`;
} else {
signalHtml = `
<div style="text-align: center; padding: 2rem; color: var(--text-secondary); border: 1px dashed #334155; border-radius: 0.5rem; margin-top: 1rem;">
Waiting for signal conditions...
</div>
`;
}
// Reentry Opportunity Panel
let reentryHtml = '';
if (inst.re_entry && inst.signal) {
const getStrengthClass = (strength) => {
if (strength >= 70) return 'strength-high';
if (strength >= 50) return 'strength-medium';
return 'strength-low';
};
const typeColor = inst.signal.type === 'BUY' ? 'bullish' : 'bearish';
reentryHtml = `
<div class="reentry-panel">
<div class="reentry-header">
🔄 RE-ENTRY OPPORTUNITY
<span class="strength-badge ${getStrengthClass(inst.re_entry.strength)}">
${inst.re_entry.strength}% STRENGTH
</span>
</div>
<div class="reentry-details">
<div class="reentry-row">
<span>Type:</span>
<span class="${typeColor}">${inst.re_entry.type.replace(/_/g, ' ')}</span>
</div>
<div class="reentry-row">
<span>Suggested Entry:</span>
<span class="accent">${formatPrice(inst.re_entry.suggested_entry, inst.instrument)}</span>
</div>
<div class="reentry-row">
<span>Fibonacci Level:</span>
<span class="accent">${inst.re_entry.fib_level} (${formatPrice(inst.re_entry.fib_price, inst.instrument)})</span>
</div>
<div class="reentry-row">
<span>Rejection Zone:</span>
<span>${inst.re_entry.rejection_zone}</span>
</div>
<div class="reentry-row">
<span>Risk:Reward Ratio:</span>
<span class="bullish" style="font-weight: 700;">${inst.re_entry.risk_reward}</span>
</div>
<div class="reentry-reason">
💡 ${inst.re_entry.reason}
</div>
<div class="reentry-confirmation">
${inst.re_entry.confirmation}
</div>
</div>
</div>
`;
}
card.innerHTML = `
<div class="card-header">
<div>
<div style="font-size: 2.5rem; margin-bottom: 0.25rem;">${inst.flag || ''}</div>
<div class="instrument-name">${inst.instrument}</div>
<div class="current-price">LTP: ${formatPrice(inst.ltp, inst.instrument)}</div>
</div>
<div class="status-badge ${statusClass}">${inst.overall_status.replace(/_/g, ' ')}</div>
</div>
<div class="sparkline-container">
<canvas class="sparkline-canvas" data-prices="${inst.sparkline ? inst.sparkline.join(',') : ''}"></canvas>
</div>
<div class="analysis-grid">
<div class="tf-box ${getBorderClass(inst.daily.bias)}">
<div class="tf-label">${inst.daily.label || '1D Trend'}</div>
<div class="tf-value ${getTfClass(inst.daily.bias)}">${inst.daily.bias}</div>
</div>
<div class="tf-box ${getBorderClass(inst.h4.bias)}">
<div class="tf-label">${inst.h4.label || '4H MOM'}</div>
<div class="tf-value ${getTfClass(inst.h4.bias)}">${inst.h4.bias}</div>
</div>
<div class="tf-box ${getBorderClass(inst.h1.status)}">
<div class="tf-label">${inst.h1.label || '1H Entry'}</div>
<div class="tf-value ${getTfClass(inst.h1.status)}">${inst.h1.status.replace(/_/g, ' ')}</div>
</div>
</div>
${signalHtml}
${reentryHtml}
`;
container.appendChild(card);
} catch (cardErr) {
console.error('Error rendering card:', cardErr, inst);
}
});
// Render sparkline charts after cards are added to DOM
requestAnimationFrame(() => renderSparklines());
} catch (err) {
console.error('Render error:', err);
const debug = document.getElementById('debugInfo');
if (debug) {
debug.style.display = 'block';
// Replace instead of append to avoid accumulation
debug.textContent = `⚠️ Render Error: ${err.message}\n\nPlease refresh the page.\n`;
}
}
}
function getPipSize(instrument) {
if (instrument.includes('JPY')) return 0.01;
if (instrument.includes('US Oil') || instrument.includes('Brent') || instrument.includes('Crude Oil')) return 0.01;
if (instrument.includes('Natural Gas')) return instrument.includes('MCX') ? 0.1 : 0.001;
if (instrument.includes('Copper')) return 0.05;
if (instrument.includes('Gold')) return 0.1;
if (instrument.includes('Silver')) return 0.005;
if (instrument.includes('Platinum') || instrument.includes('Palladium')) return 0.1;
if (instrument.includes('Bitcoin')) return 1.0;
if (instrument.includes('Ethereum')) return 0.1;
if (instrument.includes('Nifty') || instrument.includes('Sensex')) return 0.05;
return 0.0001; // Default for Forex
}
// ================= PROFESSIONAL SIGNAL HISTORY FUNCTIONS =================
let historyFilters = {
search: '',
type: '',
result: ''
};
function getResultBadge(event) {
const badges = {
'ENTRY': '<span class="result-badge badge-entry">⏳ ENTRY</span>',
'TP1_HIT': '<span class="result-badge badge-tp">✅ TP1</span>',
'TP2_HIT': '<span class="result-badge badge-tp">✅ TP2</span>',
'TP3_HIT': '<span class="result-badge badge-tp">✅ TP3</span>',
'SL_HIT': '<span class="result-badge badge-sl">❌ SL HIT</span>',
'TRAIL_SL_HIT': '<span class="result-badge badge-trail">🔁 TRAIL SL</span>',
'TRAILING_SL_HIT': '<span class="result-badge badge-trail">🔁 TRAIL SL</span>'
};
return badges[event] || `<span class="result-badge">${event.replace('_', ' ')}</span>`;
}
function calculatePerformanceMetrics(trades) {
const totalTrades = trades.filter(t => t.exit_time).length;
const wins = trades.filter(t => t.event && t.event.includes('TP')).length;
const losses = trades.filter(t => t.event && t.event.includes('SL')).length;
const winRate = totalTrades > 0 ? (wins / totalTrades * 100) : 0;
const avgRR = trades.reduce((sum, t) => sum + (t.rr_achieved || 0), 0) / totalTrades || 0;
const netPnL = trades.reduce((sum, t) => sum + (t.pnl_points || 0), 0);
const pnlValues = trades.filter(t => t.pnl_points).map(t => t.pnl_points);
let maxDrawdown = 0;
let runningPnL = 0;
let peak = 0;
pnlValues.forEach(pnl => {
runningPnL += pnl;
if (runningPnL > peak) peak = runningPnL;
const drawdown = peak - runningPnL;
if (drawdown > maxDrawdown) maxDrawdown = drawdown;
});
return { totalTrades, wins, losses, winRate, avgRR, netPnL, maxDrawdown };
}
function renderPerformanceSummary(metrics) {
const winRateClass = metrics.winRate > 55 ? 'pnl-positive' : (metrics.winRate < 45 ? 'pnl-negative' : 'pnl-neutral');
const pnlClass = metrics.netPnL >= 0 ? 'pnl-positive' : 'pnl-negative';
const rrClass = metrics.avgRR >= 1.5 ? 'pnl-positive' : 'pnl-neutral';
return `
<div class="perf-summary">
<div class="perf-card">
<div class="perf-label">Total Trades</div>
<div class="perf-value">${metrics.totalTrades}</div>
<div style="font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.25rem;">
${metrics.wins}W / ${metrics.losses}L
</div>
</div>
<div class="perf-card">
<div class="perf-label">Win Rate</div>
<div class="perf-value ${winRateClass}">${metrics.winRate.toFixed(1)}%</div>
</div>
<div class="perf-card">
<div class="perf-label">Avg R:R</div>
<div class="perf-value ${rrClass}">1:${metrics.avgRR.toFixed(2)}</div>
</div>
<div class="perf-card">
<div class="perf-label">Net P/L</div>
<div class="perf-value ${pnlClass}">${metrics.netPnL >= 0 ? '+' : ''}${metrics.netPnL.toFixed(1)}</div>
<div style="font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.25rem;">pips</div>
</div>
<div class="perf-card">
<div class="perf-label">Max Drawdown</div>
<div class="perf-value pnl-negative">${metrics.maxDrawdown.toFixed(1)}</div>
<div style="font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.25rem;">pips</div>
</div>
</div>
`;
}
function renderFiltersBar() {
return `
<div class="filters-bar">
<input type="text" class="filter-input" id="searchInput" placeholder="🔍 Search instrument..."
value="${historyFilters.search}" oninput="historyFilters.search = this.value; applyHistoryFilters()">
<select class="filter-select" id="typeFilter" onchange="historyFilters.type = this.value; applyHistoryFilters()">
<option value="">All Types</option>
<option value="BUY" ${historyFilters.type === 'BUY' ? 'selected' : ''}>BUY</option>
<option value="SELL" ${historyFilters.type === 'SELL' ? 'selected' : ''}>SELL</option>
</select>
<select class="filter-select" id="resultFilter" onchange="historyFilters.result = this.value; applyHistoryFilters()">
<option value="">All Results</option>
<option value="TP" ${historyFilters.result === 'TP' ? 'selected' : ''}>TP Hit</option>
<option value="SL" ${historyFilters.result === 'SL' ? 'selected' : ''}>SL Hit</option>
<option value="TRAIL" ${historyFilters.result === 'TRAIL' ? 'selected' : ''}>Trail SL</option>
</select>
<button class="export-btn" onclick="exportHistoryToCSV()">📥 Export CSV</button>
</div>
`;
}
function applyHistoryFilters() {
renderHistory(true);
}
function filterTrades(trades) {
return trades.filter(trade => {
// Search filter
if (historyFilters.search && !trade.instrument.toLowerCase().includes(historyFilters.search.toLowerCase())) {
return false;
}
// Type filter
if (historyFilters.type && trade.type !== historyFilters.type) {
return false;
}
// Result filter
if (historyFilters.result) {
if (historyFilters.result === 'TP' && !trade.event.includes('TP')) return false;
if (historyFilters.result === 'SL' && !trade.event.includes('SL')) return false;
if (historyFilters.result === 'TRAIL' && !trade.event.includes('TRAIL')) return false;
}
return true;
});
}
function exportHistoryToCSV() {
const trades = window.currentHistoryTrades || [];
if (trades.length === 0) {
alert('No trades to export');
return;
}
const headers = ['Instrument', 'Type', 'Entry Time', 'Exit Time', 'Entry Price', 'Exit Price',
'P/L (Pts)', 'P/L (%)', 'Duration', 'R:R Planned', 'R:R Achieved', 'Result'];
let csv = headers.join(',') + '\n';
trades.forEach(t => {
csv += [
t.instrument,
t.type,
t.entry_time || '',
t.exit_time || '',
t.entry_price || '',
t.exit_price || '',
t.pnl_points || 0,
t.pnl_percent || 0,
t.duration || 'N/A',
t.rr_planned || 1.5,
t.rr_achieved || 0,
t.event || ''
].join(',') + '\n';
});
const blob = new Blob([csv], { type: 'text/csv' });
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `signal_history_${new Date().toISOString().split('T')[0]}.csv`;
a.click();
window.URL.revokeObjectURL(url);
}
async function renderHistory(force = false) {
const now = Date.now();
if (!force && (now - lastFetchTimes.history < SYNC_INTERVAL_OTHER)) {
// If not forced and 15m haven't passed, just return if we already have content
if (document.querySelector('.history-table')) return;
}
const container = document.getElementById('dashboard');
container.innerHTML = '<div style="grid-column: 1/-1; text-align: center; padding: 4rem;">Loading history...</div>';
container.className = 'history-mode';
try {
const res = await fetch('signal_history.json?t=' + Date.now());
if (!res.ok) throw new Error('History not found');
const history = await res.json();
lastFetchTimes.history = Date.now();
if (history.length === 0) {
container.innerHTML = '<div style="grid-column: 1/-1; text-align: center; padding: 4rem; color: var(--text-secondary);">No signal history found.</div>';
return;
}
const isLocal = window.location.hostname === 'localhost' ||
window.location.hostname === '127.0.0.1' ||
window.location.hostname.includes('hf.space') ||
window.location.hostname.includes('huggingface.co') ||
window.location.protocol === 'file:';
if (isLocal) {
// Group by instrument and entry_time to show single line for closed trades
const trades = {};
history.forEach(item => {
const key = `${item.instrument}_${item.entry_time}`;
if (!trades[key]) {
trades[key] = {
instrument: item.instrument,
type: item.type,
entry_time: item.entry_time,
entry_price: item.entry_price || item.price,
exit_time: null,
exit_price: null,
event: item.event,
pips: 0,
last_update: new Date(item.time),
initial_sl: item.initial_sl
};
}
const itemTime = new Date(item.time);
if (itemTime > trades[key].last_update) {
trades[key].last_update = itemTime;
trades[key].event = item.event;
}
if (item.event.includes('TP') || item.event.includes('SL')) {
trades[key].exit_time = item.time;
trades[key].exit_price = item.price;
if (!trades[key].tp_progress) trades[key].tp_progress = new Set();
if (item.event.includes('TP')) {
trades[key].tp_progress.add(item.event);
}
const pipSize = getPipSize(item.instrument);
const diff = item.type === 'BUY' ? (item.price - trades[key].entry_price) : (trades[key].entry_price - item.price);
trades[key].pips = diff / pipSize;
}
});
const sortedTrades = Object.values(trades).sort((a, b) => {
const timeA = a.exit_time ? new Date(a.exit_time).getTime() : new Date(a.entry_time).getTime();
const timeB = b.exit_time ? new Date(b.exit_time).getTime() : new Date(b.entry_time).getTime();
return timeB - timeA;
});
// Extract unique dates for filter
const dates = [...new Set(sortedTrades.map(t => {
const d = t.exit_time ? new Date(t.exit_time) : new Date(t.entry_time);
return d.toISOString().split('T')[0];
}))].sort().reverse();
if (!selectedHistoryDate && dates.length > 0) {
selectedHistoryDate = dates[0];
}
const filteredTrades = selectedHistoryDate
? sortedTrades.filter(t => {
const d = t.exit_time ? new Date(t.exit_time) : new Date(t.entry_time);
return d.toISOString().split('T')[0] === selectedHistoryDate;
})
: sortedTrades;
// Calculate summary statistics
let totalTrades = 0;
let winningTrades = 0;
let losingTrades = 0;
let totalProfitPercent = 0;
let totalLossPercent = 0;
filteredTrades.forEach(trade => {
if (trade.exit_price && trade.entry_price) {
totalTrades++;
let plPercent = 0;
if (trade.type === 'BUY') {
plPercent = ((trade.exit_price - trade.entry_price) / trade.entry_price) * 100;
} else {
plPercent = ((trade.entry_price - trade.exit_price) / trade.entry_price) * 100;
}
if (plPercent >= 0) {
winningTrades++;
totalProfitPercent += plPercent;
} else {
losingTrades++;
totalLossPercent += plPercent;
}
}
});
const winRate = totalTrades > 0 ? ((winningTrades / totalTrades) * 100).toFixed(1) : 0;
const netPL = totalProfitPercent + totalLossPercent;
const avgPL = totalTrades > 0 ? (netPL / totalTrades).toFixed(2) : 0;
const netPLClass = netPL >= 0 ? 'pnl-positive' : 'pnl-negative';
const avgPLClass = avgPL >= 0 ? 'pnl-positive' : 'pnl-negative';
let html = `
<div class="past-trades-controls" style="grid-column: 1/-1;">
<label for="historyDateSelect">Filter by Date: </label>
<select id="historyDateSelect" class="date-select" onchange="selectedHistoryDate = this.value; renderHistory(true);">
${dates.map(d => `<option value="${d}" ${d === selectedHistoryDate ? 'selected' : ''}>${d}</option>`).join('')}
</select>
<span style="margin-left: 1rem; color: var(--text-secondary); font-size: 0.9rem;">
Showing ${filteredTrades.length} trades
</span>
</div>
<!-- Performance Summary Dashboard -->
<div class="perf-summary" style="grid-column: 1/-1; margin-bottom: 1.5rem;">
<div class="perf-card">
<div class="perf-label">📊 Total Trades</div>
<div class="perf-value" style="color: var(--accent);">${totalTrades}</div>
</div>
<div class="perf-card">
<div class="perf-label">✅ Winning Trades</div>
<div class="perf-value pnl-positive">${winningTrades}</div>
</div>
<div class="perf-card">
<div class="perf-label">❌ Losing Trades</div>
<div class="perf-value pnl-negative">${losingTrades}</div>
</div>
<div class="perf-card">
<div class="perf-label">🎯 Win Rate</div>
<div class="perf-value" style="color: ${winRate >= 50 ? '#10b981' : '#ef4444'};">${winRate}%</div>
</div>
<div class="perf-card">
<div class="perf-label">💰 Total P/L</div>
<div class="perf-value ${netPLClass}">${netPL >= 0 ? '+' : ''}${netPL.toFixed(2)}%</div>
</div>
<div class="perf-card">
<div class="perf-label">📈 Avg P/L per Trade</div>
<div class="perf-value ${avgPLClass}">${avgPL >= 0 ? '+' : ''}${avgPL}%</div>
</div>
</div>
<div class="history-table-container" style="grid-column: 1/-1;">
<table class="history-table">
<thead>
<tr>
<th>Instrument</th>
<th>Type</th>
<th>Entry Time</th>
<th>Exit Time</th>
<th class="numeric">Entry</th>
<th class="numeric">Exit</th>
<th class="numeric">P/L %</th>
<th>Result</th>
</tr>
</thead>
<tbody>
`;
filteredTrades.forEach(trade => {
let eventClass = 'event-entry';
if (trade.event.includes('TP')) eventClass = 'event-tp';
if (trade.event.includes('SL')) eventClass = 'event-sl';
const pipsFixed = trade.pips.toFixed(1);
const pipsClass = trade.pips >= 0 ? 'bullish' : 'bearish';
const tpIcons = Array.from(trade.tp_progress || []).sort().map(tp => {
const num = tp.match(/\d/);
return `<span title="${tp}" style="color: var(--bullish); font-weight: bold; margin-right: 4px; background: rgba(16, 185, 129, 0.1); padding: 2px 4px; border-radius: 4px; font-size: 0.65rem;">TP${num}✓</span>`;
}).join('');
let displayEvent = trade.event.replace('_', ' ');
let slDetails = '';
if (displayEvent.includes('SL HIT')) {
const isTrailing = trade.event === 'TRAIL_SL_HIT' || trade.event === 'TRAILING_SL_HIT' || (trade.tp_progress && trade.tp_progress.size > 0);
if (isTrailing) {
displayEvent = 'TRAIL SL HIT';
slDetails = `<div style="font-size: 0.7rem; color: var(--text-secondary); margin-top: 2px;">
Init SL: ${formatPrice(trade.initial_sl, trade.instrument)}<br>
Exit: ${formatPrice(trade.exit_price, trade.instrument)}
</div>`;
} else {
slDetails = `<div style="font-size: 0.7rem; color: var(--text-secondary); margin-top: 2px;">
SL: ${formatPrice(trade.initial_sl, trade.instrument)}
</div>`;
}
}
// Calculate P/L percentage
let plPercent = 0;
let plClass = 'pnl-neutral';
let plDisplay = '---';
if (trade.exit_price && trade.entry_price) {
if (trade.type === 'BUY') {
plPercent = ((trade.exit_price - trade.entry_price) / trade.entry_price) * 100;
} else { // SELL
plPercent = ((trade.entry_price - trade.exit_price) / trade.entry_price) * 100;
}
plClass = plPercent >= 0 ? 'pnl-positive' : 'pnl-negative';
const plSign = plPercent >= 0 ? '+' : '';
plDisplay = `${plSign}${plPercent.toFixed(2)}%`;
}
html += `
<tr>
<td class="instrument-name-cell">${trade.instrument}</td>
<td class="${trade.type === 'BUY' ? 'type-buy' : 'type-sell'}">${trade.type}</td>
<td style="color: var(--text-secondary); font-size: 0.85rem;">${formatDate(trade.entry_time)}</td>
<td style="color: var(--text-secondary); font-size: 0.85rem;">${trade.exit_time ? formatDate(trade.exit_time) : '---'}</td>
<td class="numeric">${formatPrice(trade.entry_price, trade.instrument)}</td>
<td class="numeric">${trade.exit_price ? formatPrice(trade.exit_price, trade.instrument) : '---'}</td>
<td class="numeric ${plClass}" style="font-size: 1rem;">${plDisplay}</td>
<td><span class="result-badge badge-${eventClass.replace('event-', '')}">${displayEvent}</span>${tpIcons}${slDetails}</td>
</tr>
`;
});
html += `
</tbody>
</table>
</div>
</div>
`;
container.innerHTML = html;
} else {
// Original multi-line history for non-local
history.sort((a, b) => new Date(b.time) - new Date(a.time));
let html = `
<div class="history-table-container" style="grid-column: 1/-1;">
<table class="history-table">
<thead>
<tr>
<th>Time (IST)</th>
<th>Instrument</th>
<th>Event</th>
<th>Price</th>
<th>Type</th>
</tr>
</thead>
<tbody>
`;
history.forEach(item => {
let eventClass = 'event-entry';
if (item.event.includes('TP')) eventClass = 'event-tp';
if (item.event.includes('SL')) eventClass = 'event-sl';
html += `
<tr>
<td style="color: var(--text-secondary); font-size: 0.9rem;">${item.time}</td>
<td style="font-weight: 700;">${item.instrument}</td>
<td><span class="event-badge ${eventClass}">${item.event.replace('_', ' ')}</span></td>
<td style="font-family: monospace; font-weight: 600;">${formatPrice(item.price, item.instrument)}</td>
<td class="${item.type === 'BUY' ? 'bullish' : 'bearish'}" style="font-weight: 700;">${item.type}</td>
</tr>
`;
});
html += `</tbody></table></div>`;
container.innerHTML = html;
}
} catch (error) {
container.innerHTML = `<div style="grid-column: 1/-1; text-align: center; padding: 4rem; color: var(--bearish);">Error loading history: ${error.message}</div>`;
}
}
async function renderPastTrades(selectedDate = null, force = false) {
const now = Date.now();
const activeDate = selectedDate || (document.querySelector('.date-select') ? document.querySelector('.date-select').value : null);
if (!force && activeDate && lastFetchTimes.pastTrades[activeDate]) {
if (now - lastFetchTimes.pastTrades[activeDate] < SYNC_INTERVAL_OTHER) {
if (document.querySelector('.screenshot-grid')) return;
}
}
const container = document.getElementById('dashboard');
container.innerHTML = '<div style="grid-column: 1/-1; text-align: center; padding: 4rem;">Loading past trades...</div>';
container.className = 'past-trades-mode';
try {
// Fetch available dates
const datesRes = await fetch('/api/past-trades-dates');
if (!datesRes.ok) throw new Error('Failed to fetch dates');
const dates = await datesRes.json();
if (dates.length === 0) {
container.innerHTML = '<div style="grid-column: 1/-1; text-align: center; padding: 4rem; color: var(--text-secondary);">No past trades found.</div>';
return;
}
const finalActiveDate = selectedDate || dates[0];
// Fetch images for the active date
const imagesRes = await fetch(`/api/past-trades-images?date=${finalActiveDate}`);
if (!imagesRes.ok) throw new Error('Failed to fetch images');
const images = await imagesRes.json();
lastFetchTimes.pastTrades[finalActiveDate] = Date.now();
let html = `
<div style="grid-column: 1/-1;">
<div class="past-trades-controls">
<label style="color: var(--text-secondary); font-weight: 600;">Select Date:</label>
<select class="date-select" onchange="renderPastTrades(this.value)">
${dates.map(d => `<option value="${d}" ${d === activeDate ? 'selected' : ''}>${d}</option>`).join('')}
</select>
<span style="color: var(--text-secondary); margin-left: 1rem;">📸 ${images.length} Screenshots</span>
</div>
<div class="screenshot-grid">
`;
if (images.length === 0) {
html += `<div style="grid-column: 1/-1; text-align: center; padding: 4rem; color: var(--text-secondary);">No screenshots found for this date.</div>`;
} else {
images.forEach(imgName => {
const imgPath = `past_trades/${activeDate}/${imgName}`;
// Extract info from filename: EUR_USD_TP3_HIT_123456.png
const parts = imgName.split('_');
const instrument = parts.slice(0, 2).join('/');
const event = parts.slice(2, -1).join(' ').replace('.png', '');
html += `
<div class="screenshot-card">
<a href="${imgPath}" target="_blank">
<img src="${imgPath}" alt="${imgName}" loading="lazy">
</a>
<div class="screenshot-info">
<div class="screenshot-name">${instrument}</div>
<div style="font-size: 0.8rem; color: var(--accent); margin-top: 0.25rem;">${event}</div>
</div>
</div>
`;
});
}
html += `
</div>
</div>
`;
container.innerHTML = html;
} catch (err) {
console.error('Past trades render error:', err);
container.innerHTML = `<div style="grid-column: 1/-1; text-align: center; padding: 4rem; color: var(--bearish);">Error loading past trades: ${err.message}</div>`;
}
}
async function sendHeartbeat() {
try {
await fetch('/api/heartbeat');
} catch (error) {
console.error('Heartbeat failed:', error);
}
}
fetchData(true); // Initial force fetch
setInterval(() => {
if (currentCategory === 'History') {
renderHistory(false);
} else if (currentCategory === 'PastTrades') {
renderPastTrades(null, false);
} else {
fetchData(false);
}
}, 10000); // Check every 10s, but internal logic handles the 15m rule
setInterval(sendHeartbeat, 30000); // Send heartbeat every 30 seconds
// Star Rating Functionality
const stars = document.querySelectorAll('.star');
const ratingInput = document.getElementById('feedbackRating');
stars.forEach(star => {
star.addEventListener('click', function () {
const value = parseInt(this.getAttribute('data-value'));
ratingInput.value = value;
// Update star colors
stars.forEach((s, index) => {
if (index < value) {
s.style.color = '#fbbf24'; // Gold color for selected stars
} else {
s.style.color = '#64748b'; // Gray for unselected
}
});
});
// Hover effect
star.addEventListener('mouseenter', function () {
const value = parseInt(this.getAttribute('data-value'));
stars.forEach((s, index) => {
if (index < value) {
s.style.color = '#fbbf24';
}
});
});
});
// Reset to current rating on mouse leave
document.getElementById('starRating').addEventListener('mouseleave', function () {
const currentRating = parseInt(ratingInput.value);
stars.forEach((s, index) => {
if (index < currentRating) {
s.style.color = '#fbbf24';
} else {
s.style.color = '#64748b';
}
});
});
// Set default rating to 5 stars
stars.forEach((s, index) => {
if (index < 5) {
s.style.color = '#fbbf24';
}
});
// Feedback Submission
document.getElementById('feedbackForm').addEventListener('submit', async (e) => {
e.preventDefault();
const name = document.getElementById('feedbackName').value;
const email = document.getElementById('feedbackEmail').value || 'Not provided';
const category = document.getElementById('feedbackCategory').value;
const rating = document.getElementById('feedbackRating').value;
const message = document.getElementById('feedbackText').value;
const statusDiv = document.getElementById('feedbackStatus');
statusDiv.textContent = '📤 Sending feedback...';
statusDiv.style.color = 'var(--accent)';
try {
const response = await fetch('/api/feedback', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: name,
email: email,
category: category,
rating: rating,
message: message
}),
});
const result = await response.json();
if (response.ok && result.success) {
statusDiv.textContent = '✅ ' + result.message;
statusDiv.style.color = 'var(--bullish)';
// Reset form
document.getElementById('feedbackForm').reset();
ratingInput.value = '5';
stars.forEach((s, index) => {
s.style.color = index < 5 ? '#fbbf24' : '#64748b';
});
// Clear status after 5 seconds
setTimeout(() => {
statusDiv.textContent = '';
}, 5000);
} else {
throw new Error(result.error || 'Failed to submit feedback');
}
} catch (error) {
statusDiv.textContent = '❌ Error submitting feedback. Please try again.';
statusDiv.style.color = 'var(--bearish)';
}
});
</script>
</body>
</html> |