
This strategy is based on the 3-minute candlestick data of the Nifty50 index. It tracks the high and low prices of the first 3-minute candle of each trading session and issues trading signals when the price breaks out of this range. The main idea behind the strategy is that the market often experiences significant uncertainty and volatility during the opening, and the high and low points of the first candle can serve as important references for the price movement of the day. By determining whether the price breaks out of this range, it can capture the trending opportunities of the day.
The Nifty50 3-Minute Opening Range Breakout Strategy captures the daily trend direction by tracking the high and low points of the first 3-minute candle of each trading session. It is simple and easy to use. However, due to the enormous volatility and uncertainty during market opening, the strategy itself has certain limitations, such as generating many false breakout signals and lacking position sizing and stop-loss mechanisms. Therefore, in practical application, it needs to be combined with other technical indicators, position management, and strict stop-loss methods to optimize strategy performance and enhance risk control capabilities.
/*backtest
start: 2023-05-11 00:00:00
end: 2024-05-16 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Nifty 50 Strategy", overlay=true)
// Define 3-minute timeframe
timeframe = "3"
// Track if the current bar is the first bar of the session
isNewSession = ta.change(hour(time, "D")) != 0
// Track the open of the first candle of the session
firstCandleOpen = isNewSession ? open : na
// Track the high and low of the first candle
var float firstCandleHigh = na
var float firstCandleLow = na
if isNewSession
firstCandleHigh := high
firstCandleLow := low
// Alert when the first candle is completed
if ta.barssince(isNewSession) == 3
alert("First Candle Completed - High: " + str.tostring(firstCandleHigh) + ", Low: " + str.tostring(firstCandleLow))
// Track if the high or low of the first candle is broken
highBroken = high > firstCandleHigh
lowBroken = low < firstCandleLow
// Alert when the high or low of the first candle is broken
if highBroken
alert("High of First Candle Broken - High: " + str.tostring(high))
strategy.entry("Enter Long", strategy.long)
if lowBroken
alert("Low of First Candle Broken - Low: " + str.tostring(low))
strategy.entry("Enter Short", strategy.short)