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.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.