OpenAlgo - Python Tutorial Series - Part 6 - Managing Stoploss and Targets
In this tutorial, you'll learn how to build a complete real-time stop loss and target monitoring system using OpenAlgo's Python SDK. We cover the entire pipeline — from placing an entry order and checking its status, to calculating SL/Target levels, streaming live prices via WebSocket, and exiting automatically when your stop or target is hit. 📌 Timestamps 0:00 Intro 0:02 The Complete Pipeline — 7-Step Flow 0:30 Step 1: Client Configuration 0:49 Step 2: Place Entry Order 1:06 Order Status Lifecycle (Open, Completed, Rejected, Cancelled) 1:32 Step 3: Get Entry Price via orderstatus() 1:49 Percentage-Based Stop Loss & Target (1% SL / 2% Target) 2:14 Point-Based Stop Loss & Target (50pt SL / 100pt Target) 2:34 Step 4: WebSocket Subscribe for Live Prices 2:52 Monitor & Decision Logic — LTP Callback Flowchart 3:13 Step 5: Exit Order & Cleanup 3:38 Complete Flow Recap 4:12 Series Recap & Next Steps 📌 What You'll Learn • Place entry orders using placeorder() and retrieve the order ID • Check order status (Open / Completed / Rejected / Cancelled) and extract the average fill price • Calculate stop loss and target using percentage-based or point-based methods • Stream real-time LTP updates via WebSocket using subscribe_ltp() • Build an automated exit system that fires SELL orders on SL/Target hit • Properly clean up WebSocket connections after exit 📌 Symbol Used NIFTY24FEB26FUT (NSE) — Lot Size: 65 — Price: ~₹25,500 📌 Key Concepts • Percentage SL/Target: entry × 0.99 (SL) / entry × 1.02 (Target) • Point SL/Target: entry - 50 (SL) / entry + 100 (Target) • Uses placeorder() for both entry and exit (closes only your position) 📌 Tutorial Series Part 1: SDK Setup & Basic Functions Part 2: PlaceSmartOrder Part 3: Options Trading Part 4: WebSocket Streaming Part 5: Technical Indicators Part 6: Real-Time Stop Loss & Target (this video) 📌 Links OpenAlgo Docs: [https://docs.openalgo.in](https://docs.openalgo.in) Full Example Code: [https://github.com/marketcalls/openalgo](https://github.com/marketcalls/openalgo) OpenAlgo Platform: [https://openalgo.in](https://openalgo.in) ⚠️ Disclaimer: This video is for educational purposes only. It does not constitute financial advice. Trading in derivatives involves significant risk. Always paper trade and backtest before going live.
Download
0 formatsNo download links available.