
이 전략은 무작위 인덱스 평평한 이동 평균 (RSI) 과 인덱스 이동 평균 (EMA) 지표에 기반한 자율적으로 구매하고 보유하는 코인을 Scalper 거래 전략을 구현하기 위해 고안되었습니다. 그것은 5 분 K 라인에 적용되며 BTC를 위해 최적화되었습니다. 전략의 목표는 가로 상위 또는 크게 떨어지지 않을 때 가능한 한 많은 코인을 보유하는 것입니다.
이 전략은 RSI 지표를 사용하여 과매매 영역에 있는지 여부를 판단하고, 무작위 RSI 지표의 K값과 D값 관계를 결합하여 구매 및 판매 신호를 발송한다.
무작위 RSI의 K선이 20보다 낮으면 과매매로 간주되며, K선이 D선보다 크면 구매 신호가 발생한다. 다음의 세 가지 조건에 따라 매매가 결정된다. 1) 가격 상승이 1% 이상되면 EMA 반전이 발생한다.
또한, 단기 EMA가 상승한 후 하향으로 전환되면 판매 신호로 간주됩니다.
이 전략은 무작위 RSI 및 EMA와 같은 여러 지표의 장점을 통합하여 구매 및 판매 시기를 판단하는보다 탄탄한 방법을 사용합니다. 매개 변수 최적화 및 위험 관리를 통해 전략의 수익률과 안정성을 더욱 향상시킬 수 있습니다.
/*backtest
start: 2023-09-30 00:00:00
end: 2023-10-30 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(title="Stochastic RSI W Auto Buy Scalper Scirpt III ", shorttitle="Stoch RSI_III", format=format.price, precision=2)
smoothK = input.int(3, "K", minval=1)
smoothD = input.int(3, "D", minval=1)
lengthRSI = input.int(14, "RSI Length", minval=1)
lengthStoch = input.int(14, "Stochastic Length", minval=1)
src = input(close, title="RSI Source")
rsi1 = ta.rsi(src, lengthRSI)
k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = ta.sma(k, smoothD)
plot(k, "K", color=#2962FF)
plot(d, "D", color=#FF6D00)
h0 = hline(80, "Upper Band", color=#787B86)
hline(50, "Middle Band", color=color.new(#787B86, 50))
h1 = hline(20, "Lower Band", color=#787B86)
longStopLoss = strategy.opentrades.entry_price(0)* (.985)
stochDropping = ta.falling(k,2)
shortSma = ta.sma(hlc3,12)
shorterSma = ta.sma(hlc3,3)
plot(shortSma[3])
shortSmaFlip = (ta.change(shortSma,3)>0) and ta.falling(hlc3,1)
shorterSmaFlip = (ta.change(shorterSma,2)>0) and ta.falling(hlc3,1)
messageSellText ='"type": "sell", "symbol": "BTCUSD", "marketPosition": "{{strategy.market_position}}"'
messageBuyText ='"type": "buy", "symbol": "BTCUSD", "marketPosition": {{strategy.market_position}}"'
fill(h0, h1, color=color.rgb(33, 150, 243, 90), title="Background")
strategy.entry("Tech", strategy.long, when=(strategy.position_size <= 0 and k<17 and k>d),alert_message=messageBuyText)
//original: strategy.close("TL", when=(strategy.position_size >= 0 and (k>90 and k<d)))
takeProfit = hlc3 > strategy.opentrades.entry_price(0)*1.01
//longStopLoss = strategy.opentrades.entry_price(0)* (.995)
strategy.close("Tech", when=(strategy.position_size >= 0 and (k>90 and k<d and stochDropping)) or close<longStopLoss, comment="rsi or Stop sell",alert_message=messageSellText)
//strategy.close("Tech", when=(strategy.position_size >= 0 and close<longStopLoss), comment="stopLoss sell",alert_message=messageSellText)
strategy.close("Tech", when=(shortSmaFlip and k>20 and takeProfit),comment="Sma after profit",alert_message=messageSellText)