Stacked Imbalances Strategy
Created 07 Jan 2024
·
Updated 24 Jan 2025
The Stacked Imbalances Strategy is a Premium mechanical strategy for the NinjaTrader 8 platform. It's a full-auto strategy that can run on autopilot, while its built-in command buttons let you extend or override it manually. The strategy can be used to pass propfirm evaluation challenges.
Prerequisites
To properly use this strategy you should have the following prerequisites available.
- NinjaTrader 8, with any license type. Click here to download
- An OrderFlow-enabled NinjaTrader account, obtained either by purchasing a lifetime NinjaTrader license or through a license provided by a trader funding program.
- An automated-trading.ch account with an active Premium Subscription
Important Disclaimer
We strongly recommend that you never run your algorithmic trading systems on your hard-earned real money. You should always minimize your risk and run your strategies on trader funding programs, so the maximum amount you risk losing is the monthly subscription fee you pay those programs.
The Stacked Imbalances strategy is both a trend-following and a reversal strategy, based on the assumption that stacked volume imbalances are a symptom of inherent inefficiencies in market microstructure.
The strategy implements multiple imbalance-based entry setups:
- Trend Mode: enters long when an ask-side stacked imbalance occurs, or short when a bid-side stacked imbalance occurs
- Reversal Mode: enters long when trapped sellers are detected on a long price reversal, or short when trapped buyers are detected on a short price reversal
- Auto Mode: automatically switches between Trend and Reversal modes based on the prior day's Volume Profile in relation to current price action
The strategy aims to be profitable long-term by generating a positive expected return from a win/loss ratio higher than 1. It can be used on a price-based bar type (Range or Tick bars) or a time-based bar type — see the Performance Reports section for suggested settings on different instruments.
Entry Setup Examples
Entering Long on Trend Continuation Mode
The strategy detects an ask-side stacked imbalance which arms it to go long, then waits for price-action follow-through to execute the trade — e.g. a candle closing above the previous candle's high. In one such example, the trade was executed with a $100 stop loss/take profit and a quantity of 2 contracts on MES.
Entering Trades on Reversal Mode
When Stacked Imbalances Entry Mode is set to Reversal, a buy-side stacked imbalance triggers a short entry, and a sell-side stacked imbalance triggers a long entry — e.g. a long entry following a bid-side stacked imbalance and a confirmation candle, profitable because the imbalance reflected high-volume buy limit orders taking profit after a bearish trend before price reversed up.
Entering Long on a Trapped-Sellers Signal
With only the Trapped Traders setup enabled, a bid-side stacked imbalance on a green candle (aggressive selling being trapped, or a large volume of buy limit orders at that level) arms the strategy; a follow-through candle confirms the entry. One such setup produced a profitable long trade with 2 contracts and a $100 1:1 take profit/stop loss on MCL.
"Dollar Cost Averaging" Order Management in Action
When DCA is used as the order management strategy, the position's quantity is increased at each closing candle in the winning direction, aiming to reach breakeven and close the position early at breakeven or slightly in profit. This doesn't always work — sometimes the stop loss is hit earlier than the take profit due to the increased quantity, resulting in an early loss exit. Extensive backtesting across market regimes, instruments, and timeframes is recommended to understand this method's long-term impact.
Strong Imbalance Signal but No Follow-Through
A strong sell-side stacked imbalance can arm a short entry, but without confirming price action (price instead continues upward), the short signal is canceled — illustrating why follow-through price action matters, rather than showing an actual trade.
Features
The Stacked Imbalances strategy has a set of unique features:
- Performant, in-house-developed imbalances detection engine
- No pending orders are placed — only market orders
- Full-auto strategy that can be scaled into multiple instances
- Can be run as a semi-auto strategy using the automated trading interface on the Chart panel
- Precise backtesting capabilities following NinjaTrader's official best practices, achieving precise entry/exit backtesting at the tick level
- A robust in-house order management library, resistant to connection loss, that works seamlessly on Rithmic accounts or NinjaTrader brokerage accounts
Parameters
We try to keep the parameters to a minimum — only the most important are exposed.
| General | |
| Execute Historical Trades | Should be checked whenever the strategy runs in Historical, Backtest, or Optimization modes, and unchecked when running Live Real-Time. |
| Daily TakeProfit Target | The strategy stops for the day once daily realized profit reaches this amount. Ignored when set to 0. |
| Weekly TakeProfit Target | The strategy stops for the week once this weekly take-profit amount is reached after closing a position. Resets at the start of each new week. Ignored when set to 0. |
| Daily StopLoss Limit | The strategy stops for the day once the daily loss limit is reached after closing a position (positive value — e.g. 300 stops trading once realized PnL ≤ -$300). Ignored when set to 0. |
| Stop @ Winning Count | Stops trading for the day once the net winning-trade count reaches this value. Ignored when set to 0. |
| Stop @ Losing Count | Stops trading for the day once the net losing-trade count reaches this value. Ignored when set to 0. |
| Swings Period | Sets how many bars are enough to separate two swings of the same type. The higher this value, the fewer swings overall; the lower, the more. A value of 3 or 4 is typical. |
| Draw Price Swings | Enables/disables drawing swings on the chart. Swings are always analyzed and processed regardless of this parameter, which only affects visibility. |
| Buy Imbalances Color / Sell Imbalances Color | Color of bullish/bearish stacked imbalance zones drawn on the chart. |
| Execute on Micros | Executes trades on a different instrument than the active chart's — e.g. run logic on Minis but execute on Micros to better manage risk. All risk calculation happens on the execution instrument. |
| Execution Instrument | Choose from a list of Micros available on your NinjaTrader connection as the instrument trades execute on. Historical and live trades won't be drawn on the chart in this case. |
| Entry Setup | |
| Time Zone |
The time zone used for the Trade Time parameter below. Futures markets operate on US Eastern time (EST), so this lets you specify the trading interval relative to your own machine's time zone instead.
|
| Trade Time | Specifies the time interval(s) in which the strategy is allowed to place trades — e.g. 09:30-16:15 for RTH in EST, or 00:01-08:00,09:55-15:55,18:01-23:59 to cover RTH and ETH while excluding volatile periods. Intervals must be listed in increasing order (even the one spanning midnight into the next session) and are cut at midnight to avoid issues stepping into a new day. |
| Quantity Strategy |
|
| Max Qty | Maximum allowed quantity when Risk Adjusted is selected — useful since some prop firms enforce order-quantity limits that can invalidate an account. |
| Trade Entry Mode |
|
| Order Qty | Quantity per trade when Quantity Strategy is Fixed — also used for each quantity increase if the order management mechanism scales in. |
| Enable Trapped Traders Entry | Enables/disables entering on trapped-traders signals — a stacked imbalance on a reversal candle followed by a follow-through price break above/below the imbalance candle's high/low. |
| Enable Stacked Imbalances Entry | Enables/disables the trend-following entry signal — a stacked imbalance followed by the same kind of follow-through. |
| Stacked Imbalances Entry Mode |
Sets the trade entry mode for Enable Stacked Imbalances Entry.
|
| VWAP Filter | Enables/disables a VWAP filter for entries — long entries require price above VWAP, short entries require price below VWAP. |
| Swing Filter |
Enables/disables a swing trend filter for entries, analyzing consecutive swing pivots.
|
| Imbalances | |
| Min Imbalance Ratio | Minimum ratio between the diagonal bid/ask volumes to consider an imbalance. |
| Min Imbalance Volume | Minimum volume value on the strong side (bid/ask) to consider an imbalance. |
| Max Imbalance Gap (Ticks) | Gap tolerance between stacked imbalance levels — imbalances that aren't perfectly stacked (with tick gaps between them) still count as a cluster if this parameter is higher than one. |
| Min Stacked Imbalance Count | Minimum number of imbalances in a cluster of stacked imbalances — generally 3 or more. |
| Order Management | |
| Order Management Strategy |
|
| ATM Strategy Template Name | Only used with the ATM Strategy order management method — the exact template name of your custom ATM strategy, shown in a drop-down of available templates. |
| On Opposite Signal |
|
| StopLoss Strategy |
|
| TakeProfit Strategy |
|
| Target Risk Per Trade ($) | Maximum risk, in dollars, per position — used before opening a trade to verify the calculated stop loss respects this limit; if not, the trade is skipped. |
| Max Allowed Risk Per ($) | Only used with Risk Adjusted quantity — controls how far the real calculated risk is allowed to deviate from the Target Risk (since an exact match is rarely possible). |
| Stop Loss Points | Available when the Stop Loss strategy is set to Points. |
| Stoploss offset Points | Adds an offset, in points, to the calculated stop loss level — used when computing risk per trade. |
| Take Profit Currency | The take-profit amount in dollars, used when the Fixed Currency Value strategy is selected. If not, set it high enough that it doesn't interfere with the ratio-based strategies. |
| Enable Price Breakeven | Enables/disables the price-based breakeven mechanism. |
| Price Breakeven Strategy |
|
| Price Breakeven Trigger | Available if price-based breakeven is enabled — the trigger value (in points, or a percentage from 1-100) needed to move the stop loss to breakeven. |
| Enable Time Breakeven | Enables/disables a time-based (minutes) breakeven mechanism. |
| Time Breakeven Trigger (Minutes) | Available if time-based breakeven is enabled — the number of minutes needed to move the stop loss to breakeven. |
| Trailing Stop Parameters | |
| Trailing Stop Strategy |
Used with the Classic Trail Stop order management method.
|
| Trailing Stop Trigger | The trigger (in points or ratio) for the Classic Trail Stop method. |
| Trail Amount | The amount (in points or ratio) trailed once the trigger is hit. |
| DCA (Grid) Parameters | |
| Breakeven Profit Shift | Used with the DCA order management method — adds a small amount of profit to the breakeven definition, to help cover commission costs when closing the grid at breakeven. |
| Grid Size to Breakeven | Used with the DCA order management method — the number of order increases required before considering closing the position at breakeven. |
| Command Buttons | |
| The strategy exposes manual command buttons on the Chart Trader panel — make sure it's displayed on your active chart. | |
| Arm/Disarm Buttons | Manually enable/disable entering long or short trades — useful if you have a directional bias. |
| Entry Mode Switch Button | Switches the strategy's entry mode between Trend and Reversal. |
| Close Position Button | Immediately flattens the position on the active instrument without restarting the strategy, which keeps looking for new trades afterward. |
| Increase Qty Button | Increases the current active position's quantity by the amount set in Order Qty — useful to manually dollar-cost-average or double down after a winning-side confirmation signal. |
Performance Reports
Past results are not a guarantee of future results. All backtesting results are for indicative purposes only.
- Commissions are included, using NinjaTrader's Lifetime license commission schema, for realistic results.
- We follow NinjaTrader's official guide for precise intrabar-granularity backtesting using additional tick-level data series, and only use market orders — never pending orders — in both real-time and backtest modes.
No performance reports have been uploaded for this strategy yet.
Download & Installation Instructions
License Requirements
At automated-trading.ch you can choose to either purchase a monthly subscription to use our premium products, or use our free products without subscribing.
In both cases, you need to create an account so you can get a License you can use for both premium and free products.
To obtain your license, simply sign up and then get your license on the billing page.
Download
You can also download this strategy — and every other automated-trading.ch strategy or indicator — anytime from your centralized Downloads page.
Installation Steps
Frequently Asked Questions
General
Billing
Skeptics
Release Notes
- Added CET timezone; Added Fair Value Gap entry filter; Added 1.5:1 take profit option; Fixed fixed-value take profit interference with dynamic mode; Optimized memory usage on optimizations; Added Points as stoploss option; Added Risk per trade / max allowed risk parameters; Added StopLoss Offset Points parameter; Upgraded price breakeven methods; Added time based breakeven; Better dynamic quantity calculation; Added Points based take profit; Added Weekly take profit target
- Fix duplicate Chart Panel controls
- Added Execution on Micros; Added new trail stoploss method; Added stoploss offset in points; Various Fixes
- Added Breakeven option; Removed maximum count of trades as daily stop trade method
- Bug Fix: error on render method
- Bug Fix: Max Currency Risk should not take over stoploss price
- Added additional daily stop strategies; Added Risk adjusted quantity strategy; Added Auto switch Trend/Reversal entry modes; Added VWAP filter for entries; Added Swing direction filter for entries
- Major update: adding ATM Strategy management capabilities
- Added Entry Mode Switch to command buttons
- Bug Fix: Last Swing StopLoss method was incorrect
- User Friendly parameter value options; Better Swing analysis; Rendering of imbalances zones from within strategy; Added Take profit strategy; Strategy became Premium
- First Release of the strategy as a free strategy