이중 채널 부엌 - 부 성장에 초점을 맞춘 알고리즘 거래 전략

저자:차오장, 날짜: 2023-10-10 15:25:53
태그:

전반적인 설명

Double Channel Kitchen 전략은 수퍼트렌드 및 스톡RSI 지표를 사용하여 가격 추세와 과도한 구매/대판 조건을 다양한 시간 프레임에서 분석하여 잠재적 인 구매 및 판매 신호를 식별합니다. 이 전략은 주요 트렌드 방향을 따라 거래하고 중장기 동안의 주요 가격 움직임을 포착하는 것을 목표로합니다.

전략 논리

이 전략은 가격 트렌드 방향을 결정하기 위해 1시간 및 4시간 시간 프레임 모두에서 슈퍼트렌드 지표를 사용합니다. 두 시간 프레임의 슈퍼트렌드가 같은 방향으로 지면 상대적으로 강한 가격 트렌드를 나타냅니다.

또한, 스톡RSI 지표는 과잉 구매/ 과잉 판매 조건을 감지하는 데 사용됩니다. 스톡RSI는 RSI와 스톡라스틱 오시레이터 지표의 강점을 결합합니다. 스톡RSI 라인이 과잉 구매 임계치를 넘을 때, 그것은 가격에서 가능한 과잉 판매 상태를 나타냅니다. 스톡RSI 라인이 과잉 판매 임계치를 넘을 때, 그것은 잠재적 인 과잉 구매 상태를 표시합니다.

가격 트렌드의 이중 슈퍼 트렌드 확인과 함께, 만약 스톡RSI가 과잉 구매/ 과잉 판매 신호를 보여주면, 그것은 구매 또는 판매를 위한 좋은 기회를 제시한다. 신호를 추가로 검증하기 위해, 스톡RSI 과잉 구매/ 과잉 판매 신호 이후, 지난 몇 바의 가격 움직임이 확인되는 룩백 기간이 구현된다. 만약 스톡RSI 신호를 확인한다면, 구매 또는 판매가 시작될 것이다.

요약하면 이 전략은 두 가지 시간 프레임을 사용합니다. 슈퍼 트렌드 주요 트렌드를 결정하고, StochRSI는 지역 반전을 식별하고, 중장기적으로 트렌드를 따르는 거래를 수행합니다.

전략 의 장점

  • 여러 시간 프레임에 걸쳐 표시기를 사용하면 잘못된 신호를 필터링 할 수 있습니다.
  • 트렌드 분석과 과잉 구매/ 과잉 판매 분석을 위해 슈퍼트렌드와 스톡RSI의 강점을 결합합니다.
  • 리크백 검증은 불필요한 거래를 피합니다.
  • 중장기 거래는 과도한 거래와 미끄러짐을 피합니다.
  • 쉽게 이해할 수 있는 듀얼 표시기 설정, 유연한 매개 변수 조정

전략 의 위험

  • 명확한 중장기 트렌드가 없는 불안한 시장은 잘못된 신호를 일으킬 수 있습니다.
  • 과도한 회상 기간은 좋은 진입 기회를 놓칠 수 있습니다.
  • 부적절한 StochRSI 매개 변수 설정은 잘못된 과잉 구매/ 과잉 판매 신호로 이어질 수 있습니다.
  • 부적절한 슈퍼트렌드 매개 변수는 잘못된 트렌드 방향 판단을 일으킬 수 있습니다.
  • 기계적 신호는 주요 근본적인 변화를 무시합니다.

개선 사항:

  • StochRSI 및 Supertrend 매개 변수 조합을 최적화
  • 다른 시장 조건에 기초한 리크백 기간 조정
  • 신호 검증을 위한 부피 표시기를 추가합니다.
  • 주요 주요 뉴스 이벤트를 모니터링하고 필요한 경우 수동 개입

개선 영역

  • 다단계 스크리닝을 위해 다른 시간 프레임에 더 많은 슈퍼 트렌드 지표를 추가
  • StochRSI를 다른 과잉 구매/ 과잉 판매 지표로 대체하십시오. 예를 들어 KD, RSI
  • 트렌드를 타기 위해 후속 스톱 손실 전략을 포함
  • 주요 트렌드를 결정하기 위해 주요 이동 평균을 결합하십시오. 예를 들어 30 기간 MA
  • 안정성을 위한 자동 파라미터 최적화를 개발

