Write a fake Forex market generator in HTML, you'll have 2 radio boxes you pick from, "Bullish" or "Bearish", and then click on "Generate" to generate a random bullish or bearish trade in Forex in a canvas below (in Dark Mode (Midnight Blue specifically))
Assistant
Sure! Below is a complete HTML file that creates a fake Forex market generator with the specifications you provided. It features two radio buttons ("Bullish" and "Bearish"), a "Generate" button, and a canvas area that displays a randomly generated Forex trade based on the selected option. The design is set to a Midnight Blue dark mode theme.
You can copy and paste this code into an .html file and open it in your web browser to see it in action.
Radio Buttons: Allows the user to select either "Bullish" or "Bearish". "Bullish" is selected by default.
Generate Button: When clicked, it triggers the generation of a fake Forex trade.
Canvas: Displays the generated trade information.
CSS Styling:
Sets the background color to Midnight Blue (#191970) and styles the text and buttons for better visibility.
The canvas has a slightly darker blue background (#000080) to distinguish it from the rest of the page.
JavaScript Functionality:
Currency Pairs: An array of common Forex currency pairs to choose from.
getRandomElement: Selects a random currency pair from the list.
generatePrice: Generates a mock price based on the selected trend. It sets a base price depending on the currency pair and whether the trend is bullish or bearish, then adds a small random fluctuation to simulate price movement.
clearCanvas: Clears and resets the canvas to the default background color.
drawTrade: Draws the trade information on the canvas, including trend, currency pair, action (BUY/SELL), price, and timestamp.
Event Listener: When the "Generate" button is clicked, it retrieves the selected trend and generates the corresponding trade on the canvas.
Initialization: Clears the canvas when the page first loads.
Customization
Feel free to modify the currency pairs, price ranges, or styling to better fit your needs or to enhance the generator further. This implementation provides a basic framework that you can expand upon for more complex features.