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
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน