| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Candlestick Patterns Mastery</title> |
| <script src="https://cdn.tailwindcss.com"></script> |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> |
| <style> |
| .candle { |
| width: 30px; |
| height: 60px; |
| position: relative; |
| margin: 0 auto; |
| } |
| .candle-body { |
| width: 100%; |
| position: absolute; |
| border-radius: 2px; |
| } |
| .candle-wick { |
| width: 2px; |
| height: 10px; |
| background-color: #333; |
| position: absolute; |
| left: 50%; |
| transform: translateX(-50%); |
| } |
| .pattern-card:hover { |
| transform: translateY(-5px); |
| box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); |
| } |
| .chart-container { |
| height: 300px; |
| background-color: #1f2937; |
| border-radius: 0.5rem; |
| position: relative; |
| overflow: hidden; |
| } |
| .chart-line { |
| position: absolute; |
| background-color: #e2e8f0; |
| width: 100%; |
| height: 1px; |
| } |
| @keyframes fadeIn { |
| from { opacity: 0; transform: translateY(20px); } |
| to { opacity: 1; transform: translateY(0); } |
| } |
| .animate-fade-in { |
| animation: fadeIn 0.5s ease-out forwards; |
| } |
| </style> |
| </head> |
| <body class="bg-black font-sans text-white"> |
| |
| <nav class="bg-gray-900 text-white shadow-lg"> |
| <div class="container mx-auto px-4 py-3 flex justify-between items-center"> |
| <div class="flex items-center space-x-2"> |
| <i class="fas fa-chart-line text-2xl"></i> |
| <span class="text-xl font-bold">CandleMaster</span> |
| </div> |
| <div class="hidden md:flex space-x-6"> |
| <a href="#basics" class="hover:text-indigo-200 transition">Basics</a> |
| <a href="#patterns" class="hover:text-indigo-200 transition">Patterns</a> |
| <a href="#quiz" class="hover:text-indigo-200 transition">Quiz</a> |
| <a href="#resources" class="hover:text-indigo-200 transition">Resources</a> |
| </div> |
| <button class="md:hidden text-xl"> |
| <i class="fas fa-bars"></i> |
| </button> |
| </div> |
| </nav> |
|
|
| |
| <header class="bg-gradient-to-r from-gray-800 to-gray-700 text-white py-20"> |
| <div class="container mx-auto px-4 text-center"> |
| <h1 class="text-4xl md:text-6xl font-bold mb-6 animate-fade-in">Master Candlestick Patterns</h1> |
| <p class="text-xl md:text-2xl mb-8 max-w-3xl mx-auto animate-fade-in" style="animation-delay: 0.2s;"> |
| Unlock the secrets of price action with our comprehensive guide to candlestick patterns |
| </p> |
| <div class="flex flex-col sm:flex-row justify-center gap-4 animate-fade-in" style="animation-delay: 0.4s;"> |
| <a href="#patterns" class="bg-white text-indigo-800 font-bold py-3 px-6 rounded-lg hover:bg-indigo-100 transition duration-300"> |
| Explore Patterns |
| </a> |
| <a href="#quiz" class="bg-transparent border-2 border-white text-white font-bold py-3 px-6 rounded-lg hover:bg-white hover:text-indigo-800 transition duration-300"> |
| Test Your Knowledge |
| </a> |
| </div> |
| </div> |
| </header> |
|
|
| |
| <section id="basics" class="py-16 bg-gray-900"> |
| <div class="container mx-auto px-4"> |
| <h2 class="text-3xl font-bold text-center mb-12 text-white">Candlestick Basics</h2> |
| |
| <div class="grid md:grid-cols-2 gap-12 items-center"> |
| <div> |
| <h3 class="text-2xl font-semibold mb-4 text-indigo-700">What Are Candlesticks?</h3> |
| <p class="text-gray-600 mb-6"> |
| Candlestick charts originated in Japan over 300 years ago for tracking rice prices. Each candlestick represents price movement during a specific time period, showing the open, high, low, and close prices. |
| </p> |
| <p class="text-gray-600 mb-6"> |
| The rectangular "body" shows the range between the opening and closing prices. The "wicks" or "shadows" show the highest and lowest prices during that period. |
| </p> |
| <div class="flex items-center space-x-4 mb-6"> |
| <div class="flex items-center"> |
| <div class="candle mr-3"> |
| <div class="candle-wick top-0"></div> |
| <div class="candle-body bg-green-500 h-full"></div> |
| <div class="candle-wick bottom-0"></div> |
| </div> |
| <span>Bullish (Price rose)</span> |
| </div> |
| <div class="flex items-center"> |
| <div class="candle mr-3"> |
| <div class="candle-wick top-0"></div> |
| <div class="candle-body bg-red-500 h-full"></div> |
| <div class="candle-wick bottom-0"></div> |
| </div> |
| <span>Bearish (Price fell)</span> |
| </div> |
| </div> |
| </div> |
| <div class="chart-container p-4"> |
| <div class="chart-line" style="top: 25%"></div> |
| <div class="chart-line" style="top: 50%"></div> |
| <div class="chart-line" style="top: 75%"></div> |
| |
| <div class="flex justify-around items-end h-full"> |
| |
| <div class="flex flex-col items-center"> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 15px; top: -15px;"></div> |
| <div class="candle-body bg-red-500" style="height: 40px;"></div> |
| <div class="candle-wick" style="height: 10px; bottom: -10px;"></div> |
| </div> |
| <span class="text-xs mt-2">Day 1</span> |
| </div> |
| <div class="flex flex-col items-center"> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 5px; top: -5px;"></div> |
| <div class="candle-body bg-green-500" style="height: 60px;"></div> |
| <div class="candle-wick" style="height: 20px; bottom: -20px;"></div> |
| </div> |
| <span class="text-xs mt-2">Day 2</span> |
| </div> |
| <div class="flex flex-col items-center"> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 25px; top: -25px;"></div> |
| <div class="candle-body bg-red-500" style="height: 30px;"></div> |
| <div class="candle-wick" style="height: 5px; bottom: -5px;"></div> |
| </div> |
| <span class="text-xs mt-2">Day 3</span> |
| </div> |
| <div class="flex flex-col items-center"> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 10px; top: -10px;"></div> |
| <div class="candle-body bg-green-500" style="height: 70px;"></div> |
| <div class="candle-wick" style="height: 15px; bottom: -15px;"></div> |
| </div> |
| <span class="text-xs mt-2">Day 4</span> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| </section> |
|
|
| |
| <section id="patterns" class="py-16 bg-gray-900"> |
| <div class="container mx-auto px-4"> |
| <h2 class="text-3xl font-bold text-center mb-12 text-white">Common Candlestick Patterns</h2> |
| |
| <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8"> |
| |
| <div class="pattern-card bg-gray-800 rounded-lg overflow-hidden shadow-md transition duration-300"> |
| <div class="p-6"> |
| <h3 class="text-xl font-bold mb-2 text-indigo-700">Hammer</h3> |
| <div class="flex justify-center my-4"> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 30px; top: -30px;"></div> |
| <div class="candle-body bg-green-500" style="height: 15px;"></div> |
| </div> |
| </div> |
| <p class="text-gray-600 mb-4"> |
| A bullish reversal pattern that forms after a decline. It has a small body near the top and a long lower wick. |
| </p> |
| <div class="flex items-center text-sm text-gray-500"> |
| <i class="fas fa-lightbulb mr-2 text-yellow-500"></i> |
| <span>Signals potential trend reversal upward</span> |
| </div> |
| </div> |
| </div> |
| |
| |
| <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300"> |
| <div class="p-6"> |
| <h3 class="text-xl font-bold mb-2 text-indigo-700">Hanging Man</h3> |
| <div class="flex justify-center my-4"> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 30px; top: -30px;"></div> |
| <div class="candle-body bg-red-500" style="height: 15px;"></div> |
| </div> |
| </div> |
| <p class="text-gray-600 mb-4"> |
| A bearish reversal pattern that forms after an advance. Similar to a hammer but appears in an uptrend. |
| </p> |
| <div class="flex items-center text-sm text-gray-500"> |
| <i class="fas fa-lightbulb mr-2 text-yellow-500"></i> |
| <span>Signals potential trend reversal downward</span> |
| </div> |
| </div> |
| </div> |
| |
| |
| <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300"> |
| <div class="p-6"> |
| <h3 class="text-xl font-bold mb-2 text-indigo-700">Engulfing</h3> |
| <div class="flex justify-center my-4 space-x-2"> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 10px; top: -10px;"></div> |
| <div class="candle-body bg-red-500" style="height: 30px;"></div> |
| <div class="candle-wick" style="height: 5px; bottom: -5px;"></div> |
| </div> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 5px; top: -5px;"></div> |
| <div class="candle-body bg-green-500" style="height: 50px;"></div> |
| <div class="candle-wick" style="height: 10px; bottom: -10px;"></div> |
| </div> |
| </div> |
| <p class="text-gray-600 mb-4"> |
| A two-candle pattern where the second candle completely engulfs the body of the first. |
| </p> |
| <div class="flex items-center text-sm text-gray-500"> |
| <i class="fas fa-lightbulb mr-2 text-yellow-500"></i> |
| <span>Bullish when after downtrend, bearish after uptrend</span> |
| </div> |
| </div> |
| </div> |
| |
| |
| <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300"> |
| <div class="p-6"> |
| <h3 class="text-xl font-bold mb-2 text-indigo-700">Doji</h3> |
| <div class="flex justify-center my-4"> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 20px; top: -20px;"></div> |
| <div class="candle-body bg-gray-400" style="height: 2px;"></div> |
| <div class="candle-wick" style="height: 20px; bottom: -20px;"></div> |
| </div> |
| </div> |
| <p class="text-gray-600 mb-4"> |
| Occurs when opening and closing prices are virtually equal, showing market indecision. |
| </p> |
| <div class="flex items-center text-sm text-gray-500"> |
| <i class="fas fa-lightbulb mr-2 text-yellow-500"></i> |
| <span>Often signals potential reversal when after strong trend</span> |
| </div> |
| </div> |
| </div> |
| |
| |
| <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300"> |
| <div class="p-6"> |
| <h3 class="text-xl font-bold mb-2 text-indigo-700">Morning Star</h3> |
| <div class="flex justify-center my-4 space-x-1"> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 10px; top: -10px;"></div> |
| <div class="candle-body bg-red-500" style="height: 40px;"></div> |
| <div class="candle-wick" style="height: 5px; bottom: -5px;"></div> |
| </div> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 5px; top: -5px;"></div> |
| <div class="candle-body bg-gray-400" style="height: 10px;"></div> |
| <div class="candle-wick" style="height: 5px; bottom: -5px;"></div> |
| </div> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 5px; top: -5px;"></div> |
| <div class="candle-body bg-green-500" style="height: 35px;"></div> |
| <div class="candle-wick" style="height: 10px; bottom: -10px;"></div> |
| </div> |
| </div> |
| <p class="text-gray-600 mb-4"> |
| A three-candle bullish reversal pattern that appears after a downtrend. |
| </p> |
| <div class="flex items-center text-sm text-gray-500"> |
| <i class="fas fa-lightbulb mr-2 text-yellow-500"></i> |
| <span>Strong signal of potential upward reversal</span> |
| </div> |
| </div> |
| </div> |
| |
| |
| <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300"> |
| <div class="p-6"> |
| <h3 class="text-xl font-bold mb-2 text-indigo-700">Shooting Star</h3> |
| <div class="flex justify-center my-4"> |
| <div class="candle"> |
| <div class="candle-wick" style="height: 30px; top: -30px;"></div> |
| <div class="candle-body bg-red-500" style="height: 10px;"></div> |
| <div class="candle-wick" style="height: 5px; bottom: -5px;"></div> |
| </div> |
| </div> |
| <p class="text-gray-600 mb-4"> |
| A bearish reversal pattern with a small lower body and long upper wick, appearing after an uptrend. |
| </p> |
| <div class="flex items-center text-sm text-gray-500"> |
| <i class="fas fa-lightbulb mr-2 text-yellow-500"></i> |
| <span>Indicates potential trend reversal downward</span> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| </section> |
|
|
| |
| <section id="quiz" class="py-16 bg-gray-800 text-white"> |
| <div class="container mx-auto px-4"> |
| <h2 class="text-3xl font-bold text-center mb-12">Test Your Knowledge</h2> |
| |
| <div class="max-w-3xl mx-auto bg-gray-800 rounded-lg shadow-xl overflow-hidden"> |
| <div class="p-8 text-white"> |
| <div id="quiz-container"> |
| <div id="question-container" class="mb-8"> |
| <h3 class="text-xl font-semibold mb-4 text-indigo-700" id="question">What does a hammer candlestick pattern typically indicate?</h3> |
| <div class="space-y-3" id="options"> |
| <label class="flex items-center space-x-3 p-3 border border-gray-700 rounded-lg hover:bg-gray-700 cursor-pointer"> |
| <input type="radio" name="answer" value="0" class="h-4 w-4 text-indigo-600"> |
| <span>A continuation of the current downtrend</span> |
| </label> |
| <label class="flex items-center space-x-3 p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer"> |
| <input type="radio" name="answer" value="1" class="h-4 w-4 text-indigo-600"> |
| <span>A potential bullish reversal after a downtrend</span> |
| </label> |
| <label class="flex items-center space-x-3 p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer"> |
| <input type="radio" name="answer" value="2" class="h-4 w-4 text-indigo-600"> |
| <span>Market indecision with no clear direction</span> |
| </label> |
| <label class="flex items-center space-x-3 p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer"> |
| <input type="radio" name="answer" value="3" class="h-4 w-4 text-indigo-600"> |
| <span>A strong bearish signal in an uptrend</span> |
| </label> |
| </div> |
| </div> |
| <div id="result" class="hidden p-4 mb-6 rounded-lg bg-indigo-100 text-indigo-800"> |
| <p id="result-text"></p> |
| </div> |
| <div class="flex justify-between"> |
| <button id="prev-btn" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition disabled:opacity-50" disabled> |
| Previous |
| </button> |
| <button id="next-btn" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition"> |
| Next |
| </button> |
| <button id="submit-btn" class="hidden px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition"> |
| Submit Quiz |
| </button> |
| </div> |
| </div> |
| <div id="quiz-complete" class="hidden text-center py-8"> |
| <i class="fas fa-trophy text-5xl text-yellow-500 mb-4"></i> |
| <h3 class="text-2xl font-bold mb-2 text-indigo-700">Quiz Complete!</h3> |
| <p class="text-lg mb-6">Your score: <span id="score" class="font-bold">0</span>/<span id="total-questions">0</span></p> |
| <button id="restart-quiz" class="px-6 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition"> |
| Try Again |
| </button> |
| </div> |
| </div> |
| </div> |
| </div> |
| </section> |
|
|
| |
| <section id="resources" class="py-16 bg-gray-900"> |
| <div class="container mx-auto px-4"> |
| <h2 class="text-3xl font-bold text-center mb-12 text-white">Learning Resources</h2> |
| |
| <div class="grid md:grid-cols-3 gap-8"> |
| <div class="bg-gray-800 p-6 rounded-lg border border-gray-700"> |
| <div class="text-indigo-600 text-4xl mb-4"> |
| <i class="fas fa-book"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-3">Recommended Books</h3> |
| <ul class="space-y-2 text-gray-600"> |
| <li class="flex items-start"> |
| <i class="fas fa-chevron-right text-indigo-500 mt-1 mr-2 text-xs"></i> |
| <span>"Japanese Candlestick Charting Techniques" by Steve Nison</span> |
| </li> |
| <li class="flex items-start"> |
| <i class="fas fa-chevron-right text-indigo-500 mt-1 mr-2 text-xs"></i> |
| <span>"Encyclopedia of Candlestick Charts" by Thomas Bulkowski</span> |
| </li> |
| <li class="flex items-start"> |
| <i class="fas fa-chevron-right text-indigo-500 mt-1 mr-2 text-xs"></i> |
| <span>"Candlestick Charting Explained" by Gregory Morris</span> |
| </li> |
| </ul> |
| </div> |
| |
| <div class="bg-gray-50 p-6 rounded-lg border border-gray-200"> |
| <div class="text-indigo-600 text-4xl mb-4"> |
| <i class="fas fa-video"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-3">Video Courses</h3> |
| <ul class="space-y-2 text-gray-600"> |
| <li class="flex items-start"> |
| <i class="fas fa-chevron-right text-indigo-500 mt-1 mr-2 text-xs"></i> |
| <span>"Mastering Candlestick Patterns" on Udemy</span> |
| </li> |
| <li class="flex items-start"> |
| <i class="fas fa-chevron-right text-indigo-500 mt-1 mr-2 text-xs"></i> |
| <span>"Technical Analysis Masterclass" on Coursera</span> |
| </li> |
| <li class="flex items-start"> |
| <i class="fas fa-chevron-right text-indigo-500 mt-1 mr-2 text-xs"></i> |
| <span>"Price Action Trading Strategies" on YouTube</span> |
| </li> |
| </ul> |
| </div> |
| |
| <div class="bg-gray-50 p-6 rounded-lg border border-gray-200"> |
| <div class="text-indigo-600 text-4xl mb-4"> |
| <i class="fas fa-tools"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-3">Practice Tools</h3> |
| <ul class="space-y-2 text-gray-600"> |
| <li class="flex items-start"> |
| <i class="fas fa-chevron-right text-indigo-500 mt-1 mr-2 text-xs"></i> |
| <span>TradingView charting platform</span> |
| </li> |
| <li class="flex items-start"> |
| <i class="fas fa-chevron-right text-indigo-500 mt-1 mr-2 text-xs"></i> |
| <span>MetaTrader 4/5 with demo account</span> |
| </li> |
| <li class="flex items-start"> |
| <i class="fas fa-chevron-right text-indigo-500 mt-1 mr-2 text-xs"></i> |
| <span>Investopedia's stock simulator</span> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| </section> |
|
|
| |
| <footer class="bg-black text-white py-12"> |
| <div class="container mx-auto px-4"> |
| <div class="grid md:grid-cols-4 gap-8"> |
| <div> |
| <h3 class="text-xl font-bold mb-4">CandleMaster</h3> |
| <p class="text-gray-400"> |
| Your comprehensive guide to mastering candlestick patterns and technical analysis. |
| </p> |
| </div> |
| <div> |
| <h4 class="font-semibold mb-4">Quick Links</h4> |
| <ul class="space-y-2 text-gray-400"> |
| <li><a href="#basics" class="hover:text-white transition">Basics</a></li> |
| <li><a href="#patterns" class="hover:text-white transition">Patterns</a></li> |
| <li><a href="#quiz" class="hover:text-white transition">Quiz</a></li> |
| <li><a href="#resources" class="hover:text-white transition">Resources</a></li> |
| </ul> |
| </div> |
| <div> |
| <h4 class="font-semibold mb-4">Contact</h4> |
| <ul class="space-y-2 text-gray-400"> |
| <li class="flex items-center"> |
| <i class="fas fa-envelope mr-2"></i> |
| <span>contact@candlemaster.com</span> |
| </li> |
| <li class="flex items-center"> |
| <i class="fas fa-phone mr-2"></i> |
| <span>+1 (555) 123-4567</span> |
| </li> |
| </ul> |
| </div> |
| <div> |
| <h4 class="font-semibold mb-4">Follow Us</h4> |
| <div class="flex space-x-4"> |
| <a href="#" class="text-gray-400 hover:text-white transition text-xl"> |
| <i class="fab fa-twitter"></i> |
| </a> |
| <a href="#" class="text-gray-400 hover:text-white transition text-xl"> |
| <i class="fab fa-facebook"></i> |
| </a> |
| <a href="#" class="text-gray-400 hover:text-white transition text-xl"> |
| <i class="fab fa-instagram"></i> |
| </a> |
| <a href="#" class="text-gray-400 hover:text-white transition text-xl"> |
| <i class="fab fa-linkedin"></i> |
| </a> |
| </div> |
| </div> |
| </div> |
| <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-400"> |
| <p>© 2023 CandleMaster. All rights reserved.</p> |
| </div> |
| </div> |
| </footer> |
|
|
| <script> |
| |
| const quizData = [ |
| { |
| question: "What does a hammer candlestick pattern typically indicate?", |
| options: [ |
| "A continuation of the current downtrend", |
| "A potential bullish reversal after a downtrend", |
| "Market indecision with no clear direction", |
| "A strong bearish signal in an uptrend" |
| ], |
| answer: 1, |
| explanation: "The hammer is a bullish reversal pattern that forms after a price decline. It signals that the market is rejecting lower prices." |
| }, |
| { |
| question: "Which of these is a bearish reversal pattern?", |
| options: [ |
| "Hammer", |
| "Morning Star", |
| "Shooting Star", |
| "Bullish Engulfing" |
| ], |
| answer: 2, |
| explanation: "The shooting star is a bearish reversal pattern with a small lower body and long upper wick, appearing after an uptrend." |
| }, |
| { |
| question: "What does a doji candlestick represent?", |
| options: [ |
| "Strong bullish momentum", |
| "Strong bearish momentum", |
| "Market indecision", |
| "Continuation of the current trend" |
| ], |
| answer: 2, |
| explanation: "A doji occurs when opening and closing prices are virtually equal, showing that buyers and sellers are in equilibrium and the market is indecisive." |
| }, |
| { |
| question: "Which pattern consists of three candles and signals a bullish reversal?", |
| options: [ |
| "Hanging Man", |
| "Evening Star", |
| "Morning Star", |
| "Shooting Star" |
| ], |
| answer: 2, |
| explanation: "The morning star is a three-candle bullish reversal pattern that appears after a downtrend, consisting of a long red candle, a small-bodied candle, and a long green candle." |
| }, |
| { |
| question: "What is the key characteristic of an engulfing pattern?", |
| options: [ |
| "Small body with long wicks on both sides", |
| "The second candle completely engulfs the body of the first", |
| "Three consecutive candles moving in the same direction", |
| "A candle with no wicks at all" |
| ], |
| answer: 1, |
| explanation: "An engulfing pattern is a two-candle reversal pattern where the body of the second candle completely covers (engulfs) the body of the first candle." |
| } |
| ]; |
| |
| const questionEl = document.getElementById('question'); |
| const optionsEl = document.getElementById('options'); |
| const resultEl = document.getElementById('result'); |
| const resultTextEl = document.getElementById('result-text'); |
| const prevBtn = document.getElementById('prev-btn'); |
| const nextBtn = document.getElementById('next-btn'); |
| const submitBtn = document.getElementById('submit-btn'); |
| const quizContainer = document.getElementById('quiz-container'); |
| const quizComplete = document.getElementById('quiz-complete'); |
| const scoreEl = document.getElementById('score'); |
| const totalQuestionsEl = document.getElementById('total-questions'); |
| const restartQuizBtn = document.getElementById('restart-quiz'); |
| |
| let currentQuestion = 0; |
| let score = 0; |
| let selectedAnswers = Array(quizData.length).fill(null); |
| |
| function loadQuestion(questionIndex) { |
| const question = quizData[questionIndex]; |
| questionEl.textContent = question.question; |
| |
| optionsEl.innerHTML = ''; |
| question.options.forEach((option, index) => { |
| const optionElement = document.createElement('label'); |
| optionElement.className = 'flex items-center space-x-3 p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer'; |
| |
| const radio = document.createElement('input'); |
| radio.type = 'radio'; |
| radio.name = 'answer'; |
| radio.value = index; |
| radio.className = 'h-4 w-4 text-indigo-600'; |
| if (selectedAnswers[questionIndex] === index) { |
| radio.checked = true; |
| } |
| |
| optionElement.appendChild(radio); |
| optionElement.appendChild(document.createTextNode(option)); |
| optionsEl.appendChild(optionElement); |
| }); |
| |
| prevBtn.disabled = questionIndex === 0; |
| nextBtn.style.display = questionIndex === quizData.length - 1 ? 'none' : 'block'; |
| submitBtn.style.display = questionIndex === quizData.length - 1 ? 'block' : 'none'; |
| |
| resultEl.classList.add('hidden'); |
| } |
| |
| function showResult(isCorrect, explanation) { |
| resultEl.classList.remove('hidden'); |
| if (isCorrect) { |
| resultEl.className = 'p-4 mb-6 rounded-lg bg-green-100 text-green-800'; |
| resultTextEl.textContent = 'Correct! ' + explanation; |
| } else { |
| resultEl.className = 'p-4 mb-6 rounded-lg bg-red-100 text-red-800'; |
| resultTextEl.textContent = 'Incorrect. ' + explanation; |
| } |
| } |
| |
| function showQuizComplete() { |
| quizContainer.style.display = 'none'; |
| quizComplete.style.display = 'block'; |
| scoreEl.textContent = score; |
| totalQuestionsEl.textContent = quizData.length; |
| } |
| |
| function restartQuiz() { |
| currentQuestion = 0; |
| score = 0; |
| selectedAnswers = Array(quizData.length).fill(null); |
| quizContainer.style.display = 'block'; |
| quizComplete.style.display = 'none'; |
| loadQuestion(0); |
| } |
| |
| function checkAnswer() { |
| const selectedOption = document.querySelector('input[name="answer"]:checked'); |
| if (!selectedOption) return false; |
| |
| const answer = parseInt(selectedOption.value); |
| selectedAnswers[currentQuestion] = answer; |
| |
| const isCorrect = answer === quizData[currentQuestion].answer; |
| if (isCorrect && selectedAnswers[currentQuestion] !== quizData[currentQuestion].answer) { |
| score++; |
| } |
| |
| showResult(isCorrect, quizData[currentQuestion].explanation); |
| return isCorrect; |
| } |
| |
| prevBtn.addEventListener('click', () => { |
| currentQuestion--; |
| loadQuestion(currentQuestion); |
| }); |
| |
| nextBtn.addEventListener('click', () => { |
| if (checkAnswer() || selectedAnswers[currentQuestion] !== null) { |
| currentQuestion++; |
| loadQuestion(currentQuestion); |
| } else { |
| alert('Please select an answer before proceeding.'); |
| } |
| }); |
| |
| submitBtn.addEventListener('click', () => { |
| checkAnswer(); |
| showQuizComplete(); |
| }); |
| |
| restartQuizBtn.addEventListener('click', restartQuiz); |
| |
| |
| loadQuestion(0); |
| |
| |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { |
| anchor.addEventListener('click', function (e) { |
| e.preventDefault(); |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ |
| behavior: 'smooth' |
| }); |
| }); |
| }); |
| </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=StevenGrant10/candlestick-pattern-guide" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> |
| </html> |