효율적인 양상 거래 전략

저자:차오장, 날짜: 2024-02-01 15:09:06
태그:

img

전반적인 설명

이 전략은 주로 5일 RSI 지표와 200일 이동평균을 결합하여 기술 지표 조합 전략에 속하는 거래 결정 신호를 형성합니다. 주요 거래 원칙은: 가격이 과잉 구매/ 과잉 판매 영역으로 달릴 때 판매 신호; 가격이 과잉 판매 영역으로 떨어질 때 구매 신호입니다. 이 전략의 가장 큰 장점은 전략 신호가 상대적으로 명확하고 리트레이싱 위험이 상대적으로 작다는 것입니다. 그러나 단일 기술 지표 조합에만 기반한 거래 결정을 형성하는 데에도 한계가 있습니다. 멀티-팩터 모델과 기계 학습 알고리즘을 통해 최적화 할 수 있습니다.

전략 원칙

이 전략은 주로 5일 RSI 지표와 200일 이동 평균을 결합하여 가격이 달리는 과잉 구매/ 과잉 판매 영역을 판단하고 거래 결정을 만듭니다.

  1. 5일 RSI 지표는 가격이 달리는 과반 구매/ 과반 판매 영역을 판단합니다. 과반 구매 라인은 72로 설정되고 과반 판매 영역은 30입니다. RSI 지표가 밑에서 위로 30을 넘을 때 구매 신호가 생성됩니다. RSI 지표가 위에서 아래로 떨어지면 72 아래로 판매 신호가 생성됩니다.

  2. 200일 이동 평균은 중장기 트렌드의 방향을 결정합니다. 가격이 200일 이동 평균 이하일 때, 그것은 가격의 하락 단계입니다. 가격이 200일 이동 평균 이상일 때, 그것은 가격의 상승 단계입니다.

  3. 1과 2의 판단을 결합하면, 이 전략은 5일 RSI 지표가 과잉 매입되어 72 이하로 떨어지면 판매하고, 5일 RSI가 30 이하로 떨어지고 가격이 200일 이동 평균 이하로 떨어지면 구매합니다.

전략 의 장점

  1. 전략 신호는 상대적으로 명확하며, 판단 영역에 의해 과소 구매/ 과소 판매 신호를 결정하기 위해 RSI 지표를 사용합니다.

  2. 200일 이동 평균은 역행 작전을 피하기 위해 주요 트렌드의 방향을 결정합니다.

  3. 최대 포지션 수를 설정하여 위험을 제어할 수 있습니다.

  4. 전략은 매개 변수 최적화, 조정 가능한 RSI 매개 변수 및 이동 평균 매개 변수를위한 넓은 공간을 가지고 있습니다.

  5. 상대적으로 작은 리트레이싱 리스크는 전략의 최대 리트레이싱을 효과적으로 제어할 수 있습니다.

전략 의 위험

  1. 오직 RSI와 이동 평균 지표만 사용하면 전략 신호는 불안정할 수 있으며, 변동적인 시장에서 장기 및 단기 흔들림 손실의 위험이 있습니다.

  2. 더 나은 전략 결과를 위해 RSI 매개 변수와 이동 평균 매개 변수를 최적화하고 테스트해야 합니다.

  3. 전략 신호를 최적화하기 위해 다른 지표 또는 모델을 도입할 수 있습니다. 변동성 지표, 기계 학습 판단 등을 도입하는 것과 같은 것입니다.

전략 최적화의 방향

  1. 판단을 위해 MACD, KD, 변동성 지표와 같은 더 많은 지표 조합을 사용하십시오.

  2. 기계 학습 모델 판단을 늘리십시오. 거래 신호의 안정성을 판단하기 위해 LSTM와 같이.

  3. 거래량 변화, 자본 흐름 방향 및 자본 요인에 대한 다른 판단과 같은 양적 요인을 증가시킵니다.

  4. 전략 매개 변수를 최적화합니다. 예를 들어, RSI 매개 변수, 이동 평균 매개 변수 등

  5. 스톱 손실 메커니즘을 최적화합니다. 예를 들어 이동 스톱 손실, 시간 스톱 손실 등.

