모멘텀 가격 채널 진입 및 종료 전략


생성 날짜: 2023-12-06 16:44:32 마지막으로 수정됨: 2023-12-06 16:44:32
복사: 1 클릭수: 611
avatar of ChaoZhang ChaoZhang
1
집중하다
1619
수행원

모멘텀 가격 채널 진입 및 종료 전략

개요

이 전략은 가격 통로 지표에 기반하여 동력 파라미터를 설정하여 다양한 주기의 최고 가격과 최저 가격의 평균을 계산하여 가격 통로 중선을 형성합니다. 이를 기준으로 긴 선과 짧은 선을 설정합니다. 가격이 긴 선을 돌파 할 때, 더 많은 것을하십시오. 가격이 짧은 선을 돌파 할 때, 공백을하십시오. 평준 상태는 가격의 통로 중선으로 돌아갑니다.

전략 원칙

이 전략은 가격 통로 지표를 사용하여 다양한 주기 동안의 최고 가격과 최저 가격의 평균을 계산하여 가격 통로 중선을 형성한다. 중선을 기준으로, Shift 파라미터를 통해 긴 선과 짧은 선을 설정한다. 구체적으로, 긴 선의 계산 공식은: 중선 + ((중선 × 긴 선 파라미트%); 짧은 선의 계산 공식은: 중선 + ((중선 × 짧은 선 파라미트%) 이다.

가격이 긴 선보다 낮을 때, 제한 가격 단편을 사용하여 여러 주문을 열고; 가격이 짧은 선보다 높을 때, 제한 가격 단편을 사용하여 여러 주문을 열고. 다중 공중선에서 손실을 막는 방법은 가격 회귀 채널 중선이다.

우위 분석

이 전략은 다음과 같은 장점을 가지고 있습니다.

  1. 가격 통로 지표를 사용하면 가격 추세와 중요한 지지 저항 지점을 효과적으로 캡처 할 수 있습니다.
  2. 브레이크 레코드 방식으로 포지션을 개설하면 가짜 브레이크로 인한 손실을 줄일 수 있다.
  3. 스톱로스는 가격 통로의 중선을 기준으로 직접적으로, 가격 스톱로스를 따라오는 과도한 손실을 피한다.

위험 분석

이 전략에는 몇 가지 위험도 있습니다.

  1. 가격 통로 매개 변수가 잘못 설정되어있기 때문에, 긍정적인 상황을 놓칠 수 있고, 가짜 돌파구를 너무 많이 만들어 낼 수 있다.
  2. “이번 해킹은 어느 정도 경유비용을 들게 합니다.
  3. 가격의 급격한 하락 기간 동안, 적자를 제때 막을 수 없습니다.

최적화 변수, 중지 주문, 또는 다른 지표 판단과 결합하여 위와 같은 위험을 줄일 수 있습니다.

최적화 방향

이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.

  1. 가격 채널의 최적화 파라미터를 찾아서 최적의 조합을 찾습니다.
  2. K선 형태, 지표 공백 신호 등과 같은 다른 포지션 개설 방법을 시도하십시오.
  3. 가격의 급격한 하락으로 인한 손실을 방지하기 위해 Stop Loss 설정을 추가하십시오.
  4. 거래량, 변동성 등의 지표와 함께, 주식 시장에서 가짜 돌파구를 피하십시오.

요약하다

이 전략은 가격 통로 지표 설계 아이디어에 기반하고, 포지션 개척을 사용하여 위험을 효과적으로 제어할 수 있다. 그러나 또한 파라미터 최적화 공간이 넓고, 손해 차단 장치가 개선되어야 하는 문제 등이 있다.

전략 소스 코드
/*backtest
start: 2022-11-29 00:00:00
end: 2023-12-05 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2018

//@version=3
strategy(title = "Noro's PCMA Strategy v1.0", shorttitle = "PCMA 1.0", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0)

//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
capital = input(100, defval = 100, minval = 1, maxval = 10000, title = "Lot, %")
per = input(3, title = "Length")
shortlevel = input(10.0, title = "Short line (red)")
longlevel = input(-5.0, title = "Long line (lime)")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")

//Price Channel
h = highest(high, per)
l = lowest(low, per)
c = (h + l) / 2
ll = c + ((c / 100) * longlevel)
sl = c + ((c / 100) * shortlevel)

//Lines
shortcolor = needshort ? red : na
longcolor = needlong ? lime : na
plot(sl, linewidth = 2, color = shortcolor, title = "Short line")
plot(c, linewidth = 2, color = blue, title = "SMA line")
plot(ll, linewidth = 2, color = longcolor, title = "Long line")

//Trading
size = strategy.position_size
lot = 0.0
lot := size == 0 ? strategy.equity / close * capital / 100 : lot[1]

if (not na(close[per])) and size == 0 and needlong
    strategy.entry("L", strategy.long, lot, limit = ll, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
    
if (not na(close[per])) and size == 0 and needshort
    strategy.entry("S", strategy.short, lot, limit = sl, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
    
if (not na(close[per])) and size > 0 
    strategy.entry("Close", strategy.short, 0, limit = c, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
    
if (not na(close[per])) and size < 0 
    strategy.entry("Close", strategy.long, 0, limit = c, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))

if time > timestamp(toyear, tomonth, today, 23, 59)
    strategy.close_all()