NIFTY Trend-Pullback Options System: Intraday: Rules-based · Long calls and puts
NIFTY Options Intraday Trading System
A trend-following pullback strategy for intraday NIFTY call (CE) and put (PE) buying, with defined entry conditions, risk controls, position sizing, and a Python backtesting blueprint.
Important: This is a strategy framework to test, not a live trading signal or a promise of profitability. Options can lose the entire premium paid.
1. Strategy overview and market bias
The system combines trend direction, VWAP, momentum and a price-action confirmation. It should only trade when conditions align. A positive previous close by itself is not a reason to buy calls.
| Reference from Friday, October 16, 2026 | NIFTY 50 |
|---|---|
| High | 23,149.85 |
| Low | 22,913.80 |
| Close | 23,146.15 |
These levels are historical references, not forecasts or guaranteed support/resistance. Verify them against a trusted exchange or broker data feed before use.
2. Entry rules
Buy a CALL (CE)
- Wait until at least 9:30 AM IST.
- On the 15-minute chart, EMA 20 must be above EMA 50.
- NIFTY must be above VWAP on the 5-minute chart.
- ADX(14) on the 15-minute chart must be above 18 and rising.
- RSI(14) on the 5-minute chart must be between 52 and 68.
- Wait for a pullback toward VWAP or EMA 20, then a bullish 5-minute confirmation candle.
- Enter only after the confirmation candle's high is broken; avoid chasing an extended candle.
Contract: liquid ATM or one-strike ITM CE.
Buy a PUT (PE)
- Wait until at least 9:30 AM IST.
- On the 15-minute chart, EMA 20 must be below EMA 50.
- NIFTY must be below VWAP on the 5-minute chart.
- ADX(14) on the 15-minute chart must be above 18 and rising.
- RSI(14) on the 5-minute chart must be between 32 and 48.
- Wait for a pullback toward VWAP or EMA 20, then a bearish 5-minute confirmation candle.
- Enter only after the confirmation candle's low is broken.
Contract: liquid ATM or one-strike ITM PE.
3. Stop-loss, targets and trade limits
| Rule | Initial parameter to test |
|---|---|
| Initial premium stop | 20–25% below entry premium |
| Profit target | 1.5 times initial premium risk |
| Trailing stop | After +1R, trail using underlying swing levels or a tested ATR rule |
| Underlying invalidation | Exit if the setup's invalidation level breaks, even if the premium stop has not triggered |
| New-entry cutoff | Do not initiate trades after 2:30 PM IST |
| Intraday exit | Close open positions by 3:15 PM IST |
| Daily discipline | Stop after 2 consecutive losses or the daily loss limit |
| Trade frequency | Maximum 3 trades per session |
4. Position-sizing calculator
Set capital, risk, option premium, stop percentage and the current contract lot size. The lot size must be checked with your broker or the current NSE contract master.
Calculation excludes charges, slippage and stop execution risk.
Formula:
- Risk budget = capital × risk percentage.
- Risk per lot = entry premium × stop-loss percentage × lot size.
- Maximum lots = floor(risk budget ÷ risk per lot).
Example: ₹5,00,000 capital at 0.25% risk gives a ₹1,250 risk budget. If premium is ₹200, the stop is 25%, and lot size is 65, theoretical risk is ₹3,250 per lot—so the correct position is no trade at that risk limit.
5. Filters before every trade
| Filter | Rule |
|---|---|
| Market timing | No entries in the first 15 minutes; wait until 9:30 AM. |
| Trend | 15-minute EMA alignment and 5-minute VWAP agreement. |
| Momentum | ADX above 18 and rising; RSI in the direction-specific range. |
| Liquidity | Prefer liquid strikes with a tight bid–ask spread. |
| Contract selection | ATM or one-strike ITM; avoid illiquid contracts and verify expiry. |
| Volatility | Check India VIX and option IV; avoid buying expensive premium without a strong setup. |
| Gap risk | After a large overnight gap, wait for a fresh range and confirmation. |
| News | Avoid entering immediately before major scheduled announcements. |
| Risk limit | Maximum 3 trades, stop after 2 consecutive losses or the daily loss cap. |
| Expiry | Exclude expiry-day trades from the first version of the system. |
6. Python backtesting plan
A meaningful backtest needs historical option prices—not just NIFTY spot signals. Correctly predicting index direction can still lose money due to premium decay, implied-volatility changes, bid–ask spreads, slippage and charges.
Step 1: Collect the data
- NIFTY spot or futures candles at 5-minute and 15-minute intervals.
- Historical CE/PE option candles with OHLC and volume; bid–ask quotes are preferable.
- Historical expiry, strike, lot size and contract metadata.
- Brokerage, exchange charges, STT, GST and realistic slippage assumptions.
Use your broker's historical-data API or a licensed data provider. Check coverage, timestamps and contract adjustments before relying on the results.
Step 2: Generate starter signals
The following code is a signal-generation starting point. It expects a 5-minute DataFrame indexed by timestamp and the listed indicator columns. The 15-minute indicators must be aligned so only completed 15-minute candles are used. It is not a complete backtester or a live trading bot.
import numpy as np
import pandas as pd
def generate_signals(df):
"""
Required columns:
open, high, low, close, volume, vwap,
ema20_15m, ema50_15m, adx_15m, rsi_5m
Input is 5-minute data indexed by timestamp.
Indicators must be calculated and aligned without
look-ahead bias. Add a pullback condition before live use.
"""
df = df.copy()
bullish = (
(df["ema20_15m"] > df["ema50_15m"]) &
(df["close"] > df["vwap"]) &
(df["adx_15m"] > 18) &
(df["rsi_5m"].between(52, 68))
)
bearish = (
(df["ema20_15m"] < df["ema50_15m"]) &
(df["close"] < df["vwap"]) &
(df["adx_15m"] > 18) &
(df["rsi_5m"].between(32, 48))
)
prev_high = df["high"].shift(1)
prev_low = df["low"].shift(1)
bullish_confirmation = df["close"] > prev_high
bearish_confirmation = df["close"] < prev_low
minutes = df.index.hour * 60 + df.index.minute
allowed_time = (
(minutes >= 9 * 60 + 30) &
(minutes <= 14 * 60 + 30)
)
df["buy_ce"] = (
bullish & bullish_confirmation & allowed_time
)
df["buy_pe"] = (
bearish & bearish_confirmation & allowed_time
)
return df
def position_size(
capital, risk_fraction, entry_premium,
stop_fraction, lot_size
):
"""Return risk budget, risk per lot and maximum lots."""
risk_budget = capital * risk_fraction
risk_per_lot = (
entry_premium * stop_fraction * lot_size
)
if risk_per_lot <= 0:
return risk_budget, risk_per_lot, 0
lots = int(risk_budget // risk_per_lot)
return risk_budget, risk_per_lot, lots
Step 3: Simulate actual option trades
- Select the nearest eligible ATM or one-strike ITM contract for each signal.
- Enter at the next executable option price, not the underlying candle's closing price.
- Track the actual option premium after entry.
- Exit when the premium stop, target, underlying invalidation or time exit is triggered.
- If stop and target are both touched in the same candle and their order is unknown, conservatively assume the stop was hit first.
- Deduct all applicable charges and slippage.
- Enforce position-size, maximum-trade and daily-loss limits during the simulation.
Step 4: Evaluate performance
| Metric | What to evaluate |
|---|---|
| Net profit after costs | Positive performance across unseen periods. |
| Profit factor | Gross profits divided by gross losses. |
| Maximum drawdown | Whether the worst peak-to-trough loss is tolerable. |
| Expectancy per trade | Average net outcome per trade. |
| Win rate and average win/loss | Assess together, not in isolation. |
| Trades per day | Check for overtrading. |
| Performance by market regime | Compare trending, sideways and high-volatility periods. |
| Slippage sensitivity | Check whether small execution changes eliminate profitability. |
Use at least 2–3 years of available data if possible, split chronologically into development, validation and untouched test periods. Start with a small number of parameters and use walk-forward validation to reduce overfitting.
7. Automation and deployment checklist
- Build separate modules for data loading, indicator calculation, signal generation, contract selection, execution simulation and reporting.
- For broker integration, add order-state tracking, duplicate-order protection, stale-data checks, exception handling and a kill switch.
- Paper trade before risking capital; compare simulated fills with actual bid–ask prices.
- Check current NSE, SEBI and broker requirements for retail algorithmic trading before automated order placement.
Comments
Post a Comment