A sophisticated pattern recognition strategy that identifies 7 powerful bullish candlestick formations with Darvas Box-based targets and dynamic risk management.
SevenBullishPatterns is a comprehensive pattern recognition strategy designed for NinjaTrader 8 that automatically identifies and trades seven of the most reliable bullish candlestick formations. The strategy combines classical technical analysis with modern Darvas Box theory to identify optimal entry points with calculated profit targets.
Each pattern is independently configurable with its own position size and risk ratio, allowing traders to customize their exposure based on pattern reliability and market conditions. The strategy supports concurrent positions (up to 50 entries per direction) and features both ATM Strategy integration for live trading and standard managed orders for backtesting.
Recognizes 7 distinct bullish candlestick patterns with precise algorithmic detection
Uses Darvas Box upper levels as dynamic profit targets based on market structure
Choose between 1:2 or 1:3 risk-reward ratio per pattern for customized exposure
Real-time pattern highlighting with unique colors and momentum indicators
The strategy scans for seven distinct bullish candlestick patterns: Hammer, Inverted Hammer, Morning Star, Rising Three Methods, Stick Sandwich, Three White Soldiers, and Upside Tasuki Gap. Each pattern has specific criteria that must be met for signal generation.
Trades are only initiated when the calculated Darvas Box target is above the entry price, ensuring positive risk-reward ratios. Invalid targets (zero or negative distance) are automatically rejected.
Take profit is automatically set at the Darvas Box upper level, which represents a structural resistance point identified by the Darvas indicator. This adapts to market conditions dynamically.
Stop loss is calculated as a fraction of the distance to target. With 1:2 risk ratio, stop is placed at 50% of the target distance below entry. With 1:3 ratio, stop is at 33% of target distance.
In live trading, ATM Strategy templates allow manual modification of stop and target levels via mouse drag, providing flexibility for experienced traders.
Each pattern has an independent order quantity parameter, allowing traders to allocate more capital to higher-probability patterns and less to experimental ones.
The boolean risk parameter determines whether a pattern uses 1:2 (checked) or 1:3 (unchecked) risk-reward ratio, giving precise control over risk exposure per pattern type.
Supports up to 50 concurrent entries per direction, allowing multiple pattern signals to be active simultaneously without conflict.
Comprehensive visual feedback includes pattern-specific bar coloring (retroactive for multi-bar patterns), text labels below bars, and momentum dots with vertical lines when Disparity Index crosses above zero.
Automatically switches between ATM Strategy execution (live trading with manual modification capability) and standard managed orders (backtesting mode) based on current state.
Extensive Print statements provide real-time logging of pattern detection, entry calculations, and order execution for troubleshooting and optimization.
Visual representation of the strategy's decision-making process
This flowchart illustrates the entire decision-making process from strategy initialization through pattern detection, trade execution, and position management.
Detailed breakdown of how each pattern is detected, validated, and executed.
How the strategy calculates risk parameters and manages position sizing for each pattern.
Overview of the visual feedback system and how indicators interact with chart elements.
Detects Hammer, Inverted Hammer, Morning Star, Rising Three Methods, Stick Sandwich, Three White Soldiers, and Upside Tasuki Gap patterns.
Uses the Darvas Box indicator to determine dynamic profit targets based on market structure and resistance levels.
Choose between 1:2 or 1:3 risk-reward ratio for each pattern independently, allowing customized risk management.
Integrates Disparity Index (14) to identify momentum shifts with visual confirmation when crossing above zero.
Supports up to 50 concurrent entries per direction, enabling multiple pattern signals to be active simultaneously.
Live trading uses ATM Strategy templates allowing manual modification of stop and target levels via mouse drag.
Comprehensive visual feedback with retroactive bar coloring for multi-bar patterns and unique colors per pattern type.
Automatically switches between ATM Strategy (live) and managed orders (backtest) based on current trading state.
Extensive logging for troubleshooting and optimization with pattern detection and order execution details.
Complete list of all configurable settings with descriptions and recommended ranges
| Parameter Name | Type | Default | Range | Description | Category |
|---|---|---|---|---|---|
HammerPatternsOrderQty |
int | 1 | 1 - 10000 | Position size (contracts/shares) for Hammer pattern trades. | Trading |
HammerPatternsRisk |
bool | true | true / false | If checked: 1:2 risk-reward ratio. If unchecked: 1:3 ratio. | Risk |
InvertedHammerPatternsOrderQty |
int | 1 | 1 - 10000 | Position size for Inverted Hammer pattern trades. | Trading |
InvertedHammerPatternsRisk |
bool | true | true / false | Risk-reward ratio toggle for Inverted Hammer pattern. | Risk |
MorningStarPatternsOrderQty |
int | 1 | 1 - 10000 | Position size for Morning Star pattern trades. | Trading |
MorningStarPatternsRisk |
bool | true | true / false | Risk-reward ratio toggle for Morning Star pattern. | Risk |
RisingThreesOrderQty |
int | 1 | 1 - 10000 | Position size for Rising Three Methods pattern trades. | Trading |
RisingThreesOrderRisk |
bool | true | true / false | Risk-reward ratio toggle for Rising Three Methods pattern. | Risk |
StickSandwichPatternsOrderQty |
int | 1 | 1 - 10000 | Position size for Stick Sandwich pattern trades. | Trading |
StickSandwichPatternsRisk |
bool | true | true / false | Risk-reward ratio toggle for Stick Sandwich pattern. | Risk |
ThreeWhiteSoldiersPatternsOrderQty |
int | 1 | 1 - 10000 | Position size for Three White Soldiers pattern trades. | Trading |
ThreeWhiteSoldiersPatternsRisk |
bool | true | true / false | Risk-reward ratio toggle for Three White Soldiers pattern. | Risk |
UpsideTasukiGapOrderQty |
int | 1 | 1 - 10000 | Position size for Upside Tasuki Gap pattern trades. | Trading |
UpsideTasukiGapOrderRisk |
bool | true | true / false | Risk-reward ratio toggle for Upside Tasuki Gap pattern. | Risk |
Comprehensive backtesting and live trading results
Strategy performance metrics will be added here in tabulated form
Copy the strategy file to your NinjaTrader installation:
Documents\NinjaTrader 8\bin\Strategies\SevenBullishPatterns.cs
Click the "Enable Strategy" button in the Strategies panel. The strategy will begin scanning for patterns immediately.
| Parameter | Conservative | Moderate | Aggressive |
|---|---|---|---|
| OrderQty | 1 contract | 2-3 contracts | 5+ contracts |
| Risk (all patterns) | false (1:3 ratio) | false (1:3 ratio) | true (1:2 ratio) |
| Platform | NinjaTrader 8 |
| Language | C# / NinjaScript |
| Type | Strategy |
| Calculation Mode | OnBarClose |
| Timeframes | All timeframes supported |
| Recommended TF | H1, H4, Daily |
| Instruments | All NinjaTrader instruments |
| Max Concurrent | 50 per direction |
| Darvas Box | Target calculation |
| Disparity Index | 14 period, momentum |
| Candlestick Pattern | 7 patterns, 4-bar lookback |
| Bars Required | 20 minimum |
| Entry Handling | AllEntries |
| Time in Force | GTC (Good Till Cancel) |
| Exit on Session | 30 seconds delay |
| Start Behavior | WaitUntilFlat |
Full ATM Strategy integration with manual modification support
Standard managed orders for Strategy Analyzer compatibility
Works with futures, forex, stocks, and crypto instruments
For 24/7 operation, VPS hosting is recommended
Trading involves substantial risk of loss and may not be suitable for all investors.
Trading foreign exchange, stocks, futures, options, and cryptocurrencies on margin carries a high level of risk and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade, you should carefully consider your investment objectives, level of experience, and risk appetite. There is a possibility that you could sustain a loss of some or all of your initial investment.
This Strategy is a software tool designed to assist in analyzing market conditions and executing trades based on predefined algorithms. It does not guarantee profits or success. Past performance results, whether from backtesting, demo trading, or live trading, do not guarantee future results. Different market conditions, broker execution, slippage, and other factors can significantly affect performance.
You are fully responsible for all trading decisions made using this Strategy, including:
KeyAlgos provides this Strategy "as is" without any warranties, express or implied. We do not guarantee that the strategy will be error-free, uninterrupted, or that it will meet your requirements.
Have questions about SevenBullishPatterns or interested in custom NinjaTrader development? KeyAlgos provides professional algorithmic trading solutions tailored to your specific needs.