요약

이 전략은 주로 5일 RSI 지표와 200일 이동평균 지표의 조합을 사용하여 가격의 과반 구매 / 과반 판매 영역을 판단하고 거래 신호를 형성합니다. 이는 기술 지표 조합 전략에 속합니다. 전략 신호는 비교적 명확하고 최대 리트레이싱 위험은 비교적 작습니다. 그러나 전략 결과를 개선하기 위해 멀티 지표 조합과 기계 학습 판단을 통해 추가로 최적화 할 수 있습니다.


/*backtest
start: 2024-01-24 00:00:00
end: 2024-01-31 00:00:00
period: 3m
basePeriod: 1m
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/
// ©chewyScripts.

//@version=5
strategy("96er RSI+200EMA Strategy + Alerts", overlay=true)
// This works best on a small account $100, with 50% of equity and up to 10 max open trades. 
// 96% Profitable, turns $100 into $350 in 1 month. very few losses. super happy with it.
// So far it triples the account on a 1m chart in 1 month back testing on the SEI-USD pair.
// I did not test on FX pairs or other instruments.
// had some issues with the inputs not working so had to hard code some, also the lastClose var sometimes breaks and starts following every candle, not sure why.

in_r1 = input.int(5,"5 day input or RSI1")
in_openOrders = input.int(3,"max open orders")

in_lowerRSI = input.int(30,"RSI Lower")
in_upperRSI = input.int(72,"RSI Upper ")

in_emaperiod = input.int(200,"EMA Period")

in_buybreakout = input.int(50,"Buy breakout range")

in_buyTP = input.float(1.05,"Buy TP: 1+TP %, .05 seems to work well.")
in_sellTP = input.float(0.9850, "Sell TP: 1-TP%. .025 seems to work well. ")

simple int rsi5 = in_r1

// 3 rsi strategy , when all of them are overbought we sell, and vice versa
rsi7 = ta.rsi(close,rsi5)
lastClose = request.security(syminfo.tickerid, "D", close, lookahead = barmerge.lookahead_on)
rsi3 = ta.rsi(close[5],rsi5)

ma = ta.ema(close,in_emaperiod)

plot(rsi7,"5 Day RSI",color.red)
plot(lastClose,"Yesterdays Close",color.green)
plot(rsi3,"Previous 5th candles RSI",color.purple)


// sell condition
//sell = ta.crossunder(rsi7,70) and ta.crossunder(rsi14,70) and ta.crossunder(rsi21,70)

//buy condition
//buy = ta.crossover(rsi7,in_lowerRSI) and close < ma and rsi3 <= in_upperRSI and strategy.opentrades < in_openOrders
//sell = ta.crossunder(rsi7,in_upperRSI) and close > ma and rsi3 >= in_lowerRSI3 and strategy.opentrades < in_openOrders

buy = ta.crossover(rsi7,in_lowerRSI) and close < ma and close < lastClose and strategy.opentrades < in_openOrders
sell = ta.crossunder(rsi7,in_upperRSI) and close > ma and close > lastClose and strategy.opentrades < in_openOrders


var lastBuy = close 
var lastSell = close 

if (buy)
    strategy.entry("BUY", strategy.long)
    lastBuy := close 
    alert("Buy")

if ((close >= lastBuy*in_buyTP ) or rsi7 > in_buybreakout and close >= lastClose and (close >= lastClose*in_buyTP or close >= lastBuy*in_buyTP ) )
    strategy.close("BUY", "BUY Exit")
    alert("Buy Exit")
    
if (sell)
    strategy.entry("SELL", strategy.short)
    lastSell := close 
    alert("Sell")

if ( close < ma and (close <= lastSell*in_sellTP ) or (close < lastClose*in_sellTP) )
    strategy.close("SELL", "Sell Exit")
    alert("Sell Exit")


더 많은