더블 이동 평균 반전 및 피벗 포인트 조합 전략


생성 날짜: 2024-01-16 15:48:44 마지막으로 수정됨: 2024-01-16 15:48:44
복사: 2 클릭수: 612
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

더블 이동 평균 반전 및 피벗 포인트 조합 전략

개요

이 전략은 123 형태 회전 전략과 축점 전략을 조합하여 더 높은 승률을 얻습니다. 123 형태 회전 전략은 트렌드 회전점을 판단하고, 축점 전략은 중요한 지원 및 저항 지점을 결정합니다. 둘을 결합하면 트렌드를 포착 할 수 있으며 특정 입시 및 출구 가격을 결정할 수 있습니다.

전략 원칙

123 형태 회전 전략

이 전략은 무작위적인 지표에 기초하여 트렌드 반전점을 판단한다. 구체적인 원칙은 다음과 같다. 종결 가격이 2일 연속으로 이전 종결 가격보다 낮아지고 9일 연속으로 느린 STO 지표가 50보다 낮아지면, 더 많은 것을 한다. 종결 가격이 2일 연속으로 이전 종결 가격보다 높아지고 9일 연속으로 빠른 STO 지표가 50보다 높아지면, 공백을 한다.

중심점 전략

이 전략은 3개의 지지선과 3개의 저항선을 전날의 최고 가격, 최저 가격, 그리고 종결 가격에 따라 계산한다. 중심점= (최고+최저+폐쇄점) /3 1은 2입니다.*중심점 - 최고 저항 1 = 2중심점 - 최저 지지 2 = 중심점- (저항 1-지원 1) 저항 2=중심점+( 저항 1-지원1) 3은 최소 -2입니다.(최고-중심점)
저항 3 = 최대 + 2*(중심점 - 최저점) 그리고 지원과 저항의 위치에 따라 입출구를 결정한다.

전략적 이점

  1. 두 가지 다른 유형의 전략의 장점을 결합하여 트렌드 반전을 판단하고 특정 가격대를 고정 할 수 있습니다.
  2. 123 형태 전략은 단기간에 트렌드 반전점을 효과적으로 판단할 수 있습니다.
  3. 축점 전략은 핵심지원 저항비트 필터링을 이용하여 가짜 돌파구를 뚫을 수 있다.

위험과 보호

  1. 이중 랜덤 지표는 다소 지연되어 짧은 선 반전을 놓칠 수 있습니다.
  2. 축점들은 100% 작동하지 않으며, 돌파구가 발생할 수 있습니다.
  3. 적절히 조정할 수 있는 매개 변수, 또는 다른 지표 조합과 함께 사용할 수 있는 위험 보호

전략 최적화 방향

  1. 다양한 변수가 전략 효과에 미치는 영향을 테스트할 수 있습니다.
  2. 다른 지표나 형태와 결합하여 전략의 효과를 높일 수 있습니다.
  3. 기계 학습 알고리즘과 결합 가능한 동적 최적화 매개 변수

요약하다

이 전략은 트렌드 판단과 핵심 가격 지점을 교묘하게 결합하여 트렌드 반전 지점을 판단 할 수 있으며, 지지 저항 필터 신호를 사용할 수 있습니다. 매개 변수와 전략 조합을 최적화하여 효과를 더욱 향상시킬 수 있습니다. 이 전략은 수량 거래자가 더 많은 연구와 응용을 할 가치가 있습니다.

전략 소스 코드
/*backtest
start: 2023-12-16 00:00:00
end: 2024-01-15 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 21/04/2021
// This is combo strategies for get a cumulative signal. 
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The 
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close 
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
// The strategy sells at market, if close price is lower than the previous close price 
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// Pivot points simply took the high, low, and closing price from the previous period and 
// divided by 3 to find the pivot. From this pivot, traders would then base their 
// calculations for three support, and three resistance levels. The calculation for the most 
// basic flavor of pivot points, known as ‘floor-trader pivots’, along with their support and 
// resistance levels.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
    vFast = sma(stoch(close, high, low, Length), KSmoothing) 
    vSlow = sma(vFast, DLength)
    pos = 0.0
    pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
	         iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0))) 
	pos


PP2(res,SellFrom,BuyFrom) =>
    pos = 0.0
    xHigh  = security(syminfo.tickerid,res, high)
    xLow   = security(syminfo.tickerid,res, low)
    xClose = security(syminfo.tickerid,res, close)
    vPP = (xHigh+xLow+xClose) / 3
    vS1 = 2*vPP - xHigh 
    vR1 = 2*vPP-xLow
    vS2 = vPP - (vR1 - vS1)
    vR2 = vPP + (vR1 - vS1)
    vS3 = xLow - 2 * (xHigh - vPP)
    vR3 = xHigh + 2 * (vPP - xLow) 
    S =  iff(BuyFrom == "S1", vS1, 
          iff(BuyFrom == "S2", vS2,
           iff(BuyFrom == "S3", vS3,0)))
    B =  iff(SellFrom == "R1", vR1, 
          iff(SellFrom == "R2", vR2,
           iff(SellFrom == "R3", vR3,0)))
    pos := iff(close > B, 1,
             iff(close < S, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Pivot Point V2)", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- Pivot Point V2 ----")
res = input(title="Resolution", type=input.resolution, defval="D")
SellFrom = input(title="Sell from ", defval="R1", options=["R1", "R2", "R3"])
BuyFrom = input(title="Buy from ", defval="S1", options=["S1", "S2", "S3"])
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posPP2 = PP2(res,SellFrom,BuyFrom)
pos = iff(posReversal123 == 1 and posPP2 == 1 , 1,
	   iff(posReversal123 == -1 and posPP2 == -1, -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_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )