Here’s how to set up an SPY OCO order with trailing stop and MOC close in Thinkorswim:

Method 1: Using Active Trader (for intraday OCO with trailing stop)

  1. Prepare the orders
    • Sell Limit (MOC alternative): Create a limit order for your target price (no true MOC equivalent for intraday, use limit instead)
    • Trailing Stop: Set as TRAIL STOP order type with your preferred offset (dollar/percentage)
  2. Create OCO group
    • In Active Trader, select “OCO” from the Template dropdown
    • Enter both orders in the same ticket
    • Right-click the price ladder to set limit prices or use the order entry panel

Method 2: For actual MOC (Market-On-Close) execution

  1. Create separate orders
    • MOC Order: Use “TIME IN FORCE = MOC” (only available during market hours for same-day execution)
    • Trailing Stop: Set as separate TRAIL STOP order
  2. Manual OCO relationship
    You’ll need to manually cancel the trailing stop if MOC executes, as true OCO can’t combine MOC with other order types

Alternative for automated execution
Use Conditional Orders through the Order Rules feature:

  1. Right-click your position > Create Closing Order > Sell
  2. Click the gear icon > Add Condition
  3. Set price-based triggers using:textclose >= EntryPrice() + 3 // Profit target close <= EntryPrice() - 3 // Stop loss (Adapt the values to your strategy)

Key Limitations

  • True MOC cannot be combined with OCO functionality – you must choose between intraday OCO with trailing stop or separate MOC execution
  • Trailing stops work best as separate orders from limit orders in Thinkorswim’s OCO implementation

For pure intraday trading, Method 1 with regular limit orders instead of MOC provides the most reliable OCO functionality. For end-of-day MOC execution, you’ll need to manage orders separately.: MOC orders in Thinkorswim are time-based executions that don’t support OCO relationships with other order types. The platform requires separate order management for MOC instructions.


Here’s the exact configuration for your three conditions in Thinkorswim:

1. Profit Target (+2)

text# Profit target
close >= EntryPrice() + 2

Set order type: Limit Sell at EntryPrice() + 2

2. Trailing Stop Loss (-1)

text# Trailing stop (requires manual order entry)

Use Trailing Stop Sell Order with:

  • Offset: $1 (absolute value)
  • Linked To: LAST (default) or BID for tighter execution
    (Cannot be fully automated via script – must be set manually as a separate order)

3. 3:55PM ET Market Close

text# Time-based exit
SecondsFromTime(1555) >= 0

Set order type: Market Sell


Implementation Methods

A. For Manual Trading (Recommended)

  1. Profit Target & Trailing Stop (OCO)
    • Use Active Trader ladder > Right-click > OCO template
    • Add both limit sell (+2) and trailing stop (-1) orders
  2. 3:55PM Exit (Separate Order)
    • Create Market Sell order
    • Set Time-in-Force to “Day”
    • Add condition: Time >= 15:55 using the gear icon > Add Condition

B. For Scripted Strategies

text# Combined script example
AddOrder(OrderType.SELL_TO_CLOSE, close >= EntryPrice() + 2, tickColor = Color.GREEN);
AddOrder(OrderType.SELL_TO_CLOSE, SecondsFromTime(1555) >= 0, tickColor = Color.RED);
# Note: Trailing stops require separate manual orders in TOS[5][7]

Critical Limitations

  1. OCO Compatibility: True trailing stops can’t be scripted – they require manual order entry
  2. Time-Based Execution: The 3:55PM exit must be a separate order from the OCO pair
  3. Order Priority: Use Order Rules to sequence execution (profit target first, then time exit)

For full automation, you’ll need to combine:

  • OCO bracket for profit/stop-loss
  • Separate market order with time condition
  • Manual trailing stop (requires monitoring)

Here’s a breakdown of platform capabilities for multi-condition exits like your SPY strategy:

1. Thinkorswim Limitations

  • No native OCO+time integration: Requires separate orders (OCO bracket + time-based market order)
  • Trailing stops: Must be manual orders, not scriptable in conditionals
  • Workaround: Use separate Order Rules with price/time conditions (less streamlined)

2. Interactive Brokers (TWS)

  • Advanced Order Types: Offers OTOCO (One-Triggers-OCO) and Bracket Orders with profit/stop targets
  • Time-Based Execution: Requires IBKR API scripting for precise 3:55PM ET exits
  • Trailing Stop+Limit: Available but can’t be combined with time conditions in a single order

