BBSR极限策略是一种全面的交易方法,结合了布林带(Bollinger Bands)和随机RSI(Stochastic RSI)来识别市场中潜在的进场和出场点。该策略利用布林带分析价格波动和水平,通过计算价格在简单移动平均线(SMA)周围的标准差,确定价格波动的上下界限,帮助交易者发现潜在的反转点。同时,随机RSI通过比较收盘价相对于一定时期内价格区间的位置来衡量动量,有助于判断超买或超卖状态,洞察潜在的看涨或看跌动能。
BBSR极限策略通过创新性地结合布林带和随机RSI,为交易者提供了一个全面的框架,用于识别潜在的趋势反转和动量转变。内置的风险管理功能和可定制参数使其能够适应不同的交易风格和目标。尽管该策略展示了前景,但交易者仍需认识到其局限性,并考虑优化和调整的空间,以提高其在实际市场条件下的稳健性和表现。
/*backtest
start: 2024-03-01 00:00:00
end: 2024-03-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("BBSR Extreme Strategy [nachodog]", shorttitle="BBSRExtStrat", overlay=true)
//General Inputs
src = input(close, title="Source")
offset = input.int(0, title="Offset", minval=-500, maxval=500)
sl_pct = input.float(1.5, title="Stop Loss (%)", minval=0.1, maxval=50)
//Bollinger Inputs
length = input.int(20, title="Bollinger Band Length", minval=1)
mult = input.float(2.0, title="StdDev", minval=0.001, maxval=50)
//Bollinger Code
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
plot(basis, "BB Basis", color=color.new(#872323, 0), offset=offset)
p1 = plot(upper, "BB Upper", color=color.teal, offset=offset)
p2 = plot(lower, "BB Lower", color=color.teal, offset=offset)
fill(p1, p2, title="BB Background", color=color.new(#198787, 95))
//Stoch Inputs
smoothK = input.int(3, "K", minval=1)
smoothD = input.int(3, "D", minval=1)
lengthRSI = input.int(14, "RSI Length", minval=1)
lengthStoch = input.int(14, "Stochastic Length", minval=1)
upperlimit = input.float(90, "Upper Limit", minval=0.01)
lowerlimit = input.float(10, "Lower Limit", minval=0.01)
//Stochastic Code
rsi1 = ta.rsi(src, lengthRSI)
k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = ta.sma(k, smoothD)
//Evaluation
Bear = close[1] > upper[1] and close < upper and k[1] > upperlimit and d[1] > upperlimit
Bull = close[1] < lower[1] and close > lower and k[1] < lowerlimit and d[1] < lowerlimit
//Entering Trades
if (Bull)
strategy.entry("Bull Entry", strategy.long)
if (Bear)
strategy.entry("Bear Entry", strategy.short)
//Exiting Trades
strategy.exit("Exit Long", from_entry="Bull Entry", stop=close * (1 - sl_pct / 100), when=Bear or close < lower)
strategy.exit("Exit Short", from_entry="Bear Entry", stop=close * (1 + sl_pct / 100), when=Bull or close > upper)