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
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Quantum Signal Generator Pro</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/lucide@latest"></script>
    <style>
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }
        .pulse-animation {
            animation: pulse 2s infinite;
        }
        .glow {
            box-shadow: 0 0 10px currentColor;
        }
        .gradient-border {
            border: 2px solid transparent;
            background-clip: padding-box;
            position: relative;
        }
        .gradient-border::after {
            content: '';
            position: absolute;
            top: -2px;
            left: -2px;
            right: -2px;
            bottom: -2px;
            background: linear-gradient(45deg, #3b82f6, #8b5cf6, #ec4899);
            z-index: -1;
            border-radius: inherit;
            opacity: 0.7;
        }
        .signal-strength {
            transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
        }
    </style>
</head>
<body class="bg-gray-900 text-white min-h-screen flex items-center justify-center p-4">
    <div class="max-w-md w-full">
        <div class="gradient-border rounded-xl overflow-hidden">
            <div class="bg-gray-800 p-6 rounded-xl">
                <div class="flex items-center justify-between mb-6">
                    <div>
                        <h2 class="text-2xl font-bold bg-gradient-to-r from-blue-400 to-purple-400 bg-clip-text text-transparent">Quantum Signal Generator Pro</h2>
                        <p class="text-sm text-gray-400">Advanced market prediction algorithm</p>
                    </div>
                    <div class="relative">
                        <div class="absolute -inset-1 bg-gradient-to-r from-blue-600 to-purple-600 rounded-full blur opacity-75"></div>
                        <div class="relative bg-gray-800 rounded-full p-2">
                            <i data-lucide="zap" class="w-6 h-6 text-yellow-400"></i>
                        </div>
                    </div>
                </div>

                <div class="mb-6">
                    <div class="flex justify-between items-center mb-2">
                        <span class="text-sm font-medium text-gray-300">Quantum Signal Strength</span>
                        <span class="text-sm font-bold" id="signalStrengthValue">87%</span>
                    </div>
                    <div class="h-2.5 w-full bg-gray-700 rounded-full overflow-hidden">
                        <div id="signalStrengthBar" class="h-full bg-gradient-to-r from-blue-500 to-purple-500 rounded-full signal-strength" style="width: 87%"></div>
                    </div>
                </div>

                <div class="grid grid-cols-2 gap-4 mb-6">
                    <div class="bg-gray-700/50 rounded-lg p-4 border border-gray-600/30">
                        <div class="text-xs text-gray-400 mb-1">Buy Confidence</div>
                        <div class="flex items-end">
                            <span id="buyConfidenceValue" class="text-2xl font-bold text-green-400">82</span>
                            <span class="text-lg text-green-400 ml-1">%</span>
                        </div>
                        <div class="mt-2 h-1 w-full bg-gray-600 rounded-full">
                            <div id="buyConfidenceBar" class="h-full bg-green-500 rounded-full" style="width: 82%"></div>
                        </div>
                    </div>
                    <div class="bg-gray-700/50 rounded-lg p-4 border border-gray-600/30">
                        <div class="text-xs text-gray-400 mb-1">Sell Confidence</div>
                        <div class="flex items-end">
                            <span id="sellConfidenceValue" class="text-2xl font-bold text-red-400">78</span>
                            <span class="text-lg text-red-400 ml-1">%</span>
                        </div>
                        <div class="mt-2 h-1 w-full bg-gray-600 rounded-full">
                            <div id="sellConfidenceBar" class="h-full bg-red-500 rounded-full" style="width: 78%"></div>
                        </div>
                    </div>
                </div>

                <div class="grid grid-cols-3 gap-2 mb-6">
                    <div class="bg-gray-700/30 rounded-lg p-3 text-center">
                        <div class="text-xs text-gray-400 mb-1">Market Volatility</div>
                        <div class="text-sm font-medium" id="volatilityValue">Medium</div>
                    </div>
                    <div class="bg-gray-700/30 rounded-lg p-3 text-center">
                        <div class="text-xs text-gray-400 mb-1">Trend Strength</div>
                        <div class="text-sm font-medium" id="trendStrengthValue">Strong</div>
                    </div>
                    <div class="bg-gray-700/30 rounded-lg p-3 text-center">
                        <div class="text-xs text-gray-400 mb-1">Risk Level</div>
                        <div class="text-sm font-medium" id="riskLevelValue">Moderate</div>
                    </div>
                </div>

                <div class="relative">
                    <button id="generateBtn" class="w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-500 hover:to-purple-500 rounded-lg font-medium flex items-center justify-center transition-all duration-300 hover:shadow-lg hover:shadow-blue-500/20">
                        <i data-lucide="zap" class="w-5 h-5 mr-2"></i>
                        <span>Generate Quantum Signal</span>
                    </button>
                    <div id="loadingIndicator" class="absolute inset-0 flex items-center justify-center bg-gray-800/80 rounded-lg hidden">
                        <div class="animate-spin rounded-full h-6 w-6 border-b-2 border-purple-500"></div>
                    </div>
                </div>

                <div id="toastContainer" class="fixed bottom-4 right-4 space-y-2"></div>
            </div>
        </div>
    </div>

    <script>
        lucide.createIcons();
        
        // Improved algorithm variables
        let marketState = {
            volatility: 0.5,
            trendDirection: 1,
            trendStrength: 0.7,
            lastSignal: null,
            consecutiveSignals: 0
        };

        // DOM elements
        const generateBtn = document.getElementById('generateBtn');
        const loadingIndicator = document.getElementById('loadingIndicator');
        const signalStrengthValue = document.getElementById('signalStrengthValue');
        const signalStrengthBar = document.getElementById('signalStrengthBar');
        const buyConfidenceValue = document.getElementById('buyConfidenceValue');
        const buyConfidenceBar = document.getElementById('buyConfidenceBar');
        const sellConfidenceValue = document.getElementById('sellConfidenceValue');
        const sellConfidenceBar = document.getElementById('sellConfidenceBar');
        const volatilityValue = document.getElementById('volatilityValue');
        const trendStrengthValue = document.getElementById('trendStrengthValue');
        const riskLevelValue = document.getElementById('riskLevelValue');
        const toastContainer = document.getElementById('toastContainer');

        // Improved signal generation algorithm
        async function generateSignal() {
            generateBtn.disabled = true;
            loadingIndicator.classList.remove('hidden');
            
            // Simulate analysis time with random delay
            const delay = 1500 + Math.random() * 1500;
            await new Promise(resolve => setTimeout(resolve, delay));
            
            // Update market state
            updateMarketState();
            
            // Generate values with improved algorithm
            const { signalStrength, buyConfidence, sellConfidence } = calculateSignal();
            
            // Update UI
            updateUI(signalStrength, buyConfidence, sellConfidence);
            
            // Generate and show signal
            const signal = createSignal(buyConfidence, sellConfidence);
            showToast(signal);
            
            // Reset button state
            generateBtn.disabled = false;
            loadingIndicator.classList.add('hidden');
            
            return signal;
        }

        function updateMarketState() {
            // Random walk for volatility (0-1)
            marketState.volatility = Math.max(0, Math.min(1, 
                marketState.volatility + (Math.random() - 0.5) * 0.2
            ));
            
            // Random walk for trend direction (-1 to 1)
            marketState.trendDirection = Math.max(-1, Math.min(1, 
                marketState.trendDirection + (Math.random() - 0.5) * 0.3
            ));
            
            // Trend strength depends on volatility and direction
            marketState.trendStrength = Math.max(0, Math.min(1, 
                0.5 + (Math.abs(marketState.trendDirection) * 0.5) - (marketState.volatility * 0.3)
            ));
            
            // Update market indicators
            updateMarketIndicators();
        }

        function updateMarketIndicators() {
            // Volatility text
            if (marketState.volatility < 0.3) {
                volatilityValue.textContent = 'Low';
                volatilityValue.className = 'text-sm font-medium text-green-400';
            } else if (marketState.volatility < 0.7) {
                volatilityValue.textContent = 'Medium';
                volatilityValue.className = 'text-sm font-medium text-yellow-400';
            } else {
                volatilityValue.textContent = 'High';
                volatilityValue.className = 'text-sm font-medium text-red-400';
            }
            
            // Trend strength text
            if (marketState.trendStrength < 0.3) {
                trendStrengthValue.textContent = 'Weak';
                trendStrengthValue.className = 'text-sm font-medium text-gray-400';
            } else if (marketState.trendStrength < 0.7) {
                trendStrengthValue.textContent = 'Moderate';
                trendStrengthValue.className = 'text-sm font-medium text-blue-400';
            } else {
                trendStrengthValue.textContent = 'Strong';
                trendStrengthValue.className = 'text-sm font-medium text-purple-400';
            }
            
            // Risk level (combination of volatility and inverse trend strength)
            const riskLevel = (marketState.volatility * 0.7) + ((1 - marketState.trendStrength) * 0.3);
            if (riskLevel < 0.4) {
                riskLevelValue.textContent = 'Low';
                riskLevelValue.className = 'text-sm font-medium text-green-400';
            } else if (riskLevel < 0.7) {
                riskLevelValue.textContent = 'Moderate';
                riskLevelValue.className = 'text-sm font-medium text-yellow-400';
            } else {
                riskLevelValue.textContent = 'High';
                riskLevelValue.className = 'text-sm font-medium text-red-400';
            }
        }

        function calculateSignal() {
            // Base signal strength depends on trend strength and volatility
            let signalStrength = 50 + (marketState.trendStrength * 30) - (marketState.volatility * 10);
            
            // Add some randomness
            signalStrength += (Math.random() - 0.5) * 15;
            signalStrength = Math.max(20, Math.min(100, signalStrength));
            
            // Calculate buy/sell confidence based on trend direction
            let buyConfidence, sellConfidence;
            
            if (marketState.trendDirection > 0) {
                // Bullish trend
                buyConfidence = 50 + (marketState.trendDirection * 30) + (signalStrength * 0.3);
                sellConfidence = 50 - (marketState.trendDirection * 20) + (signalStrength * 0.1);
            } else {
                // Bearish trend
                buyConfidence = 50 + (marketState.trendDirection * 20) + (signalStrength * 0.1);
                sellConfidence = 50 - (marketState.trendDirection * 30) + (signalStrength * 0.3);
            }
            
            // Add some randomness and ensure within bounds
            buyConfidence += (Math.random() - 0.5) * 10;
            sellConfidence += (Math.random() - 0.5) * 10;
            
            buyConfidence = Math.max(20, Math.min(100, buyConfidence));
            sellConfidence = Math.max(20, Math.min(100, sellConfidence));
            
            // Adjust for consecutive signals (reduce confidence if too many same signals)
            if (marketState.lastSignal && marketState.consecutiveSignals > 0) {
                const reduction = Math.min(15, marketState.consecutiveSignals * 3);
                if (marketState.lastSignal === 'BUY') {
                    buyConfidence = Math.max(20, buyConfidence - reduction);
                } else {
                    sellConfidence = Math.max(20, sellConfidence - reduction);
                }
            }
            
            return {
                signalStrength: Math.round(signalStrength),
                buyConfidence: Math.round(buyConfidence),
                sellConfidence: Math.round(sellConfidence)
            };
        }

        function createSignal(buyConfidence, sellConfidence) {
            // Determine signal type based on confidence and market state
            let isBuy;
            const buyThreshold = 55 + (marketState.trendDirection * 10);
            const sellThreshold = 55 - (marketState.trendDirection * 10);
            
            if (buyConfidence > sellConfidence && buyConfidence > buyThreshold) {
                isBuy = true;
            } else if (sellConfidence > buyConfidence && sellConfidence > sellThreshold) {
                isBuy = false;
            } else {
                // No clear signal if neither meets threshold
                isBuy = null;
            }
            
            // Update consecutive signals counter
            if (isBuy !== null) {
                if (marketState.lastSignal === (isBuy ? 'BUY' : 'SELL')) {
                    marketState.consecutiveSignals++;
                } else {
                    marketState.consecutiveSignals = 1;
                }
                marketState.lastSignal = isBuy ? 'BUY' : 'SELL';
            } else {
                marketState.consecutiveSignals = 0;
                marketState.lastSignal = null;
            }
            
            if (isBuy === null) {
                return {
                    type: 'NEUTRAL',
                    confidence: Math.max(buyConfidence, sellConfidence),
                    price: generatePrice(),
                    timestamp: new Date()
                };
            }
            
            return {
                type: isBuy ? 'BUY' : 'SELL',
                confidence: isBuy ? buyConfidence : sellConfidence,
                price: generatePrice(),
                timestamp: new Date()
            };
        }

        function generatePrice() {
            // Generate price with volatility and trend influence
            const basePrice = 42000;
            const volatilityFactor = marketState.volatility * 500;
            const trendFactor = marketState.trendDirection * 300 * marketState.trendStrength;
            
            return parseFloat((basePrice + trendFactor + (Math.random() - 0.5) * volatilityFactor * 2).toFixed(2));
        }

        function updateUI(signalStrength, buyConfidence, sellConfidence) {
            // Update signal strength
            signalStrengthValue.textContent = `${signalStrength}%`;
            signalStrengthBar.style.width = `${signalStrength}%`;
            
            // Update buy confidence
            buyConfidenceValue.textContent = buyConfidence;
            buyConfidenceBar.style.width = `${buyConfidence}%`;
            
            // Update sell confidence
            sellConfidenceValue.textContent = sellConfidence;
            sellConfidenceBar.style.width = `${sellConfidence}%`;
            
            // Add pulse animation for strong signals
            if (signalStrength > 85) {
                signalStrengthBar.classList.add('pulse-animation', 'glow');
                setTimeout(() => {
                    signalStrengthBar.classList.remove('pulse-animation', 'glow');
                }, 2000);
            }
        }

        function showToast(signal) {
            const toast = document.createElement('div');
            toast.className = `p-4 rounded-lg shadow-lg flex items-start ${signal.type === 'BUY' ? 'bg-green-900/80 border border-green-700' : signal.type === 'SELL' ? 'bg-red-900/80 border border-red-700' : 'bg-gray-800/80 border border-gray-700'}`;
            
            const icon = document.createElement('div');
            icon.className = `mr-3 mt-0.5 ${signal.type === 'BUY' ? 'text-green-400' : signal.type === 'SELL' ? 'text-red-400' : 'text-gray-400'}`;
            
            if (signal.type === 'BUY') {
                icon.innerHTML = '<i data-lucide="trending-up" class="w-5 h-5"></i>';
            } else if (signal.type === 'SELL') {
                icon.innerHTML = '<i data-lucide="trending-down" class="w-5 h-5"></i>';
            } else {
                icon.innerHTML = '<i data-lucide="move-horizontal" class="w-5 h-5"></i>';
            }
            
            const content = document.createElement('div');
            content.className = 'flex-1';
            
            const title = document.createElement('h3');
            title.className = 'font-medium';
            title.textContent = signal.type === 'BUY' ? 'Buy Signal Generated' : signal.type === 'SELL' ? 'Sell Signal Generated' : 'Market Neutral';
            
            const description = document.createElement('p');
            description.className = 'text-sm opacity-80';
            if (signal.type !== 'NEUTRAL') {
                description.textContent = `${signal.type} signal with ${signal.confidence}% confidence at $${signal.price}`;
            } else {
                description.textContent = `Market is neutral (${signal.confidence}% confidence). No clear signal.`;
            }
            
            content.appendChild(title);
            content.appendChild(description);
            toast.appendChild(icon);
            toast.appendChild(content);
            
            // Add close button
            const closeBtn = document.createElement('button');
            closeBtn.className = 'ml-4 text-gray-300 hover:text-white';
            closeBtn.innerHTML = '<i data-lucide="x" class="w-4 h-4"></i>';
            closeBtn.onclick = () => toast.remove();
            toast.appendChild(closeBtn);
            
            toastContainer.appendChild(toast);
            lucide.createIcons();
            
            // Auto-remove after 5 seconds
            setTimeout(() => {
                toast.classList.add('opacity-0', 'transition-opacity', 'duration-300');
                setTimeout(() => toast.remove(), 300);
            }, 5000);
        }

        // Initialize
        generateBtn.addEventListener('click', generateSignal);
        updateMarketIndicators();
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=xereon/quantumsignalstrength" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>