Stacking Orders with JSON Alerts: Pyramid & Reverse Order Close Explained

2 min read

This document explains how the pyramid and reverse_order_close parameters in the JSON configuration control multiple open trades, and how you can configure your alerts for faster stacking.


Key Parameters for Stacking Orders #

1. pyramid #

  • Default: false
  • Function: Controls whether multiple trades in the same direction can be stacked.
  • When set to true:
    • Multiple buy signals can open multiple buy orders.
    • Multiple sell signals can open multiple sell orders.
    • Existing same-direction trades remain open until closed by user or opposite signal.

2. reverse_order_close #

  • Default: false
  • Function: Controls whether opposite positions are automatically closed.
  • When set to true:
    • A buy signal will close all open sell orders before opening new buy trades.
    • A sell signal will close all open buy orders before opening new sell trades.

Tested Setup (Case Study) #

We tested stacking entries with the following JSON parameters:

{
	"symbol": "MNQ1!",
	"data": "buy",
	"quantity": 1,
	"pyramid": true,
	"same_direction_ignore": false,
	"reverse_order_close": true,
..}

Result: #

  • Able to stack up to 11 trades in the same direction (buy or sell).
  • Opposite signals automatically close existing trades before opening new ones.
  • Provides clean stacking with controlled risk management.

Considerations #

  • With reverse_order_close = true, each new order must first check and close opposite positions before executing the new trade.

How to Reduce Execution Time #

If your strategy is sensitive to execution delays:

  1. Send a Close Signal First – Instead of relying on reverse_order_close, design your strategy to send a close alert at the end of a stacking sequence.
  2. Then Send Opposite Signal – After positions are closed, send the new opposite-direction entry.

Using this adjustment, order execution can be faster, even with multiple stacked trades.


Practical Example #

  1. Stacking Buys:
    • 5 consecutive buy alerts received → 5 buy orders opened.
    • No positions closed since all are in the same direction.
  2. Closing Before Switching:
    • Strategy sends a close alert → All 5 buy orders closes.
  3. Switching to Sell:
    • Next sell alert is received → A new sell order opens almost instantly.
    • More sell alerts stack additional sell orders without delay.

Recommendation #

If your strategy relies on stacking entries, use:

"pyramid": true,
"reverse_order_close": true

And for faster execution:

  • Adjust your strategy to send a close signal before opposite direction entries.
  • This ensures stacking flexibility (up to 11 trades tested) with faster execution time.