스타벅스 상승한 해머 거래 전략

저자:차오장, 날짜: 2023-09-18 15:30:15
태그:

전반적인 설명

이 전략은 상승한 망치 촛불 패턴을 식별하고 트렌드를 따르는 거래를위한 트렌드 방향을 결정하기 위해 MACD 지표를 사용합니다. 황소 시장에서 MACD가 상승하는 동안 상승한 망치가 나타날 때 긴 지점을 가집니다. MACD가 하락 할 때 포지션을 닫습니다.

전략 논리

몸과 범위의 비율을 계산하여 상승한 망치를 식별하십시오. 트렌드 방향을 결정하기 위해 MACD를 사용하십시오. MACD가 상승할 때 상승한 망치 신호가 나타나면 길게 이동하십시오. 손실 중지 및 위치 크기를 설정하십시오. MACD가 하락 할 때 종료하십시오.

장점

  • 거품의 해머 인식은 간단하고 명확합니다.
  • MACD는 트렌드 반전을 효과적으로 식별합니다.
  • 트렌드를 따라가는 것 은 문제 를 피할 수 있다
  • 단순하고 직설적인 논리, 실행하기 쉬운

위험성

  • 패턴 인식이 불완전해서 신호를 놓칠 수 있습니다.
  • MACD 트렌드 반전 식별이 지연되었습니다.
  • 낮은 트레이딩 빈도, 높은 트레이딩 빈도에는 적합하지 않습니다.
  • 정확한 전환점을 결정할 수 없습니다. 손실 위험이 있습니다.

위험은 패턴 기준을 완화하고, MACD 매개 변수를 단축하고, 2차 지표를 추가함으로써 완화 될 수 있습니다.

개선

  • 머 패턴 식별 규칙을 최적화
  • 다른 MACD 매개 변수 설정을 테스트
  • 반전을 결정하기 위해 다른 지표를 추가하는 것을 고려하십시오.
  • 다양한 제품에서 견고성을 테스트합니다.

결론

이 전략은 트렌드 결정에 대한 패턴 및 지표 분석을 통합하여 안정적인 수익을 가능하게합니다. 매개 변수 최적화와 같은 추가 정교화는 실용적인 양 거래 전략으로 만들 수 있습니다.


/*backtest
start: 2023-08-18 00:00:00
end: 2023-09-17 00:00:00
period: 3h
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/
// © FenixCapital

//@version=4
strategy("Starbux", overlay=true)


//VARIABLES

//Candlestick Variables
body=close-open
range=high-low
middle=(open+close)/2
abody=abs(body)
arange=abs(range)
ratio=abody/range
longcandle= (ratio>0.6)
bodytop=max(open, close)
bodybottom=min(open, close)
shadowtop=high-bodytop
shadowbottom=bodybottom-low

//Closing Variables

macd=macd(close,12,26,9)
[macdLine, signalLine, histLine] = macd(close, 12, 26, 9)
//plot(macdLine, color=color.blue)
//plot(signalLine, color=color.orange)
//plot(histLine, color=color.red, style=plot.style_histogram)

rsi=rsi(close,14)

sma50= sma(close,50)
sma200= sma(close,200)

exitrsi=rsi > 76
exitmacd=macdLine >0 and signalLine>0
//exitmacd=crossunder(macdLine,signalLine)
stopprice= crossunder(sma50,sma200)

//Candlestick Plotting
blh = (arange*0.33>=abody and close>open and shadowbottom>=abody*2 and shadowtop<=arange*0.1)
plotshape(blh, title= "Bullish Hammer", location=location.belowbar, color=color.lime, style=shape.arrowup, text="Bull\nHammer")

//beh = (arange*0.25>=abody and close<open and shadowtop>=abody*2 and shadowbottom<=arange*0.05)
//plotshape(beh, title= "Bearish Hammer", color=color.orange, style=shape.arrowdown, text="Bear\nHammer")

//bpu = (open>close and close>low and shadowbottom>2*abody)
//plotshape(bpu, title= "Black Paper Umbrella", color=color.red, style=shape.arrowdown, text="Black\nPaper\nUmbrella")

//Trend Signal
bull5= sma50 > sma200
bullmacd=macdLine>=0 and signalLine>=0
bearmacd=macdLine<= 0 and signalLine<=0

//Trading Algorithm
longCondition = blh and bearmacd and volume>volume[1]

if (longCondition)
    strategy.order("Buy", true, 1, when=longCondition)
strategy.risk.max_position_size(10)
//strategy.risk.max_drawdown(25,strategy.percent_of_equity)

exitlong = exitmacd
if (exitlong)
    strategy.close_all()


더 많은