여러 개의 동력 지표를 결합하는 암호화폐 거래 전략

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

이 전략은 Cryptocurrency Trading Strategy Combining Multiple Momentum Indicators라고 불립니다. 이 전략은 거래 신호를 위해 암호화폐의 과잉 구매 및 과잉 판매 조건을 측정하기 위해 MFI, RSI 및 스톡 RSI 지표를 통합합니다.

MFI 지표는 돈 흐름 지표입니다. 구매 및 판매 압력의 강도를 판단하기 위해 양량과 가격 정보를 모두 고려합니다. 20 이하의 MFI는 과판 상태, 80 이상은 과반 상태입니다.

RSI 지표는 상대적 강도 지표이다. 과잉 구매 및 과잉 판매 가격 수준을 나타냅니다. RSI 30 이하는 과잉 판매이며 70 이상은 과잉 구매입니다.

스톡 RSI 지표는 RSI 자체가 과소매 또는 과소매인지 판단하는 RSI 변수입니다. 20-80로 설정된 매개 변수는 과소매 및 과소매 영역을 나타냅니다.

거래의 논리는 다음과 같습니다.

MFI, RSI 및 Stoch RSI가 동시에 과잉 판매 수준 이하로 떨어지면, 그것은 긴 거리에 대한 여러 번 과잉 판매 확인 신호입니다.

세 가지 지표가 모두 과잉 매입 지대 이상이라면, 단축을 위해 여러 번 과잉 매입 확인을 표시합니다.

이 전략의 장점은 여러 지표 확인이 잘못된 신호를 필터하고 입력 정확도를 향상시킬 수 있다는 것입니다. 그러나 매개 변수는 위험을 제어하기 위해 Stop Loss을 추가하여 완전한 최적화가 필요합니다.

결론적으로, 동력 지표는 암호화폐 가격 변동에 민감하며, 여러 가지 지표를 결합하면 전략의 견고성을 향상시킬 수 있습니다. 그럼에도 불구하고, 거래자는 시장 구조의 변화를 관찰하고 전략 조정에서 유연성을 유지해야합니다. 단일 전략은 시장 변동에 완벽하게 적응할 수 없기 때문입니다.


/*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/
// Crypto Crew strategy entry signal long/short with stop loss. Exit signal not provided.
//
// Indicators: MFI + RSI + STOCH RSI
// Entry criteria: long when the three are oversold, short when the three indicators are overbought.
// Exit criteria: Take profit at Fib levels (not demonstrated here) measured from prevous highs/low.
// Feel free to contribute

//@version=4
strategy("Crypto Crew")

//inputs
source = hlc3
rsi_length = input(14, minval=1)
mfi_lenght =  input(14, minval=1)
smoothK = input(3, minval=1)
smoothD = input(3, minval=1)
lengthRSI = input(14, minval=1)
lengthStoch = input(14, minval=1)
okay = "Okay"
good = "Good"
veryGood = "Very good"
tradingOpportunity = input(title="Opportunity Type", defval=veryGood, options=[okay, good, veryGood])
longThreshhold = tradingOpportunity==okay? 40 : tradingOpportunity==good ? 30 : tradingOpportunity==veryGood? 20 : 0
shortThreshhold = tradingOpportunity==okay? 60 : tradingOpportunity==good ? 70 : tradingOpportunity==veryGood? 80 : 0

//lines
mfi = mfi(source, mfi_lenght)
rsi = rsi(source, rsi_length)
rsi1 = rsi(close, lengthRSI)
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)

longSignal = mfi<longThreshhold and rsi<longThreshhold and k<longThreshhold and d<longThreshhold? 1:-1
shortSignal = mfi>shortThreshhold and rsi>shortThreshhold and k>shortThreshhold and d>shortThreshhold? 1:-1

if longSignal > 0
    strategy.entry("Long", strategy.long)
    strategy.exit(id="Long Stop Loss", stop=close*0.8) //20% stop loss 
    
if shortSignal > 0
    strategy.entry("Short", strategy.short, stop=close*1.2)
    strategy.exit(id="Short Stop Loss", stop=close*1.2) //20% stop loss

plot(k, color=color.blue)
plot(d, color=color.red)
plot(rsi, color=color.yellow)
plot(mfi, color=color.blue)
hline(longThreshhold, color=color.gray, linestyle=hline.style_dashed)
hline(shortThreshhold, color=color.gray, linestyle=hline.style_dashed)


더 많은