Specification
STRATEGY :
Here’s a comprehensive specification document in English for developing your NinjaTrader bid/ask imbalance indicator:
---
### Bid/Ask Imbalance Indicator for NinjaTrader: Full Specifications
#### **Objective**The goal is to develop a custom bid/ask imbalance indicator for NinjaTrader 8. The indicator will calculate and visualize bid/ask imbalances in real-time and on historical tick data using Tick Replay. It will display geometric shapes based on the imbalance ratio, draw horizontal bands for stacked imbalances, and generate alerts when price interacts with these bands.
---
### Functional Requirements
#### 1. Data Input:
- The indicator must use both real-time and historical tick data with Tick Replay enabled. - It should not rely on NinjaTrader’s OrderFlow subscription to access bid/ask data.
#### 2. Imbalance Calculation:
- Calculate imbalances by comparing the volume of bids against the volume of asks at each price level. - Imbalances should be triggered when the ratio between bid and ask volume surpasses certain user-defined thresholds (e.g., 1:2, 1:3, 1:4, etc.).
- The ratio should be configurable by the user through the indicator’s settings.
#### 3. Geometric Shape Visualization: - When an imbalance is detected, a small geometric figure will be displayed on the chart beside the corresponding price candle.
- 1:2 Imbalance Ratio – Draw a triangle. - 1:3 Imbalance Ratio – Draw a square.
- 1:4 Imbalance Ratio – Draw a hexagon. - 1:5 Imbalance Ratio – Draw a circle.
- The color of the shape should change based on whether the imbalance is a buy imbalance (ask > bid) or a sell imbalance (bid > ask). - Example: Green for buy imbalances and Red for sell imbalances (user configurable).
- Shapes must be small but visible, placed next to the relevant candle in the price chart.
#### 4. Stacked Imbalance Bands: - When consecutive imbalances are detected at different price levels, the indicator will draw horizontal bands across the price range where the stacked imbalances occurred.
- The bands should cover the price levels of all the imbalances that are stacked together. - These bands should persist on the chart and remain visible until price breaks through or interacts with them.
#### 5. Alerts:
- The indicator must generate alerts (both visual and/or audible) when the current price touches or crosses a band formed by previous stacked imbalances. - Alerts should be optional and configurable, allowing the user to activate or deactivate them.
#### 6. Configurable Parameters:
- Users should be able to customize the following settings:
- Imbalance ratio thresholds for geometric shapes (e.g., change the default 1:2 to another value). - Colors for buy and sell imbalance shapes.
- Enable/disable stacked imbalance bands. - Alert settings (enable/disable, type of alert).
#### 7. Performance Considerations:
- The indicator should be optimized for high-performance, capable of handling both real-time data and large historical tick datasets without significant lag. - The calculation process must handle tick data efficiently, especially when running with Tick Replay.
#### 8. Compatibility:
- The indicator will be compatible with NinjaTrader 8 and function independently, without relying on other external indicators or NinjaTrader add-ons. - The indicator should be usable on any instrument available in NinjaTrader (stocks, futures, etc.).
---
### Technical Requirements
#### 1. NinjaScript Framework:
- The indicator must be built using NinjaScript (the NinjaTrader 8 scripting language), leveraging built-in methods for data access, tick replay, and chart visualization.
#### 2. User Interface: - A configuration panel should be provided where users can easily adjust the customizable parameters (imbalance ratios, shape colors, alert settings).
- The configuration panel should
be accessible via the indicator settings in NinjaTrader.
#### 3. Tick Replay Functionality:
- Ensure the indicator works seamlessly with
Tick Replay enabled, capturing both real-time and historical bid/ask data at the tick level. - The user will need to enable Tick Replay manually from the chart settings in NinjaTrader.
---
### Testing and Validation
#### 1. Data Testing:
- Conduct testing with both real-time data and historical tick data to validate that imbalances are calculated correctly, and shapes are displayed as expected.
#### 2. Visualization: - Ensure geometric shapes (triangle, square, hexagon, circle) are drawn at the correct price levels and positioned next to the corresponding candles.
- Test various imbalance ratios (1:2, 1:3, etc.) to confirm that the correct shapes are shown for each scenario.
#### 3. Stacked Imbalance Bands: - Test the functionality of stacked imbalance bands, ensuring that they are drawn across multiple price levels when consecutive imbalances occur.
- Confirm that alerts are triggered correctly when price interacts with these bands.
#### 4. Performance Optimization: - Validate that the indicator performs efficiently, even with large tick data sets, without significant lag or delays in chart updates.
What you are going to deliver to me :
- NinjaScript Source Code for the bid/ask imbalance indicator.
- User Documentation: - A brief guide explaining how to install and configure the indicator.
- Detailed explanations of configurable parameters (imbalance ratios, alerts, etc.). - Instructions for enabling Tick Replay and running the indicator with historical data.
- Support: - Initial support for bug fixes or minor adjustments after delivery.
This specification provides a clear roadmap for developing the indicator. Let me know if you need further modifications before sending it!
Read All Requirements And Tell Me If You Really Can Do It!!!!