OCO Orders Explained: How to Use Bracket Orders with TradingView Alerts
OCO (One-Cancels-Other) orders are the backbone of professional risk management in futures trading. They let you define both a take profit and a stop loss that automatically cancel each other when one is filled. Here's how to use them with NinjaView.
What is an OCO Bracket Order?
When you enter a trade, an OCO bracket places two exit orders simultaneously:
- Take Profit: A limit order above (for longs) or below (for shorts) your entry
- Stop Loss: A stop-market order to limit your downside
When either order fills, the other is automatically cancelled.
Sending OCO from TradingView
Your webhook payload should include the take_profit_price and stop_loss_price fields:
{"alert":"oco market buy","account":"Sim101","ticker":"NQ 06-26","qty":1,"take_profit_price":21500.00,"stop_loss_price":21450.00}
Why OCO Matters for Automated Trading
Without bracket orders, an automated system that enters a trade but loses connection has no protection. OCO ensures your risk is defined at entry, regardless of what happens to your internet connection, VPS, or the alert system.
Pro Tip: Combine with ATM Strategies
For even more sophisticated exits, use NinjaView's ATM strategy support. ATM strategies can include multi-target scaling (take partial profits at different levels), auto-breakeven, and trailing stops — all triggered from a single TradingView alert.
Automate Your Trading with NinjaView
NinjaView connects your TradingView strategies to NinjaTrader 8 with sub-second execution. Whether you're running one account or managing multiple prop firm evaluations, NinjaView handles it all — 20+ order types, ATM strategy support, copy trading, and stealth mode execution.