A lightweight Python script that fetches intraday NIFTY 50 data and calculates Classic Pivot Points combined with a "Golden Ratio" (0.382) breakout strategy based on the previous day's range and today's opening 5-minute candle.
- Pulls the last 5 days of 5-minute NIFTY 50 (
^NSEI) data viayfinance - Extracts previous day's High, Low, and Close
- Calculates Classic Pivot Points (Pivot, R1, R2, S1, S2)
- Uses today's opening candle range + previous day's range, scaled by a 0.382 multiplier, to compute Buy Above / Sell Below breakout levels
- Suggests Stop Loss levels (safer of Pivot vs Previous Close) and Risk-Reward distance from the current price
- Prints a clean, formatted trade setup to the terminal
pip install yfinance pandas
python nifty_golden_pivot_strategy.pySample output:
================================================
⚡ NIFTY GOLDEN + PIVOT STRATEGY: 2026-08-06
🕒 LATEST PRICE: 24580.15
================================================
PREV CLOSE: 24512.30
RANGE VALUE: 68.42 (Multiplier: 0.382)
------------------------------------------------
📊 PIVOT LEVELS
R2: 24610.20 | R1: 24565.75
PIVOT POINT: 24520.85
S1: 24475.40 | S2: 24431.50
------------------------------------------------
🚀 BUY TRADE SETUP
BUY ABOVE: 24580.72 (+0.57 pts away)
STOP LOSS: 24512.30 (Risk: 68.42 pts)
------------------------------------------------
🔻 SELL TRADE SETUP
SELL BELOW: 24443.88 (-136.27 pts away)
STOP LOSS: 24520.85 (Risk: 76.97 pts)
================================================
The core function accepts parameters for flexibility:
nifty_fast_golden_strategy(symbol="^NSEI", multiplier=0.382, interval="5m")symbol— any Yahoo Finance ticker (e.g.^NSEBANKfor Bank Nifty)multiplier— Fibonacci ratio used to scale the breakout rangeinterval— candle interval (1m,5m,15m, etc.)
This tool is for educational purposes only and does not constitute financial advice. Always do your own research and risk management before trading.
MIT