Skip to content
All library documents

Market-If-Touched Orders for Pullback Entries and Profit Taking

Article NautilusTrader

Summary

A market-if-touched order waits for a specified trigger price, then submits a market order. Traders may use it to enter after a pullback or to exit a position when a target is reached. The order direction is typically opposite that of a stop trigger: for example, it can buy below or sell above the prevailing market.

The document illustrates configuring such an order for a perpetual futures contract, including its side, size, trigger price, trigger source, time in force, and optional reduce-only setting. The example demonstrates order construction rather than evaluating a trading strategy, and provides no performance evidence. Reaching the trigger does not ensure execution at that price: the resulting market order may slip, be rejected, or fail to fill. Traders should account for these execution risks when using trigger-based entries or exits.

Key ideas

  • A market-if-touched order submits a market order after its trigger price is reached.
  • Traders can use it for pullback entries or profit-taking exits.
  • Its trigger direction is generally opposite to a stop order's trigger direction.
  • The trigger price does not guarantee the eventual fill price or execution.
  • Order setup can specify trigger source, time in force, and reduce-only behavior.

Tags

Full text
# Market-If-Touched


# Market-If-Touched

`FIX OrdType <40>=J` (Market If Touched)

A *Market-If-Touched* order releases a *Market* order when its trigger price is reached. Traders
often use it to enter on a pullback or take profit: a SELL order against a LONG position or a BUY
order against a SHORT position.

## Use cases

Use a *Market-If-Touched* order to prioritize execution when a target price is touched. It triggers
in the opposite market direction from a stop order, such as buying below or selling above the
current market. The touch price is not a guaranteed fill price, and the released *Market* order can
slip, be rejected, or remain unfilled.

## Example

In the following example we create a *Market-If-Touched* order on the Binance Futures exchange
to SELL 10 ETHUSDT-PERP Perpetual Futures contracts at a trigger price of 10,000 USDT, active until further notice:

```rust tab="Rust"
use nautilus_model::{
    enums::{OrderSide, TimeInForce, TriggerType},
    identifiers::InstrumentId,
    types::{Price, Quantity},
};
use ustr::Ustr;

let order = self.order().market_if_touched(
    InstrumentId::from("ETHUSDT-PERP.BINANCE"),
    OrderSide::Sell,
    Quantity::from(10),
    Price::from("10000.00"),
    Some(TriggerType::LastPrice),    // optional (default DEFAULT)
    Some(TimeInForce::Gtc),          // optional (default GTC)
    None,                            // expire_time
    Some(false),                     // reduce_only (default false)
    None,                            // quote_quantity (default false)
    None,                            // emulation_trigger
    None,                            // trigger_instrument_id
    None,                            // exec_algorithm_id
    None,                            // exec_algorithm_params
    Some(vec![Ustr::from("ENTRY")]), // tags
    None,                            // client_order_id
);
```

```python tab="Python"
from nautilus_trader.model import InstrumentId
from nautilus_trader.model import MarketIfTouchedOrder
from nautilus_trader.model import OrderSide
from nautilus_trader.model import Price
from nautilus_trader.model import Quantity
from nautilus_trader.model import TimeInForce
from nautilus_trader.model import TriggerType

order: MarketIfTouchedOrder = self.order_factory.market_if_touched(
    instrument_id=InstrumentId.from_str("ETHUSDT-PERP.BINANCE"),
    order_side=OrderSide.SELL,
    quantity=Quantity.from_int(10),
    trigger_price=Price.from_str("10_000.00"),
    trigger_type=TriggerType.LAST_PRICE,  # <-- optional (default DEFAULT)
    time_in_force=TimeInForce.GTC,  # <-- optional (default GTC)
    expire_time=None,  # <-- optional (default None)
    reduce_only=False,  # <-- optional (default False)
    tags=["ENTRY"],  # <-- optional (default None)
)
```

See the
[`MarketIfTouchedOrder` API reference](/docs/python-api-latest/model/orders.html#nautilus_trader.model.MarketIfTouchedOrder)
for further details.

## Related guides

- [Orders](index.md#trigger-type) - Trigger types and other execution instructions.
- [Emulated orders](emulated.md) - Emulating conditional orders on venues without native support.
- [Execution](../execution/) - How orders reach the venue and fills are handled.

Shown in full with attribution under the source's licence. Licence: LGPL-3.0

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.