
この戦略は,ブリン帯の指標に基づく4時間レベルの量化取引システムであり,トレンドの突破と平均値の逆転を組み合わせた取引理念である.この戦略は,ブリン帯の下落の突破によって市場の動きを捕捉し,価格の平均値の逆転の特性を利用して利益を得るために結束し,ストップ・ローズでリスクを制御する.この戦略は,3倍のレバレッジを採用し,収益を保証しながらも,リスク管理も十分に考慮している.
戦略の中核となるロジックは、次の主要な要素に基づいています。
これは,ブリン帯指標のトレンドフォローと平均回帰の特性を組み合わせた戦略であり,厳格なポジション開設条件とリスク管理措置により,トレンドと振動市場の両方で安定した収益を得ることができるという目標を達成する.戦略の核心的な優位性は,明確な取引論理と完善したリスク管理システムにあります.しかし,戦略の安定性と収益性をさらに向上させるために,レバレッジ使用と市場環境判断などの最適化に注意する必要があります.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-10 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger 4H Follow", overlay=true, initial_capital=300, commission_type=strategy.commission.percent, commission_value=0.04)
// StartYear = input(2022,"Backtest Start Year")
// StartMonth = input(1,"Backtest Start Month")
// StartDay = input(1,"Backtest Start Day")
// testStart = timestamp(StartYear,StartMonth,StartDay,0,0)
// EndYear = input(2023,"Backtest End Year")
// EndMonth = input(12,"Backtest End Month")
// EndDay = input(31,"Backtest End Day")
// testEnd = timestamp(EndYear,EndMonth,EndDay,0,0)
lev = 3
// Input parameters
length = input.int(20, title="Bollinger Band Length")
mult = input.float(2.0, title="Bollinger Band Multiplier")
// Bollinger Bands calculation
basis = ta.sma(close, length)
upperBand = basis + mult * ta.stdev(close, length)
lowerBand = basis - mult * ta.stdev(close, length)
// Conditions for Open Long
openLongCondition = strategy.position_size == 0 and close > open and (close + open) / 2 > upperBand
// Conditions for Open Short
openShortCondition = strategy.position_size == 0 and close < open and (close + open) / 2 < lowerBand
// Conditions for Close Long
closeLongCondition = strategy.position_size > 0 and strategy.position_size > 0 and (close < upperBand and open < upperBand and close < open)
// Conditions for Close Short
closeShortCondition = strategy.position_size < 0 and strategy.position_size < 0 and (close > lowerBand and open > lowerBand and close > open)
// Long entry
if openLongCondition
strategy.entry("Long", strategy.long, qty=strategy.equity * lev / close)
strategy.exit("Long SL", from_entry="Long", stop=low) // Set Stop-Loss
// Short entry
if openShortCondition
strategy.entry("Short", strategy.short, qty=strategy.equity * lev / close)
strategy.exit("Short SL", from_entry="Short", stop=high) // Set Stop-Loss
// Long exit
if closeLongCondition
strategy.close("Long", comment = "TP")
// Short exit
if closeShortCondition
strategy.close("Short", comment = "TP")
// Plot Bollinger Bands
plot(upperBand, color=color.yellow, title="Upper Band")
plot(lowerBand, color=color.yellow, title="Lower Band")