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
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.