
이 전략은 RSI 지표를 통해 과매매를 판단하고, 빠른 라인, 중간 라인, 느린 라인을 결합한 트렌드 판단 시스템으로, 가격이 점프할 때 포지션을 구축할 기회를 판단한다.
빠른 라인에서 중간 라인을 통과하고 RSI 지표가 과매매 할 때 추가로 입금하십시오.
하위 라인이 중간 라인을 통과하고 RSI 지표가 과매매를 표시하면 공백으로 입금하십시오.
입시 가격의 4%로 정지 손실을 설정합니다
이윤을 얻는 방법은 20%를 막고, 가격이 계속 상승하면 15%를 막고, 순차적으로 포지션을 종료하는 것입니다.
이 전략은 평평선 지표와 RSI를 결합하여 가격 변화의 추세를 포착하면서 매매 기회를 판단하는 것이 더 일반적인 추세 추적 전략에 속합니다. 변수 테스트와 다른 보조 판단 지표를 추가하여 전략의 승률을 더욱 최적화하고 향상시킬 수 있습니다.
/*backtest
start: 2023-11-13 00:00:00
end: 2023-11-20 00:00:00
period: 1m
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/
// © syfuslokust
//@version=4
strategy(shorttitle='CoinruleCombinedCryptoStrat',title='CoinruleCombinedCryptoStrat', overlay=true)
// RSI inputs and calculations
lengthRSI = 14
RSI = rsi(close, lengthRSI)
//Normal
oversold = input(30)
overbought = input(70)
//ALGO
//oversold= input(26)
//overbought= input(80)
//sell pct
SellPct = input(20)
ExitPct = input(15)
//MA inputs and calculations
movingaverage_signal = sma(close, input(9))
movingaverage_fast = sma(close, input(50))
movingaverage_slow = sma(close, input(200))
movingaverage_mid= sma(close, input(100))
//Look Back
inp_lkb = input(12, title='Lookback Long Period')
inp_lkb_2 = input(2, title='Lookback Short Period')
perc_change(lkb) =>
overall_change = ((close[0] - close[lkb]) / close[lkb]) * 100
//Entry
//MA
bullish = crossover(movingaverage_signal, movingaverage_fast)
//Execute buy
strategy.entry(id="long", long = true, when = (RSI < oversold and movingaverage_fast < movingaverage_mid))
//when = crossover(close, movingaverage_signal) and movingaverage_signal < movingaverage_slow and RSI < oversold)
//Exit
//RSI
Stop_loss= ((input (4))/100)
longStopPrice = strategy.position_avg_price * (1 - Stop_loss)
//MA
bearish = crossunder(movingaverage_signal, movingaverage_fast)
//Execute sell
strategy.close("long", qty_percent = SellPct, when = RSI > overbought and movingaverage_fast > movingaverage_mid)
//when = (crossunder(low, movingaverage_signal) and movingaverage_fast > movingaverage_slow and RSI > overbought) or (movingaverage_signal < movingaverage_fast and crossunder(low, movingaverage_fast)) or (low < longStopPrice))
//PLOT
plot(movingaverage_signal, color=color.black, linewidth=2, title="signal")
plot(movingaverage_fast, color=color.orange, linewidth=2, title="fast")
plot(movingaverage_slow, color=color.purple, linewidth=2, title="slow")
plot(movingaverage_mid, color=color.blue, linewidth=2, title="mid")