Dual Moving Average Reversal Tracking adalah strategi perdagangan kuantitatif yang menggunakan crossover purata bergerak sebagai isyarat perdagangan. Strategi ini menggabungkan perbezaan purata bergerak cepat dan perlahan penunjuk MACD dan garis isyaratnya, serta nisbah panjang / pendek jumlah dagangan, untuk membentuk isyarat dagangan dan menangkap peluang pembalikan pasaran.
Strategi ini terutamanya menilai hubungan antara garisan pantas dan garis perlahan. Ia menghasilkan isyarat beli apabila garisan pantas melintasi di atas garisan perlahan, dan isyarat jual apabila garisan pantas melintasi di bawah garisan perlahan. Di samping itu, ia juga menilai secara komprehensif status panjang/pendek pasaran berdasarkan keadaan panjang/pendek nilai perbezaan MACD, hubungan antara perbezaan dan garis isyarat, keadaan panjang/pendek jumlah dagangan, dll.
Secara khusus, strategi ini menilai saiz dan arah nilai perbezaan MACD, persilangan antara perbezaan dan garis isyarat, arah yang konsisten atau bertentangan antara perbezaan dan garis isyarat, dll. Situasi ini mencerminkan ciri-ciri pemulihan subpasaran selepas kejatuhan. Di samping itu, pembahagian panjang / pendek jumlah dagangan juga digunakan sebagai penunjuk penilaian tambahan.
Apabila perbezaan dan garis isyarat menunjukkan isyarat pembalikan pasaran, dan jumlah dagangan sepadan untuk mengesahkan pembalikan pasaran, isyarat dagangan akan dihasilkan.
Strategi Pengesanan Pembalikan Purata Bergerak Berganda secara komprehensif mempertimbangkan penunjuk seperti purata bergerak, MACD, dan jumlah dagangan. Dengan menangkap isyarat pembalikan mereka, titik pembalikan yang sesuai dipilih untuk menubuhkan kedudukan. Masih ada ruang yang besar untuk mengoptimumkan strategi ini, ketahanan dan keuntungan dapat ditingkatkan dengan teknik seperti pembelajaran mesin dan pengurusan risiko.
/*backtest start: 2024-01-20 00:00:00 end: 2024-02-19 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("3 10 Oscillator Profile Flagging", shorttitle="3 10 Oscillator Profile Flagging", overlay=true) signalBiasValue = input(title="Signal Bias", defval=0.26) macdBiasValue = input(title="MACD Bias", defval=0.8) shortLookBack = input( title="Short LookBack", defval=3) longLookBack = input( title="Long LookBack", defval=10) fast_ma = ta.sma(close, 3) slow_ma = ta.sma(close, 10) macd = fast_ma - slow_ma signal = ta.sma(macd, 16) hline(0, "Zero Line", color = color.black) buyVolume = volume*((close-low)/(high-low)) sellVolume = volume*((high-close)/(high-low)) buyVolSlope = buyVolume - buyVolume[1] sellVolSlope = sellVolume - sellVolume[1] signalSlope = ( signal - signal[1] ) macdSlope = ( macd - macd[1] ) //plot(macdSlope, color=color.red, title="Total Volume") //plot(signalSlope, color=color.green, title="Total Volume") intrabarRange = high - low getLookBackSlope(lookBack) => signal - signal[lookBack] getBuyerVolBias(lookBack) => j = 0 for i = 1 to lookBack if buyVolume[i] > sellVolume[i] j += 1 j getSellerVolBias(lookBack) => j = 0 for i = 1 to lookBack if sellVolume[i] > buyVolume[i] j += 1 j getVolBias(lookBack) => float b = 0 float s = 0 for i = 1 to lookBack b += buyVolume[i] s += sellVolume[i] b > s getSignalBuyerBias(lookBack) => j = 0 for i = 1 to lookBack if signal[i] > signalBiasValue j += 1 j getSignalSellerBias(lookBack) => j = 0 for i = 1 to lookBack if signal[i] < ( 0 - signalBiasValue ) j += 1 j getSignalNoBias(lookBack) => j = 0 for i = 1 to lookBack if signal[i] < signalBiasValue and signal[i] > ( 0 - signalBiasValue ) j += 1 j getPriceRising(lookBack) => j = 0 for i = 1 to lookBack if close[i] > close[i + 1] j += 1 j getPriceFalling(lookBack) => j = 0 for i = 1 to lookBack if close[i] < close[i + 1] j += 1 j getRangeNarrowing(lookBack) => j = 0 for i = 1 to lookBack if intrabarRange[i] < intrabarRange[i + 1] j+= 1 j getRangeBroadening(lookBack) => j = 0 for i = 1 to lookBack if intrabarRange[i] > intrabarRange[i + 1] j+= 1 j bool isNegativeSignalReversal = signalSlope < 0 and signalSlope[1] > 0 bool isNegativeMacdReversal = macdSlope < 0 and macdSlope[1] > 0 bool isPositiveSignalReversal = signalSlope > 0 and signalSlope[1] < 0 bool isPositiveMacdReversal = macdSlope > 0 and macdSlope[1] < 0 bool hasBearInversion = signalSlope > 0 and macdSlope < 0 bool hasBullInversion = signalSlope < 0 and macdSlope > 0 bool hasSignalBias = math.abs(signal) >= signalBiasValue bool hasNoSignalBias = signal < signalBiasValue and signal > ( 0 - signalBiasValue ) bool hasSignalBuyerBias = hasSignalBias and signal > 0 bool hasSignalSellerBias = hasSignalBias and signal < 0 bool hasPositiveMACDBias = macd > macdBiasValue bool hasNegativeMACDBias = macd < ( 0 - macdBiasValue ) bool hasBullAntiPattern = ta.crossunder(macd, signal) bool hasBearAntiPattern = ta.crossover(macd, signal) bool hasSignificantBuyerVolBias = buyVolume > ( sellVolume * 1.5 ) bool hasSignificantSellerVolBias = sellVolume > ( buyVolume * 1.5 ) // 7.48 Profit 52.5% if ( hasSignificantBuyerVolBias and getPriceRising(shortLookBack) == shortLookBack and getBuyerVolBias(shortLookBack) == shortLookBack and hasPositiveMACDBias and hasBullInversion) strategy.entry("Short1", strategy.short) strategy.exit("TPS", "Short1", limit=strategy.position_avg_price - 0.75, stop=strategy.position_avg_price + 0.5) // 32.53 Profit 47.91% if ( getPriceFalling(shortLookBack) and (getVolBias(shortLookBack) == false) and signalSlope < 0 and hasSignalSellerBias) strategy.entry("Long1", strategy.long) strategy.exit("TPS", "Long1", limit=strategy.position_avg_price + 0.75, stop=strategy.position_avg_price - 0.5)