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
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.