
この戦略は,ブリン帯 (Bollinger Bands) の動的な突破をベースにした量的な取引システムである.これは,複数の移動平均のタイプ (SMA,EMA,SMMA,WMA,VWMAを含む) を組み合わせてブリン帯を構成し,価格とブリン帯の軌道上および下との関係によって取引決定を行う.戦略の核心思想は,価格がブリン帯を軌道上破るときの上昇傾向を捕捉し,価格が軌道下破るときの時効停止である.
戦略の仕組みは,主に以下のいくつかの重要な要素で構成されています.
これは,ブリン帯をベースとした完全な取引システムであり,優れた適応性と拡張性がある.複数の移動平均型を選択し,柔軟なパラメータ設定により,異なる市場環境に対応できる.戦略のリスク管理機構は比較的完備しているが,まだ最適化の余地がある.戦略の安定性と収益性を高めるために,信号確認機構の強化とリスク管理の最適化に重点を置くことをお勧めする.
/*backtest
start: 2024-06-30 00:00:00
end: 2025-02-18 08:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Binance","currency":"DOGE_USDT"}]
*/
//@version=6
strategy(shorttitle="BB Demo", title="Demo GPT - Bollinger Bands", overlay=true, commission_type=strategy.commission.percent, commission_value=0.1, slippage=0, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Inputs
length = input.int(20, minval=1, title="Length")
maType = input.string("SMA", "Basis MA Type", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"])
src = input.source(close, title="Source")
mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev")
offset = input.int(0, "Offset", minval=-500, maxval=500)
// MA Calculation Function
ma(source, length, _type) =>
switch _type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
// Indicator Calculations
basis = ma(src, length, maType)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
// Visual Plots
plot(basis, "Basis", color=color.new(#2962FF, 0), offset=offset)
p1 = plot(upper, "Upper", color=color.new(#F23645, 0), offset=offset)
p2 = plot(lower, "Lower", color=color.new(#089981, 0), offset=offset)
fill(p1, p2, color=color.rgb(33, 150, 243, 95), title="Background")
// Strategy Logic
longCondition = close > upper
exitCondition = close < lower
if longCondition
strategy.entry("Long", strategy.long)
if exitCondition
strategy.close("Long")