プライムウェーブバックテスト戦略


作成日: 2024-01-08 11:54:52 最終変更日: 2024-01-08 11:54:52
コピー: 0 クリック数: 846
1
フォロー
1617
フォロワー

プライムウェーブバックテスト戦略

概要

質量波帯反射策は,価格の近くにある最高と最低の質量数を識別し,この2つの質量数列を波帯として描画することで,市場の傾向を判断する.この策はモジュール金融エンジニアリング社が開発した.

戦略原則

  1. 入力の容量差の百分比%に基づいて,指定された価格の正負波動の範囲を横切って,最高と最低の正数を見つけます.
  2. highestと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")