1-Minute Trading Script Generator
Prompt
Create a trading script designed for making buy and sell decisions on a 1-minute chart timeframe, using the guidelines and scripting framework provided in the supplied documentation link. To complete this task, follow these detailed steps: 1. **Visit the Documentation**: Access the provided documentation link and thoroughly study all relevant sections to understand the available scripting framework, syntax, functions, and financial indicators. 2. **Identify Key Concepts for the Script**: - Extract and note the scripting syntax required. - Identify built-in functions, indicators (e.g., moving averages, RSI), and any specific market data handling methods. - Understand how to set the timeframe specifically to 1-minute charts. 3. **Develop the Trading Script**: - Set up the script environment explicitly for a 1-minute timeframe. - Use technical indicators or market conditions such as simple moving averages crossover or RSI thresholds as buy/sell triggers. - Incorporate logic to process real-time market data efficiently. 4. **Refine and Optimize the Script**: - Follow any best practices mentioned in the documentation to optimize performance and maintainability. - Implement appropriate exception handling and logging as specified. - Test and iteratively refine the script to enhance accuracy and handle edge cases. 5. **Adhere to Legal and Exchange Regulations**: - Ensure the script usage aligns with any compliance or legal requirements discussed in the documentation. # Output Format - Begin the output with a brief comment describing the script's purpose and scope. - Write the complete script using correct syntax and conventions from the documentation. - Include clear, descriptive comments throughout the code to explain logic and facilitate readability. # Notes - Preferably use indicators and functions featured in the documentation to ensure compatibility. - Include error handling and logging functionality to make the script robust and debuggable. - The script should be concise but comprehensive enough to be immediately usable or easily adaptable. # Example ```javascript // Trading script for 1-minute chart buy/sell decisions // Implements a simple moving average crossover strategy // Uses documented functions and syntax for indicator calculation and order execution // [Sample code skeleton based on documented framework] function onTick() { // Calculate moving averages let shortMA = sma(close, 5); let longMA = sma(close, 20); // Check crossover conditions if (shortMA > longMA && !positionOpen) { // Execute buy order buy(); log('Bought at ' + close); } else if (shortMA < longMA && positionOpen) { // Execute sell order sell(); log('Sold at ' + close); } } // Initialize 1-minute timeframe setTimeframe('1m'); // Start script start(onTick); ``` Use this template as a foundation, adapting exact function names and logic according to the documentation details provided. {name: "1-Minute Trading Script Generator", short_description: "Generates a buy/sell trading script for 1-minute charts based on documentation guidelines.", icon: "CodeBracketIcon", category: "programming", tags: ["Trading", "Scripting", "Finance", "1MinuteChart"], should_index: true}
Related Coding Prompts
Write Code
As a seasoned programmer, your task is to write code in [programming language] to [perform action]. The code should be efficient, well-structured, and optimized for performance. Make sure to follow best practices and industry standards while implementing the necessary algorithms and logic to achieve the desired functionality. Test the code thoroughly to ensure it functions as intended and meets all requirements. Additionally, document the code properly for future reference and maintenance.
Debug Code
Act as a seasoned programmer with over 20 years of commercial experience. Analyze the provided [piece of code] that is causing a specific [error]. Your task involves diagnosing the root cause of the error, understanding the context and functionality intended by the code, and proposing a solution to fix the issue. Your analysis should include a step-by-step walkthrough of the code, identification of any bugs or logical mistakes, and a detailed explanation of how to resolve them. Additionally, suggest any improvements or optimizations to enhance the performance, readability, or maintainability of the code based on your extensive experience. Ensure that your solution adheres to best practices in software development and is compatible with the current development environment where the code is being executed.
Do Code Review
As a seasoned programmer with over 20 years of commercial experience, your task is to perform a comprehensive code review on the provided [piece of code]. Your review should meticulously evaluate the code's efficiency, readability, and maintainability. You are expected to identify any potential bugs, security vulnerabilities, or performance issues and suggest specific improvements or optimizations. Additionally, assess the code's adherence to industry standards and best practices. Your feedback should be constructive and detailed, offering clear explanations and recommendations for changes. Where applicable, provide examples or references to support your suggestions. Your goal is to ensure that the code not only functions as intended but also meets high standards of quality and can be easily managed and scaled in the future. This review is an opportunity to mentor and guide less experienced developers, so your insights should be both educational and actionable.