二重移動平均裁定戦略


作成日: 2023-11-24 14:21:06 最終変更日: 2023-11-24 14:21:06
コピー: 0 クリック数: 771
1
フォロー
1621
フォロワー

二重移動平均裁定戦略

概要

この戦略は,双均線形状を利用して,アベレート操作を行う戦略である.これは,123形状反転と限られた取引量要素 ((FVE) の2つの子戦略を組み合わせ,両者が同時に買入または売却のシグナルを発信するとき,アベレート操作を行う.

戦略原則

123 形を逆転する

この子戦略は,ウルフ・ジェンセンが書いた”期貨市場での利得を3倍にする方法”の書から派生した.

  • 閉盤価格が2日連続で上昇し,ストック指数が9日連続で50を下回ったとき,多額の取引を行う.
  • 閉盤価格が2日連続で下落し,9日目で速ストック指数が50以上になると空白する.

限られた交代量元素 ((FVE)

FVEは純粋な取引量指標である.価格の上昇と取引量の大きさに基づいて,資金が流入するか流出するか判断する.

最近の2barのFVE指標が同時に上昇または低下すると信号を発する.

優位分析

この戦略は,市場動向と資金流動を判断する2つの指標を組み合わせて,誤った信号を効果的に回避できます.また,両方の子戦略は,一定の反転特性を有しており,したがって,利潤を得るため,値操作を行うことができます.

また,双均線形が現れたとき,短期と中期の傾向が一致することを表し,したがってより強い安定性がある.

リスク分析

この戦略は均線形状に依存し,市場が揺れ動くと誤信号が起こり,損失を招く.また,反転失敗は一般的なリスクである.

適切なパラメータの調整によって戦略をより堅牢にすることも,リスク管理のためにストップ・ロスを設定することもできます.

最適化の方向

より多くの種類の均線指標をテストして最適のマッチを探せます.また,誤った信号を避けるために,強弱指標,波動率指標などの他の補助判断指標を導入することもできます.

また,市場状況に応じてパラメータを動的に調整し,戦略をより適応的にする方法も研究できます.また,パラメータの自主適応を実現するために機械学習やニューラルネットワークアルゴリズムも探索できます.

要約する

この双均線利戦略は2つの反転思考の指標を統合して判断し,ある程度リスクを回避することができる.しかし,均線形態に依存しているため,戦略をより安定させるためにさらなる最適化が必要である.全体的に,この戦略は,ショートライン利取引のための基礎的枠組みを提供し,さらなる研究に値する.

ストラテジーソースコード
/*backtest
start: 2023-10-24 00:00:00
end: 2023-11-23 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 25/08/2020
// 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
// The FVE is a pure volume indicator. Unlike most of the other indicators 
// (except OBV), price change doesn?t come into the equation for the FVE (price 
// is not multiplied by volume), but is only used to determine whether money is 
// flowing in or out of the stock. This is contrary to the current trend in the 
// design of modern money flow indicators. The author decided against a price-volume 
// indicator for the following reasons:
// - A pure volume indicator has more power to contradict.
// - The number of buyers or sellers (which is assessed by volume) will be the same, 
//     regardless of the price fluctuation.
// - Price-volume indicators tend to spike excessively at breakouts or breakdowns.
//
// 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


FVE(Period,Factor) =>
    pos = 0
    nRes = 0.0
    xhl2 = hl2
    xhlc3 = hlc3
    xClose = close
    xVolume = volume
    xSMAV = sma(xVolume, Period)
    nMF = xClose - xhl2 + xhlc3 - xhlc3[1]
    nVlm = iff(nMF > Factor * xClose / 100,  xVolume, 
             iff(nMF < -Factor * xClose / 100, -xVolume, 0))
    nRes := nz(nRes[1],0) + ((nVlm / xSMAV) / Period) * 100
    pos := iff(nRes > nRes[1] and nRes > nRes[2], 1,
             iff(nRes < nRes[1] and nRes < nRes[2], -1, nz(pos[1], 0)))   
    pos

strategy(title="Combo Backtest 123 Reversal & Finite Volume Elements (FVE)", shorttitle="Combo", overlay = true)
Length = input(15, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
Period = input(18, minval=1)
Factor = input(0.6, minval=0.1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posFVE = FVE(Period,Factor)
pos = iff(posReversal123 == 1 and posFVE == 1 , 1,
	   iff(posReversal123 == -1 and posFVE == -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 )