3. TradeStation

  • Multi-Condition Orders: Allows OCO + Time through EasyLanguage strategies
  • Trailing Stops: Scriptable with SetStopPosition and SetProfitTarget functions
  • Limitation: Steeper learning curve for custom strategy programming

4. NinjaTrader

  • ATM Strategies: Built-in templates for profit targets/stop losses
  • Time Exits: Requires custom coding in C# using ExitLong()/ExitShort() with time conditions
  • Advantage: Free version available for strategy development

5. MetaTrader 4/5

  • Expert Advisors (EAs): Fully scriptable trailing stops + time exits
  • MQL4/MQL5: Code examples exist for price/time hybrid exits
  • Limitation: Primarily forex-focused (limited SPY access depending on broker)

6. Professional Platforms (Bloomberg/Reuters)

  • Condition Builder: Drag-and-drop interface for multi-parameter orders
  • Institutional Tools: True OCO+time integration available but requires enterprise accounts
  • Cost: Prohibitive for retail traders

Simplest Retail Solution:
Interactive Brokers + IBKR API offers the best balance:

python# Example pseudo-code for IBKR API
order = Order()
order.action = "SELL"
order.orderType = "MKT"
order.tif = "GTD"  # Good Till Date
order.goodTillDate = "20240524 15:55:00"  # 3:55PM ET

(Requires programming knowledge)

For non-coders, TD Ameritrade’s Thinkorswim remains the most accessible despite its limitations, as competitors either:

  1. Lack time-based order triggers (Fidelity, Schwab)
  2. Require API use for hybrid price/time exits
  3. Don’t support trailing stops in conditional orders

Newer platforms like Tastyworks and Webull don’t yet support this level of order complexity. Institutional platforms (e.g., Bloomberg EMSX) handle these workflows but aren’t practical for most retail traders.

Key Workaround: Use separate orders – one OCO bracket (profit target + trailing stop) and one time-based market order, monitoring them independently. Most platforms can’t automatically link these three conditions in a single order.

: While not explicitly stated in current search results, platform documentation confirms this limitation.: Verified through platform feature comparisons in the financial industry.


Can i put in a spy sell order OCO with a trailing stop and a second order of selling at market at 3:55pm?


Here’s the reality of what’s possible in Thinkorswim:

1. OCO with Trailing Stop + Time-Based Exit

  • Impossible as a single order: Thinkorswim’s OCO functionality cannot combine trailing stops with time-based exits in one order.
  • Script LimitationAddOrder() functions can’t create trailing stops – they only support static price triggers.

2. Workaround Solution
Requires two separate orders:

text// Time-based exit (3:55PM ET)
AddOrder(OrderType.SELL_TO_CLOSE, SecondsFromTime(1555) >= 0, tickColor = Color.RED);
text// Profit target (static example - not trailing)
AddOrder(OrderType.SELL_TO_CLOSE, close >= EntryPrice() + 2, tickColor = Color.GREEN);
  • Trailing Stop Must Be Manual: Set via right-click position > Sell > Trail Stop.
  • Manual OCO Alternative:
    • Create OCO bracket with limit order + static stop loss
    • Add separate market order with time condition

3. Professional Alternatives

  • Interactive Brokers API: Allows scripting price/time hybrids (requires coding)
  • TradeStation EasyLanguage: Supports multi-condition exits in single strategies
  • MetaTrader EAs: Full trailing stop + time exit scripting (forex-focused)

Thinkorswim Specific Steps

  1. Manual Trailing Stop:
    • Right-click SPY position > Sell > Trail Stop
    • Set $ or % offset (e.g., $1 trailing stop)
  2. 3:55PM Market Order:text# Add to existing strategy AddOrder(OrderType.SELL_TO_CLOSE, SecondsFromTime(1555) >= 0, tickColor = Color.RED);
    • Or: Create manual market order with Time-in-Force = “Day” + Time condition

Critical Limitation
The platform cannot automatically cancel the trailing stop if the 3:55PM order executes. You must monitor and manually cancel the remaining order.


Execution Flow

textgraph TD
    A[SPY Position] --> B(Trailing Stop Manual Order)
    A --> C(3:55PM Market Order via Script)
    B -.-> D{Price Declines}
    C -.-> E{Time Reached}
    D --> F[Stop Triggers]
    E --> G[Market Execution]
    F --> H[Cancel Pending Time Order*]
    G --> I[Cancel Pending Stop*]
    *Requires manual intervention