Prime Wave 백테스팅 전략


생성 날짜: 2024-01-08 11:54:52 마지막으로 수정됨: 2024-01-08 11:54:52
복사: 0 클릭수: 846
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

Prime Wave 백테스팅 전략

개요

양수 파동带回测策略은 가격 근처의 최고와 최저 양수를 식별하고 양수 수열을 하나의 파동带로 그리는 것으로 시장의 흐름을 판단한다. 이策略은 모더스 파이낸셜 엔지니어링 회사에서 개발했다.

전략 원칙

  1. 입력된 용량비율 %에 따라, 지정된 가격의 양과 음의 변동 범위를 가로질러 가장 높고 가장 낮은 직수를 찾습니다.
  2. highestest 및 lowest 함수를 사용하여 가장 가까운 N근 K선에서 양수 파장의 최고점과 최저점을 얻는다.
  3. 종식 가격이 양자동파의 최고점과 최저점을 뚫었는지 판단하고, 상장 또는 하락 방향을 결정한다.
  4. 선택적으로 거래 신호를 반전할 수 있다.

우위 분석

  1. 순수들의 무작위적이고 불규칙한 분포 특성을 활용하여 시장의 무작위성을 포착한다.
  2. 양자파띠는 약간의 지연성을 가지고 있으며, 일부 소음을 필터링할 수 있다.
  3. 질량파는 하위 유연성을 가지고 있으며, 양차 비율을 조정하여 다른 주기 및 다른 거래 품종에 적응할 수 있다.

위험 분석

  1. 양자파는 가격운동에 완전히 부합하지 않으며, 어느 정도 지연이 있다.
  2. 하지만, 가격의 역동적인 변동은 잘못된 신호로 이어질 수 있습니다.
  3. : : : : : :

다른 지표와 결합하여 적절한 매개 변수를 조정하여 위험을 피할 수 있습니다.

최적화 방향

  1. 이동 평균과 같은 지표와 결합하여 이중 조건 트리거 신호를 설정할 수 있다.
  2. 다른 무작위 숫자의 사용도 연구할 수 있다. 예를 들어, 피보나치 수 등이다.
  3. 기계 학습 알고리즘을 도입하여 매개 변수의 자동 최적화를 구현할 수 있다.

요약하다

질량파역 회귀 전략overall은 매우 혁신적이고 실용적인 가치가있는 전략이다. 그것은 질수의 특성을 활용하여 시장의 무작위성을 포착하고, 가격 지연 인식 경향을 고려하면서 연구 가치가 높다. 다음 단계는 신호 품질을 향상시키고, 무작위 수 유형을 확장하고, 자동 최적화 등을 통해 최적화하여 전략 효과를 더욱 탁월하게 만들 수 있다.

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

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 27/03/2018
// Determining market trends has become a science even though a high number 
// or people still believe it’s a gambling game. Mathematicians, technicians, 
// brokers and investors have worked together in developing quite several 
// indicators to help them better understand and forecast market movements.
// The Prime Number Bands indicator was developed by Modulus Financial Engineering 
// Inc. This indicator is charted by indentifying the highest and lowest prime number 
// in the neighborhood and plotting the two series as a band.
//
// You can change long to short in the Input Settings
// WARNING:
//  - For purpose educate only
//  - This script to change bars colors.
////////////////////////////////////////////////////////////
PrimeNumberUpBand(price, percent) =>
    res = 0
    res1 = 0
    for j = price to price + (price * percent / 100)
        res1 := j
	    for i = 2 to sqrt(price)
        	res1 := iff(j % i == 0 , 0, j)
            if res1 == 0 
                break
		if res1 > 0 
		    break
    res := iff(res1 == 0, res[1], res1)
    res

PrimeNumberDnBand(price, percent) =>
    res = 0
    res2 = 0
    for j = price to price - (price * percent / 100)
        res2 := j
	    for i = 2 to sqrt(price)
        	res2 := iff(j % i == 0 , 0, j)
            if res2 == 0 
                break
		if res2 > 0 
		    break
    res := iff(res2 == 0, res[1], res2)
    res

strategy(title="Prime Number Bands Backtest", overlay = true)
percent = input(5, minval=0.01, step = 0.01, title="Tolerance Percentage")
Length = input(5, minval=1)
srcUp = input(title="Source Up Band",  defval=high)
srcDn = input(title="Source Down Band",  defval=low)
reverse = input(false, title="Trade reverse")
xPNUB = PrimeNumberUpBand(srcUp, percent)
xPNDB = PrimeNumberDnBand(srcDn, percent)
xHighestPNUB = highest(xPNUB, Length)
xLowestPNUB = lowest(xPNDB, Length)
pos = iff(close > xHighestPNUB[1], 1,
       iff(close < xLowestPNUB[1], -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)	   	    
barcolor(possig == -1 ? red: possig == 1 ? green : blue ) 
plot(xHighestPNUB, color=red, title="PNUp")
plot(xLowestPNUB, color=green, title="PNDn")