Skip to content
The Chat Archive
o1-mini-2024-09-12· OpenAI WildChat-4.8M (AI2)

PROMPTTEMPLATE9= """# Expert Candlestick Chart Pattern Analyst You are an expert…

  1. User

    PROMPT_TEMPLATE_9= """# Expert Candlestick Chart Pattern Analyst

    You are an expert technical analyst specializing in candlestick chart patterns. Your task is to generate mock candlestick data in JSON format based on a provided strategy description. Follow the detailed steps below to ensure accuracy and precision in your data generation, adapting to any given strategy or market setup.

    Step 1: Strategy Analysis

    1. Carefully read the strategy description: Understand the objectives and elements of the described strategy.
    2. Identify and list the following key components:
      • Setup Name
      • Strategy Type (e.g., Breakout, Reversal, Continuation, Trend Following, Mean Reversion)
      • Timeframe (e.g., Daily, Hourly, 15-minute, 5-minute)
      • Detailed Setup Steps
      • Specific Criteria or Rules (e.g., 2LYNCH criteria, RSI conditions, Moving Average crossovers)
      • Any mentioned indicators or oscillators

    Step 2: Stage Identification and Adaptation

    1. Break down the strategy into distinct stages (e.g., trend formation, consolidation, entry signal, exit signal).
    2. For each stage, determine and list:
      • Exact Number of Candles: If a range is provided, select a specific number within that range. If not specified, use a reasonable number based on the strategy type.
      • Exact Number of Bullish (Green) and Bearish (Red) Candles: Precisely define the count to match the strategy's requirements.
      • Specific Candle Characteristics: (e.g., closing near high, wide ranges, doji candles, engulfing patterns)
      • Volume Trends: Include volume analysis if mentioned in the strategy.
      • Price Action: Describe any specific price movements required (e.g., higher highs, lower lows, sideways movement).
      • Indicator Behavior: If the strategy uses indicators, describe how they should behave during each stage.

    Step 3: Data Generation

    1. Start Date: [Use the provided start date or default to current year, e.g., 2024-01-01]
    2. For each stage:
      • Generate the exact number of candles as determined in Step 2.
      • Ensure the precise number of green and red candles according to the requirements.
      • For each candle:
        • Date: Increment sequentially from the start date.
        • Open: [Previous Close]
        • High: [Max(Open, Close) + Random(0.1% to 2% of price)]
        • Low: [Min(Open, Close) - Random(0.1% to 2% of price)]
        • Close: For bearish candles (red): [Open - Random(0.1% to 2% of price)] For bullish candles (green): [Open + Random(0.1% to 2% of price)]
        • Volume: [Base Volume + Random(-20% to +20%)] adjusted according to the volume trend requirements of each stage.
      • Adjust price movements to reflect the strategy's requirements (e.g., breakouts, pullbacks, consolidations).
      • If required, calculate and include indicator values based on the generated price data.

    Step 4: JSON Compilation

    1. Structure the data in the exact JSON format below:
    {{
      "candlestickData": [
        {{
          "date": "YYYY-MM-DD",
          "open": 100.00,
          "high": 102.00,
          "low": 99.50,
          "close": 101.80,
          "volume": 1000000
        }}
        // ... exact number of data points as specified
      ],
      "indicators": {{
        // Include any relevant indicators mentioned in the strategy
        "sma20": [100.5, 101.2, ...],
        "rsi": [45, 52, ...]
      }},
      "explanation": "Detailed explanation here"
    }}
    ## Step 5: Detailed Explanation Consistent with Final Data
    1. Provide a comprehensive explanation that includes:
       - Total Number of Candles Generated
       - Breakdown of Candles per Stage: (e.g., 7 candles for trend formation: 5 green, 2 red)
       - Accuracy of Bullish and Bearish Candle Counts per Stage
       - How Each Stage Represents the Strategy Requirements
       - Any Specific Patterns or Characteristics Implemented
       - Indicator Behavior and Significance (if applicable)
       - Key Entry and Exit Points Based on the Strategy
       - Ensure that all details in the explanation exactly match the attributes of the generated candlestick data.
    
    ## Step 6: Data Validation
    1. Review the generated data to ensure:
       - Correct Total Number of Candles
       - Accurate Number of Bullish and Bearish Candles per Stage
       - Logical Price Movements: (e.g., High > Open, Close > Low)
       - Volume Trends Align with Strategy Requirements
       - Indicator Values (if included) are Consistent with Price Movements
       - The Data Accurately Reflects All Aspects of the Given Strategy
    
    ## Step 7: Data Correction
    1. If the mock data does not meet the specified requirements after validation:
       - Identify the discrepancies: Determine which aspects of the data are incorrect (e.g., incorrect number of candles, wrong candle colors, illogical price movements, misaligned indicator values).
       - Adjust the data accordingly:
         - Modify Candle Counts: Add or remove candles to match the exact number required.
         - Correct Candle Colors: Change the color of candles by adjusting the close prices appropriately.
         - Fix Price Movements: Ensure all price fields adhere to logical constraints and strategy requirements.
         - Recalculate Volumes: Adjust volume values to align with the specified volume trends.
         - Update Indicator Values: Recalculate any indicator values to ensure they match the adjusted price data.
       - Re-validate the corrected data: Ensure that all modifications now meet the original requirements and strategy specifications.
       - Update the Explanation: Regenerate the detailed explanation in Step 5 to accurately reflect the corrected data.
    
    ## Step 8: Final Data Confirmation
    1. Perform a final review to ensure all data is accurate and compliant:
       - Double-check candle counts, colors, and patterns.
       - Ensure all price movements are logical and align with the strategy.
       - Verify volume trends align with strategy requirements.
       - Confirm indicator values (if present) are correct and meaningful.
       - Ensure the JSON structure is correct and free of errors.
       - Confirm the explanation fully matches the final data and accurately describes how the data represents the given strategy.
    
    ##Execution
    Given this strategy description: {description}
    Follow each step meticulously, providing your thought process for each step. Ensure exact compliance with the strategy's requirements for candle numbers, characteristics, and any specific patterns or indicators mentioned.
    Adapt the data generation process as needed to accurately represent the given strategy."""
    Làm sao cải tiến prompt này để giá đầu vào phản ánh thực tế!
    
  2. Assistant

    To enhance the PROMPT_TEMPLATE_9 so that the generated candlestick data more accurately reflects real-world market behaviors, consider the following improvements. These modifications aim to introduce greater realism in price movements, volatility, and other market dynamics.

    1. Incorporate Realistic Price Dynamics

    a. Use of Volatility Measures

    Introduce volatility measures such as Average True Range (ATR) or standard deviation to determine price movements more realistically.

    Modification Example:

    - High: [Max(Open, Close) + Random(0.5% to ATR% of price)]
    - Low: [Min(Open, Close) - Random(0.5% to ATR% of price)]
    - Close:
      For bearish candles (red): [Open - Random(0.5% to ATR% of price)]
      For bullish candles (green): [Open + Random(0.5% to ATR% of price)]
    

    b. Price Gaps and Wicks

    Allow for the possibility of price gaps and varying wick sizes to mimic real market conditions.

    Modification Example:

    - Include a probability factor for gaps at the opening price based on overnight news or events.
    - Vary wick sizes using a realistic distribution (e.g., small wicks are more common than large ones).
    

    2. Enhance Volume Realism

    a. Volume Patterns

    Incorporate realistic volume patterns such as increasing volume during breakouts or decreasing volume during consolidations.

    Modification Example:

    - Volume Trends:
      - During uptrends: Gradually increasing volume.
      - During downtrends: Gradually decreasing volume.
      - During consolidation: Fluctuating volume within a narrow range.
    

    b. Volume Distribution

    Use a distribution that reflects how volume typically behaves, avoiding uniform randomness.

    Modification Example:

    - Volume: [Base Volume * (1 + NormalDistribution(mean=0, std=0.2))]
    

    3. Integrate Market Regimes

    a. Bullish and Bearish Phases

    Define different market regimes (e.g., bullish, bearish, sideways) and generate price data accordingly.

    Modification Example:

    - Define periods of different market regimes within the data generation process.
    - Adjust candle characteristics based on the current regime.
    

    4. Utilize Historical Data Patterns

    a. Pattern-Based Generation

    Incorporate common historical price patterns (e.g., head and shoulders, double tops/bottoms) to guide candle generation.

    Modification Example:

    - Introduce specific sequences of candles that reflect well-known chart patterns.
    - Adjust price movements to form these patterns accurately.
    

    5. Refine Indicator Calculations

    a. Dynamic Indicator Parameters

    Ensure that indicators are calculated using realistic parameters and respond appropriately to the generated price data.

    Modification Example:

    - Calculate indicators like SMA, EMA, RSI based on the generated close prices using standard formulas.
    - Ensure indicator values reflect realistic market conditions (e.g., RSI oscillates between 30 and 70 in trending markets).
    

    6. Add Calendar and Time-Based Considerations

    a. Market Hours and Holidays

    Respect market hours and account for non-trading days such as weekends and holidays.

    Modification Example:

    - Increment dates by trading days only, skipping weekends and recognized market holidays.
    

    7. Enhance Error Handling and Data Validation

    a. Advanced Validation Rules

    Implement more comprehensive validation rules to ensure data integrity and realism.

    Modification Example:

    - Ensure no overlapping price ranges (e.g., Low < Previous Low, High > Previous High where appropriate).
    - Validate that volume spikes correspond with significant price movements.
    

    8. Provide Configurable Parameters

    a. User-Defined Settings

    Allow users to define parameters such as volatility levels, average volume, and trend strength to tailor the mock data to specific market conditions.

    Modification Example:

    - Introduce placeholders for user-defined parameters:
      - `{volatility_level}`: Controls the range of price movements.
      - `{average_volume}`: Sets the base volume level.
      - `{trend_strength}`: Determines the persistence of trends.
    

    9. Sample Revised Prompt

    Incorporating the above enhancements, here's a revised version of your prompt template:

    # Expert Candlestick Chart Pattern Analyst
    
    You are an expert technical analyst specializing in candlestick chart patterns. 
    Your task is to generate mock candlestick data in JSON format based on a provided strategy description. 
    Follow the detailed steps below to ensure accuracy and precision in your data generation, adapting to any given strategy or market setup.
    
    ## Step 1: Strategy Analysis
    1. Carefully read the strategy description: Understand the objectives and elements of the described strategy.
    2. Identify and list the following key components:
       - Setup Name
       - Strategy Type (e.g., Breakout, Reversal, Continuation, Trend Following, Mean Reversion)
       - Timeframe (e.g., Daily, Hourly, 15-minute, 5-minute)
       - Detailed Setup Steps
       - Specific Criteria or Rules (e.g., 2LYNCH criteria, RSI conditions, Moving Average crossovers)
       - Any mentioned indicators or oscillators
    
    ## Step 2: Stage Identification and Adaptation
    1. Break down the strategy into distinct stages (e.g., trend formation, consolidation, entry signal, exit signal).
    2. For each stage, determine and list:
       - Exact Number of Candles: If a range is provided, select a specific number within that range. If not specified, use a reasonable number based on the strategy type.
       - Exact Number of Bullish (Green) and Bearish (Red) Candles: Precisely define the count to match the strategy's requirements.
       - Specific Candle Characteristics: (e.g., closing near high, wide ranges, doji candles, engulfing patterns)
       - Volume Trends: Include volume analysis if mentioned in the strategy, such as increasing volume during breakouts or decreasing during consolidations.
       - Price Action: Describe any specific price movements required (e.g., higher highs, lower lows, sideways movement), incorporating realistic volatility measures.
       - Indicator Behavior: If the strategy uses indicators, describe how they should behave during each stage, ensuring realistic indicator calculations.
    
    ## Step 3: Data Generation
    1. Start Date: [Use the provided start date or default to current year, e.g., 2024-01-01]
    2. For each stage:
       - Generate the exact number of candles as determined in Step 2.
       - Ensure the precise number of green and red candles according to the requirements.
       - For each candle:
         + Date: Increment sequentially by trading days, skipping weekends and recognized market holidays.
         + Open: [Previous Close]
         + High: [Max(Open, Close) + Random(0.5% to ATR% of price)]
         + Low: [Min(Open, Close) - Random(0.5% to ATR% of price)]
         + Close:
           For bearish candles (red): [Open - Random(0.5% to ATR% of price)]
           For bullish candles (green): [Open + Random(0.5% to ATR% of price)]
         + Volume: [Base Volume * (1 + NormalDistribution(mean=0, std=0.2))] adjusted according to the volume trend requirements of each stage.
       - Incorporate realistic volatility by calculating ATR based on previous candles.
       - Introduce price gaps and varying wick sizes based on realistic probabilities.
       - Adjust price movements to reflect the strategy's requirements (e.g., breakouts, pullbacks, consolidations).
       - If required, calculate and include indicator values based on the generated price data using standard formulae.
    
    ## Step 4: JSON Compilation
    1. Structure the data in the exact JSON format below:
    
    ```json
    {
      "candlestickData": [
        {
          "date": "YYYY-MM-DD",
          "open": 100.00,
          "high": 102.00,
          "low": 99.50,
          "close": 101.80,
          "volume": 1000000
        }
        // ... exact number of data points as specified
      ],
      "indicators": {
        // Include any relevant indicators mentioned in the strategy
        "sma20": [100.5, 101.2, ...],
        "rsi": [45, 52, ...]
      },
      "explanation": "Detailed explanation here"
    }
    

    Step 5: Detailed Explanation Consistent with Final Data

    1. Provide a comprehensive explanation that includes:
      • Total Number of Candles Generated
      • Breakdown of Candles per Stage: (e.g., 7 candles for trend formation: 5 green, 2 red)
      • Accuracy of Bullish and Bearish Candle Counts per Stage
      • How Each Stage Represents the Strategy Requirements
      • Any Specific Patterns or Characteristics Implemented
      • Indicator Behavior and Significance (if applicable)
      • Key Entry and Exit Points Based on the Strategy
      • Ensure that all details in the explanation exactly match the attributes of the generated candlestick data.

    Step 6: Data Validation

    1. Review the generated data to ensure:
      • Correct Total Number of Candles
      • Accurate Number of Bullish and Bearish Candles per Stage
      • Logical Price Movements: (e.g., High > Open, Close > Low)
      • Volume Trends Align with Strategy Requirements
      • Indicator Values (if included) are Consistent with Price Movements
      • The Data Accurately Reflects All Aspects of the Given Strategy

    Step 7: Data Correction

    1. If the mock data does not meet the specified requirements after validation:
      • Identify the discrepancies: Determine which aspects of the data are incorrect (e.g., incorrect number of candles, wrong candle colors, illogical price movements, misaligned indicator values).
      • Adjust the data accordingly:
        • Modify Candle Counts: Add or remove candles to match the exact number required.
        • Correct Candle Colors: Change the color of candles by adjusting the close prices appropriately.
        • Fix Price Movements: Ensure all price fields adhere to logical constraints and strategy requirements.
        • Recalculate Volumes: Adjust volume values to align with the specified volume trends.
        • Update Indicator Values: Recalculate any indicator values to ensure they match the adjusted price data.
      • Re-validate the corrected data: Ensure that all modifications now meet the original requirements and strategy specifications.
      • Update the Explanation: Regenerate the detailed explanation in Step 5 to accurately reflect the corrected data.

    Step 8: Final Data Confirmation

    1. Perform a final review to ensure all data is accurate and compliant:
      • Double-check candle counts, colors, and patterns.
      • Ensure all price movements are logical and align with the strategy.
      • Verify volume trends align with strategy requirements.
      • Confirm indicator values (if present) are correct and meaningful.
      • Ensure the JSON structure is correct and free of errors.
      • Confirm the explanation fully matches the final data and accurately describes how the data represents the given strategy.

    Execution

    Given this strategy description: {description} Follow each step meticulously, providing your thought process for each step. Ensure exact compliance with the strategy's requirements for candle numbers, characteristics, and any specific patterns or indicators mentioned. Adapt the data generation process as needed to accurately represent the given strategy.

    
    ## 10. Additional Recommendations
    
    - **Incorporate Trend Strength Indicators:** Use metrics like the ADX (Average Directional Index) to determine the strength of trends during data generation.
      
    - **Simulate Market Events:** Occasionally introduce events like economic news releases that can cause sudden price spikes or drops to mimic real market scenarios.
    
    - **Ensure Correlation Between Indicators and Price Movements:** Indicators should logically follow from the price data. For example, during an uptrend, moving averages should slope upwards, and RSI should reflect bullish momentum.
    
    - **Use Seeded Randomness for Reproducibility:** Incorporate a seed for random number generation to allow reproducibility of the mock data when needed.
    
    - **Validate Against Historical Data Patterns:** Compare generated patterns with historical data to ensure plausibility. This can include verifying that candle patterns occur with realistic frequencies.
    
    By implementing these enhancements, the generated candlestick data will better mirror the complexities and nuances of real market behavior, providing a more reliable foundation for testing and analysis based on the provided trading strategy.