This is a high-frequency quantitative trading strategy based on the Nifty 50 index. It tracks the price changes of the Nifty 50 index and combines the open interest change to take long positions near support levels and short positions near resistance levels for profit.
The strategy first obtains the open interest change of the Nifty 50 index. Then it will generate buy and sell signals based on the set support and resistance levels, as well as the threshold values of the open interest change magnitude. Specifically:
In this way, long positions can be taken near support levels, and short positions can be taken near resistance levels, to profit.
The strategy has the following advantages:
The strategy also has some risks:
The strategy can be further optimized in the following aspects:
This is a simple and efficient quantitative trading strategy based on the Nifty 50. It has advantages like high operation frequency, use of open interest information, supports dynamic position adjustment, and also has room for improvement. Overall, the strategy lays a solid foundation for building a multi-factor, automated, and intelligent quantitative trading system.
/*backtest start: 2024-01-01 00:00:00 end: 2024-01-24 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Intraday Nifty 50 Bottom Buying and Selling with OI Strategy", overlay=true) // Input parameters niftySymbol = input("NIFTY50", title="Nifty 50 Symbol") oiLength = input(14, title="Open Interest Length") supportLevel = input(15000, title="Support Level") resistanceLevel = input(16000, title="Resistance Level") buyThreshold = input(1, title="Buy Threshold") sellThreshold = input(-1, title="Sell Threshold") // Fetch Nifty 50 open interest oi = request.security(niftySymbol, "D", close) // Calculate open interest change oiChange = oi - ta.sma(oi, oiLength) // Plot support and resistance levels plot(supportLevel, color=color.green, title="Support Level") plot(resistanceLevel, color=color.red, title="Resistance Level") // Plot open interest and open interest change plot(oi, color=color.blue, title="Open Interest") plot(oiChange, color=color.green, title="Open Interest Change") // Trading logic buySignal = close < supportLevel and oiChange > buyThreshold sellSignal = close > resistanceLevel and oiChange < sellThreshold // Execute trades strategy.entry("Buy", strategy.long, when=buySignal) strategy.entry("Sell", strategy.short, when=sellSignal)