카마치라 피벗과 볼린저 밴드를 기반으로 한 양적 전략


생성 날짜: 2024-02-05 14:23:59 마지막으로 수정됨: 2024-02-05 14:23:59
복사: 0 클릭수: 964
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

카마치라 피벗과 볼린저 밴드를 기반으로 한 양적 전략

개요

이 전략은 우선 전날의 최고 가격, 최저 가격, 그리고 종결 가격에 따라 카마치라 축점을 계산한다. 그리고 부린 대역 지표와 결합하여 가격을 필터링하고, 가격이 축점을 돌파했을 때 거래 신호를 발생시킨다.

전략 원칙

  1. 지난 거래일 최고 가격, 최저 가격, 종식 가격을 계산합니다.
  2. 공식에 따라 카마치라 축축을 계산하여, 상단 H4, H3, H2, H1 및 하단 L1, L2, L3, L4를 포함합니다.
  3. 20일, 브린이 선로에 올랐고, 내려갔다.
  4. 가격 상승과 하락에 대해 더 많은 것을 하고 하락에 대해 더 적은 것을 합니다.
  5. 스톱포인트는 브린 벨트 오프레일 또는 오프레일 근처에 위치한다.

우위 분석

  1. 카마치라 축은 거래 신호의 신뢰성을 강화하기 위해 여러 핵심 지지 저항 지점을 포함합니다.
  2. 브린 벨트 지표와 결합하여 가짜 돌파구를 효과적으로 필터링합니다.
  3. 다중 모음, 거래의 유연성

위험 분석

  1. 부린 띠 지표 파라미터를 잘못 설정하면 거래 신호 오류가 발생할 수 있습니다.
  2. 카마치라 축의 핵심 지트는 전 거래일 가격에 의존하며, 하룻밤 동안의 비행에 영향을 받을 수 있습니다.
  3. 다중 무인 항공기 운영은 손실 위험이 있습니다.

최적화 방향

  1. 브린 띠 변수를 최적화하여 최적의 변수 조합을 찾습니다.
  2. 다른 지표와 함께 필터링 가짜 돌파 신호
  3. 단편적 손실을 줄이기 위한 손실을 막는 전략을 강화

요약하다

이 전략은 카마치라 축축과 브린 벨트 지표를 통합하여 가격이 핵심 지지 저항 지점을 돌파 할 때 거래 신호를 발생시킵니다. 매개 변수 최적화 및 신호 필터링을 통해 전략의 수익률과 안정성을 향상시킬 수 있습니다. 전체적으로 이 전략의 거래 아이디어는 명확하고 작동성이 강하며 실체 검증 가치가 있습니다.

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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 12/05/2020
// Camarilla pivot point formula is the refined form of existing classic pivot point formula. 
// The Camarilla method was developed by Nick Stott who was a very successful bond trader. 
// What makes it better is the use of Fibonacci numbers in calculation of levels.
//
// Camarilla equations are used to calculate intraday support and resistance levels using 
// the previous days volatility spread. Camarilla equations take previous day’s high, low and 
// close as input and generates 8 levels of intraday support and resistance based on pivot points. 
// There are 4 levels above pivot point and 4 levels below pivot points. The most important levels 
// are L3 L4 and H3 H4. H3 and L3 are the levels to go against the trend with stop loss around H4 or L4 . 
// While L4 and H4 are considered as breakout levels when these levels are breached its time to 
// trade with the trend.
//
// WARNING:
//  - For purpose educate only
//  - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="Camarilla Pivot Points V2 Backtest", shorttitle="CPP V2", overlay = true)
res = input(title="Resolution", type=input.resolution, defval="D")
width = input(1, minval=1)
SellFrom = input(title="Sell from ", defval="R1", options=["R1", "R2", "R3", "R4"])
BuyFrom = input(title="Buu from ", defval="S1", options=["S1", "S2", "S3", "S4"])
reverse = input(false, title="Trade reverse")
xHigh  = security(syminfo.tickerid,res, high)
xLow   = security(syminfo.tickerid,res, low)
xClose = security(syminfo.tickerid,res, close)
H4 = (0.55*(xHigh-xLow)) + xClose
H3 = (0.275*(xHigh-xLow)) + xClose
H2 = (0.183*(xHigh-xLow)) + xClose
H1 = (0.0916*(xHigh-xLow)) + xClose
L1 = xClose - (0.0916*(xHigh-xLow))
L2 = xClose - (0.183*(xHigh-xLow))
L3 = xClose - (0.275*(xHigh-xLow))
L4 = xClose - (0.55*(xHigh-xLow))
pos = 0
S = iff(BuyFrom == "S1", H1, 
      iff(BuyFrom == "S2", H2,
       iff(BuyFrom == "S3", H3,
         iff(BuyFrom == "S4", H4,0))))
B = iff(SellFrom == "R1", L1, 
      iff(SellFrom == "R2", L2,
       iff(SellFrom == "R3", L3,
         iff(SellFrom == "R4", L4,0))))
pos := iff(close > B, 1,
       iff(close < S, -1, 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_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )