
이 전략은 브린 밴드 (BB), 이동 평균 (MA) 및 상대적으로 약한 지수 (RSI) 의 조합을 사용하여 단기 가격 변동을 포착하여 다단계 거래를 목적으로 한다. 가격이 상반도 및 이동 평균보다 높고 RSI 지표가 초과 상태를 표시할 때 전략은 다단계 입장을 한다. 전략은 위험 및 수익을 관리하고 수익을 잠금하기 위해 백분율의 중지 및 정지를 통해 위험을 관리하고, 거래자의 Bybit 계정 수준에 따라 입점 가격을 조정하여 수수료의 영향을 고려한다.
이 전략은 다음과 같은 원칙에 기초하고 있습니다.
이 전략은 이 세 가지 지표를 결합하여, 가격이 부린대를 뚫고 궤도에 올랐을 때, 이동 평균보다 높고, RSI가 과매매 지역에서 있을 때, 시장이 상승할 가능성이 있다고 생각하여 다중 입장을 취합니다. 동시에, 전략은 위험을 제어하고 이익을 잠금하기 위해 중지 및 중지 가격을 설정합니다.
이 전략은 브린밴드, 이동 평균 및 RSI의 조합을 사용하여 단기 다단계 거래 기회를 식별한다. 그것은 브린밴드 및 이동 평균을 통해 트렌드를 결정하고, RSI를 사용하여 과매매를 식별하고, 위험을 관리하기 위해 중지 손실을 설정한다. 이 전략은 수수료의 영향을 고려하고, 거래자의 Bybit 계정 수준에 따라 조정된다. 이 전략은 장점이 있지만, 잘못된 신호, 시장의 변동 및 추세 역전과 같은 위험이 있습니다.
/*backtest
start: 2023-05-08 00:00:00
end: 2024-05-13 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@BryanAaron
//@version=5
strategy("Bybit . BB Short-Term Trading Strategy - Long Only", overlay=true)
// Input parameters
bbLength = input(45, title="BB Length")
bbMultiplier = input(1.0, title="BB Multiplier")
maLength = input(90, title="MA Length")
rsiLength = input(5, title="RSI Length")
rsiUpperThreshold = input(85, title="RSI Upper Threshold")
rsiLowerThreshold = input(45, title="RSI Lower Threshold")
slPerc = input(2.0, title="Stop Loss %")
tpPerc = input(4.0, title="Take Profit %")
bybitAccountLevel = input.string("VIP 0", title="Bybit Account Level", options=["VIP 0", "VIP 1", "VIP 2", "VIP 3", "VIP 4"])
// Calculate Bollinger Bands
[bbMiddle, bbUpper, bbLower] = ta.bb(close, bbLength, bbMultiplier)
// Calculate moving average
ma = ta.sma(close, maLength)
// Calculate RSI
rsi = ta.rsi(close, rsiLength)
// Trading conditions
longCondition = close > bbUpper and close > ma and rsi < rsiLowerThreshold
shortCondition = close < bbLower and close < ma and rsi > rsiUpperThreshold
// Entry and exit signals
var bool longEntry = false
var bool shortEntry = false
if (longCondition and not longEntry)
longEntry := true
shortEntry := false
else if (shortCondition and not shortEntry)
shortEntry := true
longEntry := false
else if (not longCondition and not shortCondition)
longEntry := false
shortEntry := false
// Set commission based on Bybit account level
commissionPerc = switch bybitAccountLevel
"VIP 0" => 0.075
"VIP 1" => 0.065
"VIP 2" => 0.055
"VIP 3" => 0.045
"VIP 4" => 0.035
=> 0.075
// Adjust entry prices based on commission
longEntryPrice = close * (1 + commissionPerc / 100)
shortEntryPrice = close * (1 - commissionPerc / 100)
// Calculate stop loss and take profit prices
longStopPrice = longEntryPrice * (1 - slPerc / 100)
longProfitPrice = longEntryPrice * (1 + tpPerc / 100)
shortStopPrice = shortEntryPrice * (1 + slPerc / 100)
shortProfitPrice = shortEntryPrice * (1 - tpPerc / 100)
// Plot signals
plotshape(longEntry, title="Long Entry", location=location.belowbar, style=shape.triangleup, size=size.small, color=color.green)
plotshape(shortEntry, title="Short Entry", location=location.abovebar, style=shape.triangledown, size=size.small, color=color.red)
// Entry and exit
if (longEntry)
strategy.entry("Long", strategy.long, limit=longEntryPrice, stop=longStopPrice, comment="Long Entry")
strategy.exit("Long TP/SL", from_entry="Long", limit=longProfitPrice, stop=longStopPrice, comment="Long Exit")
else if (shortEntry)
strategy.entry("Short", strategy.short, limit=shortEntryPrice, stop=shortStopPrice, comment="Short Entry")
strategy.exit("Short TP/SL", from_entry="Short", limit=shortProfitPrice, stop=shortStopPrice, comment="Short Exit")
else
strategy.close_all(comment="Close All")
// Plot Bollinger Bands
plot(bbUpper, color=color.blue, title="BB Upper")
plot(bbMiddle, color=color.orange, title="BB Middle")
plot(bbLower, color=color.blue, title="BB Lower")
// Plot moving average
plot(ma, color=color.purple, title="MA")