123 逆転点とピボットポイントの組み合わせ戦略

作者: リン・ハーンチャオチャン,日付: 2024-01-16 15:48:44
タグ:

img

概要

この戦略は,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つの異なるタイプの戦略の強みを組み合わせて,より高い勝利率を達成します.
  2. 123 パターンは短期的なトレンド逆転を効果的に識別します
  3. キー S/R レベルを使用するピボットポイントは,誤差をフィルタリングします.

リスクとヘージング

  1. ダブルSTOは遅れて短期的な逆転を逃すかもしれない.
  2. ピボットポイントは常に維持されず,ブレイクアウトは継続する可能性があります
  3. パラメータはリスクをカバーするために他の指標と調整または組み合わせることができます.

オプティマイゼーションの方向性

  1. 異なるパラメータセットの試験影響
  2. 他の指標/パターンと組み合わせてパフォーマンスを向上させる
  3. パラメータを動的に最適化するために機械学習を組み込む

概要

この戦略は,トレンド識別と主要な価格レベルを巧みに組み合わせ,S/Rを使用してシグナルをフィルターする際に逆転を検出できるようにする.パラメータチューニングや他の戦略との組み合わせによってさらなる改善が可能である.これは量子トレーダーによりより多くの研究と適用に値する.


/*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 )

もっと