
이 전략은 두 개의 다른 기간의 이동 평균의 교차를 사용하여 거래합니다. 이 전략은 트렌드 추적 유형 전략에 속합니다. 이 전략은 단기 및 장기 이동 평균의 교차 구매 신호와 판매 신호를 사용하여 트렌드 상황에서 거래합니다.
이 전략은 9주기 단기 이동 평균 SMA와 50주기 장기 이동 평균 LMA를 사용한다. 단기 이동 평균이 아래에서 장기 이동 평균을 통과하면 구매 신호가 발생하며, 단기 이동 평균이 위에서 아래로 장기 이동 평균을 통과하면 판매 신호가 발생한다.
동시에, 전략은 RSI 지표가 트렌드 강도를 판단하는 것을 도입한다. RSI가 설정된 임계 (기본 55) 보다 크면 거래 신호가 생성된다. 이것은 RSI가 초매매 범위에 있을 때 잘못된 신호를 생성하는 것을 피할 수 있다.
전략 매 거래의 자본은 총 자본의 30%이며, 매번 하나의 주문만 할 수 있다. 0.1%의 거래 수수료를 고려한다.
최적화 변수, 다른 지표의 조합으로 수익 기회를 판단, 엄격한 자금 관리, 손실을 설정하여 위험을 줄일 수 있습니다.
이 전략은 간단한 이동 평균 교차 시스템을 통해 트렌드 기회를 잡습니다. 기본 파라미터는 최적화되어 수익이 안정되어 자동 거래에 적합합니다. 다른 보조 지표, 최적화 파라미터를 도입하여 손실을 막는 방법을 개선함으로써 전략의 안정성과 수익률을 더욱 높일 수 있습니다.
/*backtest
start: 2023-09-16 00:00:00
end: 2023-10-16 00:00:00
period: 2h
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/
// © relevantLeader16058
//@version=4
strategy(shorttitle='Maximized Moving Average Crossing ',title='Maximized Moving Average Crossing (by Coinrule)', overlay=true, initial_capital=1000, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)
//Backtest dates
fromMonth = input(defval = 1, title = "From Month", type = input.integer, minval = 1, maxval = 12)
fromDay = input(defval = 1, title = "From Day", type = input.integer, minval = 1, maxval = 31)
fromYear = input(defval = 2020, title = "From Year", type = input.integer, minval = 1970)
thruMonth = input(defval = 1, title = "Thru Month", type = input.integer, minval = 1, maxval = 12)
thruDay = input(defval = 1, title = "Thru Day", type = input.integer, minval = 1, maxval = 31)
thruYear = input(defval = 2112, title = "Thru Year", type = input.integer, minval = 1970)
showDate = input(defval = true, title = "Show Date Range", type = input.bool)
start = timestamp(fromYear, fromMonth, fromDay, 00, 00) // backtest start window
finish = timestamp(thruYear, thruMonth, thruDay, 23, 59) // backtest finish window
window() => time >= start and time <= finish ? true : false // create function "within window of time"
//MA inputs and calculations
inlong=input(50, title='MA long period')
inshort=input(9, title='MA short period')
MAlong = sma(close, inlong)
MAshort= sma(close, inshort)
// RSI inputs and calculations
lengthRSI = (14)
RSI = rsi(close, lengthRSI)
RSI_Signal = input(55, title = 'RSI Trigger', minval=1)
//Entry and Exit
bullish = crossover(MAshort, MAlong)
bearish = crossunder(MAshort, MAlong)
strategy.entry(id="long", long = true, when = bullish and RSI > RSI_Signal and window())
strategy.close(id="long", when = bearish and window())
plot(MAshort, color=color.purple, linewidth=2)
plot(MAlong, color=color.red, linewidth=2)