결론

더블 채널 키친 (Double Channel Kitchen) 전략은 주요 트렌드와 로컬 역전 (local reversals) 에 대한 슈퍼트렌드를 효과적으로 활용하여 신뢰할 수있는 트렌드 다음 시스템을 구현합니다. 과도한 거래 및 미끄러짐을 피하기 위해 중장기 지분 보유에 초점을 맞추고 있습니다. 매개 변수 최적화, 지표 조합을 통해이 전략은 꾸준한 긍정적 결과를 얻을 수 있습니다. 그러나 투자자는 여전히 기동적으로 지표 신호를 따르는 대신 주요 근본적인 변화에 주의해야합니다. 전반적으로이 전략은 적극적인 투자자에게 적절한 위험 인식으로 긍정적 인 수익을 창출 할 수있는 효과적인 기술 분석 접근 방식을 제공합니다.


/*backtest
start: 2023-09-09 00:00:00
end: 2023-10-09 00:00:00
period: 4h
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/
// © Baby_whale_to_moon

//@version=5
strategy('Kitchen [ilovealgotrading]', overlay=true, format=format.price, initial_capital = 1000)

// BACKTEST DATE
Start_Time = input(defval=timestamp('01 January 2017 13:30 +0000'), title='Start_Time', group = " ################# BACKTEST DATE ################ " )
End_Time = input(defval=timestamp('30 April 2024 19:30 +0000'), title='End_Time', group = " ################# BACKTEST DATE ################ " )

// supertrend 
atrPeriod = input(10, 'ATR Length', group = " #################  Supertrend  ################ ")
factor = input(3, 'Factor', group = " #################  Supertrend  ################ ")

time1 = input.string(title='Short Time Period', defval='07 1h', options=['01 1m','02 3m','03 5m',  '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " #################  Supertrend  ################ ",tooltip = "this timeframe is the value of our short-time supertrend indicator")
time2 = input.string(title='Long Time Period', defval='10 4h', options=[ '01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " #################  Supertrend  ################ ",tooltip = "this timeframe is the value of our long-time supertrend indicator")


res(Resolution) =>
    if Resolution == '00 Current'
        timeframe.period
    else
        if Resolution == '01 1m'
            '1'
        else
            if Resolution == '02 3m'
                '3'
            else
                if Resolution == '03 5m'
                    '5'
                else
                    if Resolution == '04 15m'
                        '15'
                    else
                        if Resolution == '05 30m'
                            '30'
                        else
                            if Resolution == '06 45m'
                                '45'
                            else
                                if Resolution == '07 1h'
                                    '60'
                                else
                                    if Resolution == '08 2h'
                                        '120'
                                    else
                                        if Resolution == '09 3h'
                                            '180'
                                        else
                                            if Resolution == '10 4h'
                                                '240'
                                            else
                                                if Resolution == '11 1D'
                                                    '1D'
                                                else
                                                    if Resolution == '12 1W'
                                                        '1W'
                                                    else
                                                        if Resolution == '13 1M'
                                                            '1M'


// supertrend Long time period 
[supertrend2, direction2] = request.security(syminfo.tickerid, res(time2), ta.supertrend(factor, atrPeriod))
bodyMiddle4 = plot((open + close) / 2, display=display.none)
upTrend2 = plot(direction2 < 0 ? supertrend2 : na, 'Up Trend', color=color.new(color.green, 0), style=plot.style_linebr, linewidth=2)
downTrend2 = plot(direction2 < 0 ? na : supertrend2, 'Down Trend', color=color.new(color.red, 0), style=plot.style_linebr, linewidth=2)

// supertrend short time period 
[supertrend1, direction1] = request.security(syminfo.tickerid, res(time1), ta.supertrend(factor, atrPeriod))
bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction1 < 0 ? supertrend1 : na, 'Up Trend', color=color.new(color.yellow, 0), style=plot.style_linebr)
downTrend = plot(direction1 < 0 ? na : supertrend1, 'Down Trend', color=color.new(color.orange, 0), style=plot.style_linebr)


// Stochastic RSI
low_limit_stoch_rsi = input.float(title = 'Stoch Rsi Low Limit', step=0.5, defval=15, group = " #################  Stoch RSI   ################ ", tooltip = "when Stock rsi value crossover Low Limit value we get Long")
up_limit_stoch_rsi = input.float(title = 'Stoch Rsi Up Limit', step=0.5, defval=85, group = " #################  Stoch RSI   ################ ", tooltip = "when Stock rsi value crossunder Up Limit value we get Short")
stocrsi_back_length = input.int(20, 'Stoch Rsi retroactive length', minval=1, group = " #################  Stoch RSI   ################ ", tooltip = "How many candles are left behind, even if there is a buy or sell signal, it will be valid now")
smoothK = input.int(3, 'Stochastic RSI K', minval=1, group = " #################  Stoch RSI   ################ ")
lengthRSI = input.int(14, 'RSI Length', minval=1, group = " #################  Stoch RSI   ################ ")
lengthStoch = input.int(14, 'Stochastic Length', minval=1, group = " #################  Stoch RSI   ################ ")
src_rsi = input(close, title='RSI Source', group = " #################  Stoch RSI   ################ ")
rsi1 = request.security(syminfo.tickerid, '240', ta.rsi(src_rsi, lengthRSI))
k = request.security(syminfo.tickerid, '240', ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK))

// Strategy settings 
dollar = input.float(title='Dollar Cost Per Position ', defval=20000, group = " #################  Strategy Settings  ################ ")
trade_direction = input.string(title='Trade_direction', group = " #################  Strategy Settings  ################ ", options=['LONG', 'SHORT', 'BOTH'], defval='BOTH')
Long_message_open = input('Long Open', title = "Long Open Message", group = " #################  Strategy Settings  ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Long Open Message ")
Short_message_open = input('Short Open', title = "Short Open Message", group = " #################  Strategy Settings  ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Short Open Message ")
Long_message_close = input('Long Close', title = "Long Close Message", group = " #################  Strategy Settings  ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Long Close Message ")
Short_message_close = input('Short Close', title = "Short Close Message", group = " #################  Strategy Settings  ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Short Close Message ")

Time_interval = true
bgcolor(Time_interval ? color.rgb(255, 235, 59, 95) : na)

back_long = 0
back_short = 0

for i = 1 to stocrsi_back_length by 1
    if ta.crossover(k, low_limit_stoch_rsi)[i] == true 
        back_long += i
        back_long
    if ta.crossunder(k, up_limit_stoch_rsi)[i] == true 
        back_short += i
        back_short

// bgcolor(back_long>0?color.rgb(153, 246, 164, 54):na)
// bgcolor(back_short>0?color.rgb(246, 153, 153, 54):na)

buy_signal = false
sell_signal = false

if direction2 < 0 and direction1 < 0 and back_long > 0
    buy_signal := true
    buy_signal

if direction2 > 0 and direction1 > 0 and back_short > 0
    sell_signal := true
    sell_signal


//bgcolor(buy_signal  ? color.new(color.lime,90) : na ,title="BUY bgcolor")
plotshape( buy_signal[1] == false and  strategy.opentrades == 0 and Time_interval and buy_signal  ? supertrend2 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white)

//bgcolor(sell_signal  ? color.new(color.red,90) : na ,title="SELL bgcolor")
plotshape(sell_signal[1] == false and strategy.opentrades == 0 and Time_interval and sell_signal  ? supertrend2 : na , title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white)


// Strategy entries 
if strategy.opentrades == 0 and Time_interval and buy_signal and ( trade_direction == 'LONG' or trade_direction == 'BOTH')
    strategy.entry('Long_Open', strategy.long, qty=dollar / close, alert_message=Long_message_open)

if strategy.opentrades == 0 and Time_interval and sell_signal and ( trade_direction == 'SHORT' or trade_direction == 'BOTH')
    strategy.entry('Short_Open', strategy.short, qty=dollar / close, alert_message=Short_message_open)


// Strategy Close
if close < supertrend1 and strategy.position_size > 0 
    strategy.exit('Long_Close',from_entry = "Long_Open", stop=close, qty_percent=100, alert_message=Long_message_close)

if close > supertrend1 and strategy.position_size < 0 
    strategy.exit('Short_Close',from_entry = "Short_Open", stop=close, qty_percent=100, alert_message=Short_message_close)



더 많은