OPEN-SOURCE SCRIPT
N Option Selling 2

---
## 📌 Script Description
**NIFTY Weekly Option Seller – Regime-Based Risk-Controlled System**
This indicator is designed for **systematic weekly option selling on NIFTY**, using a **rule-based regime and scoring framework** to decide **what to sell, how aggressively to sell, and when to defend or harvest**.
The script does **not generate buy/sell signals**.
Instead, it acts as a **decision and risk-management engine** for option sellers.
---
## 🔹 Core Idea
The market is always in one of three regimes:
1. **Iron Condor (IC)** → Range / mean-reverting market
2. **Put Credit Spread (PCS)** → Bullish trending market
3. **Call Credit Spread (CCS)** → Bearish trending market
This script **scores all three regimes (0–5)** on the current chart timeframe and automatically selects the **dominant regime**.
---
## 🔹 How Scoring Works (High Level)
Each regime score is built using **price structure + volatility + momentum context**:
### PCS (Bullish bias)
* EMA alignment (8 > 13 > 34)
* ADX trend strength
* Price above VWAP
* CPR breakout
* RSI sanity checks (size is reduced in extremes)
* Daily trend confirmation
### CCS (Bearish bias)
* EMA alignment (8 < 13 < 34)
* ADX trend strength
* Price below VWAP
* CPR breakdown
* RSI sanity checks (size is reduced in extremes)
* Daily trend confirmation
### IC (Range bias)
* Low ADX (both intraday & daily)
* Price inside CPR
* Price near VWAP
* Price inside Camarilla H3–L3
* RSI near equilibrium (45–55)
A **cross-penalty system** ensures that strong trends suppress IC scores and vice-versa, preventing conflicting signals.
Scores are **smoothed** to reduce noise and avoid over-trading.
---
## 🔹 Regime Selection Logic
* The regime with the **highest score** is selected.
* If scores tie:
* **Trending markets → PCS / CCS**
* **Non-trending markets → IC**
This ensures **trend takes priority over range** when volatility expands.
---
## 🔹 Strike Selection (ATR-Based)
The script suggests **volatility-adjusted strike distances** using ATR:
* **Iron Condor:** ±1.0 × ATR
* **PCS / CCS:** ±1.25 × ATR
This adapts automatically to changing volatility instead of using fixed point distances.
---
## 🔹 Risk-First Trade Management
The script provides **three actionable alerts only**:
### 🔴 DEFEND
Triggered when:
* Price approaches short strike
* Trend breaks beyond Camarilla levels
* Volatility expansion threatens the position
→ Signals the need to **roll, widen, or convert**
### 🟢 HARVEST
Triggered when:
* Adequate price cushion exists
* Market remains range-bound or stable
→ Signals opportunity to **book profits or roll closer**
### 🔵 REGIME CHANGE
Triggered when:
* Market structure flips decisively
→ Signals need to **switch strategy bias**
A **cooldown system** prevents alert spam.
---
## 🔹 Position Sizing Philosophy
* Scores determine **directional conviction**
* RSI-based **size multiplier** automatically reduces exposure in extreme momentum conditions
* Optional **minimum lot floor** ensures participation without over-risking
* Designed to support **Risk:Reward frameworks (1:2 or 1:3)** through premium-based stop discipline
---
## 🔹 Visual & UX Features
* Background color reflects active regime and conviction
* On-chart panel displays:
* Active strategy
* Scores (IC / PCS / CCS)
* ADX & RSI
* VWAP, CPR, Camarilla levels
* Clean, non-repainting levels (previous day data)
---
## 🔹 Intended Use
* Weekly option selling (IC / PCS / CCS)
* Works best on **30m–1h charts**
* Designed for **rule-based traders**, not discretionary scalpers
* Focused on **capital preservation, consistency, and disciplined adjustments**
---
## ⚠️ Disclaimer
This script is **not financial advice**.
It is a **decision-support and risk-management tool** for experienced option sellers who already understand spreads, adjustments, and margin dynamics.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.