Python Nifty Options Algo

Заказчик: AI | Опубликовано: 07.01.2026

Precision Seller (V2.0) ​1. Project Overview ​Objective: To automate a Nifty Option Selling strategy based on Index Spot levels and Candlestick patterns to eliminate emotional errors (Revenge Trading). ​Platform: Python-based bot using Angel One SmartAPI. ​Hosting: VPS (Windows or Linux Cloud). ​Segment: Nifty Weekly Options (Intraday). ​2. Market Data & Setup ​Brain (Monitoring): NIFTY 50 Index (Spot Chart). ​Levels to Fetch: ​Previous Day High (PDH), Low (PDL), and Close (PDC). ​Standard Pivot Points (R1, R2, S1, S2, P). ​Entry Logic: Trade is only valid if the Spot price is within 0.1% of these levels. ​3. Entry & Execution Logic ​Trigger Patterns (OR Condition): ​Inverted Hammer / Shooting Star. ​Bearish Engulfing. ​Lookback Rule: If the level-touching candle doesn't form a pattern, monitor the next 3 candles. If a pattern forms, trigger entry. ​Strike Selection: ​Dynamically select the Weekly Expiry Option with a premium closest to ₹150 (Preferably > ₹150). ​Position Sizing: 1 Lot (Selling). ​Hedging (Margin/Safety): Simultaneously Buy a far OTM option (Premium ₹10-15) before executing the Sell order. ​4. Risk Management (The "Anti-Loss" Rules) ​Stop Loss (Spot Based): ​Level: High of the entry candle + 4 point buffer. ​Execution: Exit Option position immediately if Spot price hits this level. ​Trailing SL: ​Once MTM reaches 0.5% profit, move SL to Cost. ​Implement a Trailing Jump (e.g., for every 10 points move in favor, move SL by 5 points). ​Daily Limits: ​Max Trades: 2 per day. ​Profit Lock: If 1st trade profit >= 1% of capital (₹1,000), STOP for the day. ​Loss Stop: If 1st trade hits SL, allow 2nd trade. If 2nd trade also hits SL, STOP for the day. ​5. Technical Requirements for Developer ​Language: Python. ​API: Angel One SmartAPI integration. ​Reporting: Real-time logs and a summary of P&L sent to Telegram/WhatsApp. ​Error Handling: Handle API timeouts, internet disconnection, and auto-relogin on VPS startup. ​Backtesting: Provide a 1-year backtest report on this logic before going live.