비교적 상대적 힘 전략

저자:차오장, 날짜: 2023-09-14 17:58:19
태그:

전략 논리

비교 상대적 강도 전략은 두 시장의 상대적 강도를 비교하여 거래를 생성합니다. 비교 시장의 비교 시장에 대한 뛰어난 성과는 구매 신호로 간주되며, 낮은 성능은 판매 신호로 간주됩니다.

논리는 다음과 같습니다.

  1. 비교 시장, 예를 들어 주식 선택

  2. 기준 시장, 예를 들어 S&P 500 지수

  3. 비교 시장과 기준 기준의 계산 비율

  4. 비율이 과잉 구매 수준을 초과하면 비교를 오래 가십시오

  5. 비중이 과잉 판매 구역 아래로 떨어지면 단축

  6. 가격이 다시 떨어지면 포지션을 닫기 위해 풀백 라인을 설정합니다.

상대적 강도를 비교함으로써 전략은 과소평가된 기회를 발견하고 과소평가된 상황을 피하는 것을 목표로 합니다.

장점

  • 부가가치를 찾기 위해 상대적 강도를 비교합니다.

  • 추락 라인은 트렌드를 쫓는 것을 피합니다.

  • 단순하고 명확한 규칙

위험성

  • 적절한 벤치마크 선택

  • 과잉 구매/ 과잉 판매 지역 최적화 필요

  • LONG/SHORT는 모든 기회를 놓치게 됩니다.

요약

상대적 강도 전략은 두 개의 시장을 비교하여 중재 가능성을 식별합니다. 그러나 매개 변수 조정 및 중지 전략은 신중한 평가를 필요로합니다.


/*backtest
start: 2022-09-07 00:00:00
end: 2023-09-13 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 10/03/2017
// Comparative Relative Strength Strategy for ES
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
////////////////////////////////////////////////////////////
strategy("Comparative Relative Strength Strategy", shorttitle="CRS")
a = syminfo.tickerid 
b = input("BTC_USDT:swap") 
len = input(10) 
BuyBand = input(0.9988, step = 0.0001)
SellBand = input(0.9960, step = 0.0001)
CloseBand = input(0.9975, step = 0.0001)
reverse = input(false, title="Trade reverse")
hline(CloseBand, color=blue, linestyle=hline.style_dashed)
hline(SellBand, color=red, linestyle=hline.style_solid)
hline(BuyBand, color=green, linestyle=hline.style_solid)
as = security(a, timeframe.period, close) 
bs = security(b, timeframe.period, close) 
nRes = sma(as/bs, len)
pos = iff(nRes > BuyBand, 1,
	     iff(nRes < SellBand, -1,
	      iff(pos[1] == 1 and nRes < CloseBand, 0,
	       iff(pos[1] == -1 and nRes > CloseBand, 0, nz(pos[1], 0)))))
possig = iff(reverse and pos == 1, -1,
          iff(reverse and pos == -1, 1, pos))	   
if (possig == 1) 
    strategy.entry("Long", strategy.long)
if (possig == -1)
    strategy.entry("Short", strategy.short)	   	 
if (possig == 0)
    strategy.close("Long", when = possig == 0)	 
    strategy.close("Short", when = possig == 0)	 
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(as/bs, title="CRS", color=gray) 
plot(nRes, color=navy)

더 많은