カマチラピボットとボリンジャーバンドに基づく定量戦略


作成日: 2024-02-05 14:23:59 最終変更日: 2024-02-05 14:23:59
コピー: 0 クリック数: 964
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 )