该策略通过识别早盘9:15的高低点,自动计算多空头寸的目标价和止损价,并在满足条件时自动开仓。策略利用相对强弱指标(RSI)来判断超买和超卖状态,结合9:15高低点突破来确定入场机会。
该策略以9:15高低点为基础,运用RSI指标进行趋势判断,自动计算目标价和止损价,并根据开仓条件自动开立多头或空头仓位。策略逻辑简单明了,自动化程度较高,可以快速捕捉趋势行情。但是,策略也存在参数优化、单一指标、盘中波动以及仓位管理等方面的风险。未来可以从动态止损、结合其他指标、优化入场条件和引入仓位管理等方面对策略进行优化和改进,以期获得更稳健的交易表现。
/*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)