
この戦略は,二重最適化された組み合わせの反転EMA重量化取引戦略である.これは,反転戦略とEMA重量化戦略の2つの異なるタイプの戦略を組み合わせ,両戦略の信号が一致しているかどうかを判断することによって,より信頼性の高い取引信号を生成する.
逆転部分は123逆転戦略を採用する.この戦略は,前2日の閉盘価格関係を判断し,ランダムな指標の組み合わせで信号を生成する.具体的ルールは:
EMA加重部分は,指数移動平均と取引量の加重計算を採用している.計算式は以下の通りである.
xMAVolPrice = ema(volume * close, Length)
xMAVol = ema(volume, Length)
nRes = xMAVolPrice / xMAVol
取引のルールは,nResが昨日の閉盘価格より低/高であるとき,オフ/オフにするというものです.
最後に,この戦略は,2つの部分の信号が一致するかどうかを判断し,一致が実際の取引信号を生成する.
この戦略は,2つの異なるタイプの戦略を組み合わせて,相互に検証し,信号の信頼性を高め,偽信号を減らすことができる.同時に,反転部分は,ターニングポイントをキャプチャし,EMA加重部分は,トレンドを追跡し,両者は優位に互補することができる.
この戦略には一定の時間遅れがあり,ショートラインの取引機会を逃すのが容易である。また,EMAが価格の揺れに重み付けられた市場の効果が悪い。さらに,反転シグナルの信頼性もチェックが必要である。
適切なパラメータを短縮し,反応速度を加速する. リスクを制御するためにストップを追加する. 逆転信号を検証する要素をさらに導入する.
この戦略は,2つの異なるタイプの戦略の優位性を統合し,信号の質を向上させ,単一の戦略の欠点をある程度克服する.しかし,さらに最適化が必要な一定の遅れがある.全体的に,この戦略は,量化取引のための新しい考えを提供し,さらなる研究と最適化,市場機会を掴むに値する.
/*backtest
start: 2023-11-06 00:00:00
end: 2023-12-06 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 18/10/2019
// 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 related article is copyrighted material from Stocks & Commodities 2009 Oct
//
// 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
fFilter(xSeriesSum, xSeriesV, Filter) =>
iff(xSeriesV > Filter, xSeriesSum, 0)
EMA_VW(Length) =>
pos = 0.0
xMAVolPrice = ema(volume * close, Length)
xMAVol = ema(volume, Length)
nRes = xMAVolPrice / xMAVol
pos := iff(nRes < close[1], 1,
iff(nRes > close[1], -1, nz(pos[1], 0)))
pos
strategy(title="Combo Backtest 123 Reversal & EMA & Volume Weighting", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
LengthEMA_VM = input(22, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posEMA_VW = EMA_VW(LengthEMA_VM)
pos = iff(posReversal123 == 1 and posEMA_VW == 1 , 1,
iff(posReversal123 == -1 and posEMA_VW == -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 )