OPEN-SOURCE SCRIPT
N Option Selling 1

**NIFTY Weekly Option Seller – Regime & Risk Framework (HTF + RSI)**
This indicator is a **decision-support tool for NIFTY option sellers**, designed to identify whether current market conditions favor:
* **Iron Condor (IC)** – range / mean-reversion
* **Put Credit Spread (PCS)** – bullish bias
* **Call Credit Spread (CCS)** – bearish bias
The script focuses on **structure selection and risk management**, not trade execution.
---
## Core logic
### 1) Multi-timeframe context
* Signals are calculated on the **active chart timeframe** (commonly 4H).
* **Daily (HTF) EMA trend and Daily ADX** are used as **gating conditions**, ensuring strong directional scores are not allowed against the higher-timeframe context.
This prevents aggressive trend selling when the daily structure does not support it.
---
### 2) Three independent regime scores (0–5)
The script computes three capped and smoothed scores:
* **IC score (Range quality)**
Based on low ADX, price inside CPR, proximity to VWAP, Camarilla H3–L3, daily range confirmation, and mid-band RSI.
* **PCS score (Bullish structure)**
Based on EMA up-stack, trend strength (ADX), price relative to CPR/VWAP, with RSI and Daily trend acting as **brakes**, not entry signals.
* **CCS score (Bearish structure)**
Based on EMA down-stack, trend strength (ADX), price relative to CPR/VWAP, with RSI and Daily trend acting as **brakes**, not entry signals.
RSI is used only to **cap aggressiveness at extremes**, not to predict reversals.
---
### 3) Cross-penalty & smoothing
* When multiple regimes score high simultaneously, **cross-penalties reduce conflicting scores** so only one regime dominates.
* Final scores are **smoothed across bars** to avoid frequent regime flips and unstable sizing decisions.
---
### 4) Regime selection
The script selects **one primary regime** (IC / PCS / CCS) based on the highest adjusted score, with tie-break logic that prefers trend regimes only when ADX confirms strength; otherwise it defaults to IC.
---
### 5) Non-repainting reference levels
The indicator plots key **previous-day, non-repainting levels**:
* CPR (Low / High with Narrow–Wide classification)
* Camarilla H3, L3, H4, L4
* VWAP
These are contextual reference levels for structure and risk placement.
---
### 6) DEFEND / HARVEST prompts
Using ATR-based proximity logic, the script provides:
* **DEFEND** alerts when price approaches modeled risk zones
* **HARVEST** alerts when sufficient cushion exists
* **REGIME** alerts on confirmed regime changes
These are **risk-management prompts**, not buy/sell signals.
---
### 7) Visual dashboard
A compact panel displays:
* Active regime and score
* ADX / RSI
* CPR width classification
* EMA structure and tightness
* VWAP proximity
* IC / PCS / CCS scores
* Key level snapshot
---
## Intended use
* Designed for **weekly option selling**
* Best used on **4H charts with Daily context**
* Suitable for traders who manage positions **once per day**
* Encourages **structure-first thinking** (IC base with controlled directional bias)
---
## Disclaimer
This indicator does **not place trades** and does not calculate position size or P&L.
It is a **market regime and risk-awareness tool** and must be used with proper capital management and execution discipline.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.