OPEN-SOURCE SCRIPT
NIFTY Options Breakout Strategy

This strategy trades NIFTY 50 Options (CALL & PUT) using 5-minute breakout logic, strict trend filters, expiry-based symbol validation, and a dynamic trailing-profit engine.
1️⃣ Entry Logic
Only trades NIFTY 50 options, filtered automatically by symbol.
Trades only between 10:00 AM – 2:15 PM (5m bars).
Breakout trigger:
Price enters the buy breakout zone (high of last boxLookback bars ± buffer).
Trend filter:
Price must be above EMA50 or EMA200,
AND EMA50 ≥ EMA100 (to avoid weak conditions).
Optional strengthening:
EMA20>EMA50 OR EMA50>EMA100 recent cross can be enforced.
Higher-timeframe trend check:
EMA50 > EMA200 (bullish regime only).
Start trading options only after expiry–2 months (auto-parsed).
2️⃣ One Trade Per Day
Maximum 1 long trade per day.
No shorting (long-only strategy).
3️⃣ Risk Management — SL, TP & Trailing
Includes three types of exits:
🔹 A) Hard SL/TP
Hard Stop-Loss: -15%
Hard Take-Profit: +40%
🔹 B) Step-Ladder Trailing Profit
As the option price rises, trailing activates:
Max Profit Reached Exit Trigger When Falls To
≥ 35% ≤ 30%
≥ 30% ≤ 25%
≥ 25% ≤ 20%
≥ 20% ≤ 15%
≥ 15% ≤ 10%
≥ 5% ≤ 0%
🔹 C) Loss-Recovery Exit
If loss reaches –10% but then recovers to 0%, exit at breakeven.
4️⃣ Trend-Reversal Exit
If price closes below 5m EMA50, the long is exited instantly.
5️⃣ Optional Intraday Exit
EOD square-off at 3:15 PM.
6️⃣ Alerts for Automation
The strategy provides alerts for:
BUY entry
TP/SL/Trailing exit
EMA50 reversal exit
EOD exit
1️⃣ Entry Logic
Only trades NIFTY 50 options, filtered automatically by symbol.
Trades only between 10:00 AM – 2:15 PM (5m bars).
Breakout trigger:
Price enters the buy breakout zone (high of last boxLookback bars ± buffer).
Trend filter:
Price must be above EMA50 or EMA200,
AND EMA50 ≥ EMA100 (to avoid weak conditions).
Optional strengthening:
EMA20>EMA50 OR EMA50>EMA100 recent cross can be enforced.
Higher-timeframe trend check:
EMA50 > EMA200 (bullish regime only).
Start trading options only after expiry–2 months (auto-parsed).
2️⃣ One Trade Per Day
Maximum 1 long trade per day.
No shorting (long-only strategy).
3️⃣ Risk Management — SL, TP & Trailing
Includes three types of exits:
🔹 A) Hard SL/TP
Hard Stop-Loss: -15%
Hard Take-Profit: +40%
🔹 B) Step-Ladder Trailing Profit
As the option price rises, trailing activates:
Max Profit Reached Exit Trigger When Falls To
≥ 35% ≤ 30%
≥ 30% ≤ 25%
≥ 25% ≤ 20%
≥ 20% ≤ 15%
≥ 15% ≤ 10%
≥ 5% ≤ 0%
🔹 C) Loss-Recovery Exit
If loss reaches –10% but then recovers to 0%, exit at breakeven.
4️⃣ Trend-Reversal Exit
If price closes below 5m EMA50, the long is exited instantly.
5️⃣ Optional Intraday Exit
EOD square-off at 3:15 PM.
6️⃣ Alerts for Automation
The strategy provides alerts for:
BUY entry
TP/SL/Trailing exit
EMA50 reversal exit
EOD exit
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.