
이 전략은 이동 평균과 상대적으로 강한 지표를 사용하여 시장의 추세 방향을 판단하고, 하향 추세에서 점차적으로 단기 포지션을 구축하여 수익을 창출합니다.
100일 간소 이동 평균보다 낮은 가격으로 마감하고 RSI가 30보다 큰 경우, 공백 입장을 니다. 그 다음에는 입구 가격의 3% 이상이며, 입구 가격의 2% 이하의 중지 라인을 설정합니다. 이렇게하면 시장의 변동을 용인 할 수있는 더 큰 중지 공간을 얻을 수 있습니다. 가격이 중지 라인보다 크거나 작은 중지 라인일 때 포지션을 닫습니다.
코인룰 플랫폼에서는 순차적으로 포지션을 구축하기 위해 여러 차례 순차적으로 판매 주문을 설정할 수 있습니다. 시장이 계속 하락하면 포지션을 점차적으로 증가시킵니다. 특정 주문 시간 간격을 설정하는 것도 총 포지션을 제어하는 데 도움이됩니다.
이 전략은 각 거래에 대한 중지 명령과 중지 명령을 연결한다. 중지 비율과 중지 비율은 중장 통화에 최적화되어 있다. 특정 통화에 따라 조정할 수 있다. 전략은 트렌드 거래 방향에 따라, 중지 및 중지 비율은 1:1: 5로 설정할 수 있다.
입시 가격의 3% 입점 가격의 2% Stop Loss Ratio보다 약간 큰 것은 더 큰 변동성을 견딜 수 있고, 불필요한 Stop Loss을 피할 수 있다.
이 전략은 이동 평균 판단 트렌드 방향을 기반으로, RSI 지표 필터 특정 입시 시점을 결정하고, 하락세를 효과적으로 포착할 수 있다. 단계적으로 포지션 방식은 위험을 제어할 수 있고, 중지 손실을 설정하는 스톱 스톱은 단일 거래의 견딜 수 있는 능력을 보장한다. 중지 손실 스톱 스톱 비율을 최적화하면 더 나은 위험 수익률을 얻을 수 있다. 매개 변수 조정 및 위험 제어 측면에서 최적화 할 여지가 있지만, 전반적으로 안정적이고 신뢰할 수있는 짧은 라인 외계 전략이다.
/*backtest
start: 2022-10-31 00:00:00
end: 2023-11-06 00:00:00
period: 1d
basePeriod: 1h
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/
// © Coinrule
//@version=4
strategy(shorttitle='Short In Downtrend',title='Short In Downtrend Below MA100', overlay=true, initial_capital = 1000, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
//Backtest dates
fromMonth = input(defval = 1, title = "From Month", type = input.integer, minval = 1, maxval = 12)
fromDay = input(defval = 10, title = "From Day", type = input.integer, minval = 1, maxval = 31)
fromYear = input(defval = 2019, 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() => true // create function "within window of time"
//MA inputs and calculations
inSignal=input(50, title='MASignal')
MA= sma(close, inSignal)
// RSI inputs and calculations
lengthRSI = input(14, title = 'RSI period', minval=1)
RSI = rsi(close, lengthRSI)
//Entry
strategy.entry(id="short", long = false, when = close < MA and RSI > 30)
//Exit
shortStopPrice = strategy.position_avg_price * (1 + 0.03)
shortTakeProfit = strategy.position_avg_price * (1 - 0.02)
strategy.close("short", when = close > shortStopPrice or close < shortTakeProfit and window())
plot(MA, color=color.purple, linewidth=2)