웨이스 웨이브 볼링거 밴드 거래 전략

저자:차오장, 날짜: 2023-09-13 13:55:24
태그:

이 전략은 시장 트렌드를 결정하기 위해 웨이스 웨이브 지표와 볼린거 밴드를 결합하여 주요 지원/저항 수준에서 브레이크아웃을 거래합니다. 이것은 전형적인 트렌드 다음 브레이크아웃 시스템입니다.

전략 논리:

  1. 웨이스 웨이브를 계산하고 열 트렌드를 사용하여 가격 트렌드를 결정합니다.

  2. BB 상부/하부 대역을 계산하고, 가격이 대역을 넘을 때 거래를 합니다.

  3. 웨이스 웨이브가 상승 추세를 보이며 가격이 BB 상위권에 오를 때 롱으로 이동합니다.

  4. 웨이스 웨이브가 하락 추세를 보이며 가격이 BB 밑바닥을 넘을 때 단축합니다.

  5. 역동 트렌드가 나타났을 때 이익/손실 출구를 사용한다.

장점:

  1. 웨이스 웨이브는 주요 트렌드 방향을 정확하게 평가합니다.

  2. BB는 주요 지지/저항 수준을 식별합니다.

  3. 지표를 조합하면 정확도가 높아집니다.

위험성:

  1. 웨이스 파동과 BB 레이그 모두, 잘못된 입력 타이밍을 유발합니다.

  2. 탈옥은 함정에 빠질 수 있어 멈춰야 합니다.

  3. 다양한 시장에서 지속적인 추세와 명확한 파열을 찾기가 어렵습니다.

요약하자면, 이 전략은 트렌드 편향 및 거래 브레이크오웃을 위해 웨이스 웨이브와 BB를 결합합니다. 정확도를 다소 향상시킬 수 있지만 지연 및 범위 가격 움직임에 대한 주의가 필요합니다.


/*backtest
start: 2023-08-13 00:00:00
end: 2023-09-12 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © sharatgbhat

//@version=4
// strategy("Weis BB Strategy", overlay=false, default_qty_type = strategy.percent_of_equity, default_qty_value = 10,max_lines_count = 500, max_labels_count = 500)
maxIdLossPcnt = input(1, "Max Intraday Loss(%)", type=input.float)
// strategy.risk.max_intraday_loss(maxIdLossPcnt, strategy.percent_of_equity)

method = input(defval="ATR", options=["ATR", "Traditional", "Part of Price"], title="Renko Assignment Method")
methodvalue = input(defval=14.0, type=input.float, minval=0, title="Value")
pricesource = input(defval="Close", options=["Close", "Open / Close", "High / Low"], title="Price Source")
useClose = pricesource == "Close"
useOpenClose = pricesource == "Open / Close" or useClose
useTrueRange = input(defval="Auto", options=["Always", "Auto", "Never"], title="Use True Range instead of Volume")
isOscillating = input(defval=false, type=input.bool, title="Oscillating")
normalize = input(defval=false, type=input.bool, title="Normalize")
vol = useTrueRange == "Always" or useTrueRange == "Auto" and na(volume) ? tr : volume
op = useClose ? close : open
hi = useOpenClose ? close >= op ? close : op : high
lo = useOpenClose ? close <= op ? close : op : low

if method == "ATR"
    methodvalue := atr(round(methodvalue))
if method == "Part of Price"
    methodvalue := close / methodvalue

currclose = float(na)
prevclose = nz(currclose[1])
prevhigh = prevclose + methodvalue
prevlow = prevclose - methodvalue
currclose := hi > prevhigh ? hi : lo < prevlow ? lo : prevclose

direction = int(na)
direction := currclose > prevclose ? 1 : currclose < prevclose ? -1 : nz(direction[1])
directionHasChanged = change(direction) != 0
directionIsUp = direction > 0
directionIsDown = direction < 0

barcount = 1
barcount := not directionHasChanged and normalize ? barcount[1] + barcount : barcount
vol := not directionHasChanged ? vol[1] + vol : vol
res = barcount > 1 ? vol / barcount : vol

plot(isOscillating and directionIsDown ? -res : res, style=plot.style_columns, color=directionIsUp ? color.green : color.red, transp=75, linewidth=3, title="Wave Volume")

length = input(14, minval=1)
src = input(close, title="Source")
mult = input(2, minval=0.001, maxval=50, title="StdDev")
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev
offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)
plot(basis, "Basis", color=#FF6D00, offset = offset)
p1 = plot(upper, "Upper", color=#2962FF, offset = offset)
p2 = plot(lower, "Lower", color=#2962FF, offset = offset)
fill(p1, p2, title = "Background", color=color.rgb(33, 150, 243, 95))

MomentumBull = close>upper
MomentumBear = close<lower

if (MomentumBull and directionIsUp)
	strategy.entry("Buy", strategy.long)
if (MomentumBear and directionIsDown)
	strategy.entry("Sell", strategy.short)
    strategy.exit("exit","Buy",when=directionIsDown,qty_percent=100,profit=20,loss=10)
    strategy.exit("exit","Sell",when=directionIsUp,qty_percent=100,profit=20,loss=10)
    

더 많은