
This strategy identifies the high and low points at 9:15 in the morning session, automatically calculates the target prices and stop-loss prices for long and short positions, and automatically opens positions when conditions are met. The strategy uses the Relative Strength Index (RSI) to determine overbought and oversold states, combined with breakouts of the 9:15 high and low points to determine entry opportunities.
This strategy is based on the 9:15 high/low points, uses the RSI indicator for trend judgment, automatically calculates target prices and stop-loss prices, and automatically opens long or short positions based on entry conditions. The strategy logic is simple and clear, with a high degree of automation, allowing for quick capture of trending moves. However, the strategy also has risks in terms of parameter optimization, reliance on a single indicator, intraday volatility, and lack of position management. In the future, the strategy can be optimized and improved in aspects such as dynamic stop-loss, combining with other indicators, optimizing entry conditions, and introducing position management, in order to obtain more robust trading performance.
/*backtest
start: 2024-02-01 00:00:00
end: 2024-02-29 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("9:15 AM High/Low with Automatic Forecasting", overlay=true)
// Parameters
showSignals = input(true, title="Show Signals")
// Define session time
sessionStartHour = input(9, title="Session Start Hour")
sessionStartMinute = input(0, title="Session Start Minute")
sessionEndHour = input(9, title="Session End Hour")
sessionEndMinute = input(15, title="Session End Minute")
// Calculate session high and low
var float sessionHigh = na
var float sessionLow = na
if (hour == sessionStartHour and minute == sessionStartMinute)
sessionHigh := high
sessionLow := low
// Update session high and low if within session time
if (hour == sessionStartHour and minute >= sessionStartMinute and minute < sessionEndMinute)
sessionHigh := high > sessionHigh or na(sessionHigh) ? high : sessionHigh
sessionLow := low < sessionLow or na(sessionLow) ? low : sessionLow
// Plot horizontal lines for session high and low
plot(sessionHigh, color=color.green, title="9:00 AM High", style=plot.style_stepline, linewidth=1)
plot(sessionLow, color=color.red, title="9:00 AM Low", style=plot.style_stepline, linewidth=1)
// Calculate targets and stop loss
longTarget = sessionHigh + 200
longStopLoss = sessionLow
shortTarget = sessionLow - 200
shortStopLoss = sessionHigh
// Plot targets and stop loss
plot(longTarget, color=color.blue, title="Long Target", style=plot.style_cross, linewidth=1)
plot(longStopLoss, color=color.red, title="Long Stop Loss", style=plot.style_cross, linewidth=1)
plot(shortTarget, color=color.blue, title="Short Target", style=plot.style_cross, linewidth=1)
plot(shortStopLoss, color=color.red, title="Short Stop Loss", style=plot.style_cross, linewidth=1)
// RSI
rsiLength = input(14, title="RSI Length")
overboughtLevel = input(60, title="Overbought Level")
oversoldLevel = input(40, title="Oversold Level")
rsi = ta.rsi(close, rsiLength)
// Entry conditions
longCondition = close > sessionHigh and rsi > overboughtLevel
shortCondition = close < sessionLow and rsi < oversoldLevel
// Long entry
if (showSignals and longCondition)
strategy.entry("Long", strategy.long)
// Short entry
if (showSignals and shortCondition)
strategy.entry("Short", strategy.short)