多要素量的な取引戦略

作者: リン・ハーンチャオチャン開催日:2023年12月27日 15:46:27
タグ:

img

概要

この戦略は123の逆転戦略と心理的ライン戦略を組み合わせ,多要素量的な取引戦略を形成する.技術パターン,市場心理学,その他の要因を包括的に考慮することによって,戦略は市場の動向を決定する際により正確な判断を行うことができます.

原則

123 逆転戦略

123のリバース戦略は,日の閉店価格が前日と比較して上昇し,スローKラインが50を下回る場合,ロング;ダウンし,高速Kラインが50を超えるとショートする.この戦略は,短期的なリバースの特徴を利用して利益を得ています.

心理的な線戦略

心理線戦略は,特定のサイクルにおける上昇と減少の比率を計算する.上昇が50%を超えると,牛が市場を支配することを示し,上昇が50%未満ならば,熊が市場を支配することを示します.上昇と減少の比率に基づいて市場心理学について判断します.

この戦略は,上記の2つの戦略からのシグナルを組み合わせます. 2つの戦略が同じ方向にシグナルを与える場合,ポジションを開く,異なる方向にシグナルを与える場合,ポジションを閉じます.

利点

戦略は複数の要因を組み合わせ,単一の技術指標による誤った判断を回避し,市場の動向についてより正確な判断を下すことができる.同時に,市場心理学の組み合わせは,複雑な動向変化に対処するための戦略をより回復力のあるものにする.

リスク と 解決策

戦略における各要素のパラメータの設定は,戦略のパフォーマンスに大きな影響を与えます.不合理なパラメータ組み合わせは,戦略の有効性を大幅に低下させることがあります.また,傾向の急激な変化も,戦略の失敗を引き起こす可能性があります.リスクを軽減するために,最適なパラメータ設定を見つけるためにさまざまな市場条件をバックテストする必要があります.また,単一の損失が大きすぎないようにするためにポジションサイズを制御する必要があります.

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

既存の基礎で,より3次元的な戦略論理を形成するために,変動性とボリュームなどの他の判断要因を追加し続けることができる.または自動パラメータ適応最適化を達成するために機械学習アルゴリズムを追加することができます.これらはこの戦略のためのさらなる最適化方向になります.

概要

この戦略は,技術的パターンや市場心理などの複数の要因を包括的に考慮する.異なる要因間の検証は,シグナルの有効性を保証する.同時に,最適化のための十分な余地を残し,優れたパフォーマンスを達成することが期待される.これは長期追跡,蓄積,最適化に値する高品質の定量戦略である.


/*backtest
start: 2022-12-20 00:00:00
end: 2023-12-26 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 30/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
// Psychological line (PSY), as an indicator, is the ratio of the number of 
// rising periods over the total number of periods. It reflects the buying 
// power in relation to the selling power.
// If PSY is above 50%, it indicates that buyers are in control. Likewise, 
// if it is below 50%, it indicates the sellers are in control. If the PSY 
// moves along the 50% area, it indicates balance between the buyers and 
// sellers and therefore there is no direction movement for the market.
//
// 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


PLine(Length) =>
    pos = 0.0
    cof = close > close[1]? 1:0
    xPSY = sum(cof,Length) / Length * 100
    pos:= iff(xPSY > 50, 1,
           iff(xPSY < 50, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Psychological line", 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, "---- Psychological line ----")
LengthPLine = input(20, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posPLine = PLine(LengthPLine)
pos = iff(posReversal123 == 1 and posPLine == 1 , 1,
	   iff(posReversal123 == -1 and posPLine == -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 )

もっと