Empat Petunjuk Strategi Pembalikan Momentum

Penulis:ChaoZhang, Tarikh: 2023-11-27 15:51:01
Tag:

img

Ringkasan

Strategi ini menggunakan tiga penunjuk teknikal utama: purata bergerak EMA, indeks kekuatan relatif RSI dan indeks saluran komoditi CCI untuk mengenal pasti momentum harga melalui persimpangan EMA dan entri lanjut yang disahkan oleh bacaan oversold / overbought dari RSI dan CCI. Strategi perdagangan jangka menengah ini bertujuan untuk menangkap pembalikan momentum.

Logika Strategi

  1. Menggunakan persilangan antara EMA empat tempoh dan lapan tempoh untuk menentukan momentum harga EMA empat tempoh yang lebih cepat untuk bertindak balas dengan cepat dan EMA lapan tempoh yang lebih perlahan untuk mengesahkan;

  2. Apabila EMA bertukar ke atas, iaitu EMA 4 tempoh melintasi EMA 8 tempoh, periksa bahawa RSI (lebih daripada 65) dan CCI (lebih daripada 0) tidak terlalu dibeli untuk memberikan isyarat panjang;

  3. Apabila EMA bertukar ke bawah, iaitu EMA 4 tempoh melintasi di bawah EMA 8 tempoh, periksa bahawa RSI (di bawah 35) dan CCI (di bawah 0) terlalu dijual untuk memberi isyarat pendek;

  4. Tetapkan harga stop loss dan mengambil keuntungan berdasarkan jarak input apabila isyarat perdagangan dicetuskan.

Ringkasnya, strategi ini menganggap trend jangka sederhana dan tahap overbought / oversold jangka pendek untuk membentuk isyarat yang agak stabil, sementara menghentikan kerugian dan mengambil keuntungan dengan berkesan mengehadkan kerugian setiap perdagangan.

Analisis Kelebihan

  1. Pelbagai penunjuk mengurangkan isyarat palsu dari osilator individu;

  2. EMA menentukan trend utama manakala RSI dan CCI mengelakkan kawasan yang terlalu panas untuk meningkatkan kadar kemenangan;

  3. Setup Stop Loss dan Take Profit automatik mengehadkan kerugian dalam pergerakan melampau;

  4. Sifat teknikal semata-mata menjadikan strategi ini mudah dilaksanakan di mana-mana jangka masa.

Analisis Risiko

  1. Berita asas utama boleh mengatasi tahap teknikal;

  2. Stop loss boleh diambil oleh panggilan turun naik yang besar untuk berhenti yang lebih luas;

  3. Perdagangan yang kerap mendorong kos transaksi yang lebih tinggi oleh itu lebih baik dibiarkan untuk algoritma frekuensi tinggi.

Peluang Peningkatan

  1. Menggabungkan model pembelajaran mesin untuk menyesuaikan parameter secara automatik berdasarkan asas;

  2. Membina hentian adaptif bertindak balas terhadap turun naik dan bukannya jarak tetap.

Kesimpulan

Strategi pelbagai aspek ini boleh memberikan keuntungan jangka menengah yang konsisten di bawah parameter yang dioptimumkan, menjadikannya sistem teknikal yang mudah diakses.


/*backtest
start: 2023-11-19 00:00:00
end: 2023-11-26 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © SoftKill21

//@version=4


strategy(title="Moving Average Exponential", shorttitle="EMA", overlay=true)


len4 = input(4, minval=1, title="Length_MA4")
src4 = input(close, title="Source")
offset4 = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)
out4 = ema(src4, len4)
plot(out4, title="EMA", color=color.blue, offset=offset4)

len8 = input(8, minval=1, title="Length_MA8")
src8 = input(close, title="Source")
offset8 = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)
out8 = ema(src8, len8)
plot(out8, title="EMA", color=color.blue, offset=offset8)


//rsioma
src = close, len = input(14, minval=1, title="Length")
up = rma(max(change(ema(src, len)), 0), len)
down = rma(-min(change(ema(src, len)), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
//plot(rsi, color=color.blue)
//band1 = hline(80)
//band0 = hline(20)
//fill(band1, band0, color=color.purple, transp=90)
//hline(50, color=color.gray, linestyle=plot.style_line)
sig = ema(rsi, 21)
//plot(sig, color=color.purple)

//woodie
cciTurboLength = input(title="CCI Turbo Length", type=input.integer, defval=6, minval=3, maxval=14)
cci14Length = input(title="CCI 14 Length", type=input.integer, defval=14, minval=7, maxval=20)

source = close

cciTurbo = cci(source, cciTurboLength)
cci14 = cci(source, cci14Length)

last5IsDown = cci14[5] < 0 and cci14[4] < 0 and cci14[3] < 0 and cci14[2] < 0 and cci14[1] < 0
last5IsUp = cci14[5] > 0 and cci14[4] > 0 and cci14[3] > 0 and cci14[2] > 0 and cci14[1] > 0
histogramColor = last5IsUp ? color.green : last5IsDown ? color.red : cci14 < 0 ? color.green : color.red


// Exit Condition
// Exit Condition
a = input(12)*10
b = input(15)*10
c = a*syminfo.mintick
d = b*syminfo.mintick


longCondition = crossover(out4, out8) and (rsi >= 65 and cci14>=0)
shortCondition = crossunder(out4, out8) and (rsi <=35 and cci14<=0)


long_stop_level     = float(na)
long_profit_level1  = float(na)
long_profit_level2  = float(na)
long_even_level     = float(na)

short_stop_level    = float(na)
short_profit_level1 = float(na)
short_profit_level2 = float(na)
short_even_level    = float(na)

long_stop_level     := longCondition  ? close - c : long_stop_level     [1]
long_profit_level1  := longCondition  ? close + d : long_profit_level1  [1]
//long_profit_level2  := longCondition  ? close + d : long_profit_level2  [1]
//long_even_level     := longCondition  ? close + 0 : long_even_level     [1]

short_stop_level    := shortCondition ? close + c : short_stop_level    [1]
short_profit_level1 := shortCondition ? close - d : short_profit_level1 [1]
//short_profit_level2 := shortCondition ? close - d : short_profit_level2 [1]
//short_even_level    := shortCondition ? close + 0 : short_even_level    [1] 


//ha
// === Input ===
//ma1_len = input(1, title="MA 01")
//ma2_len = input(40, title="MA 02")

// === MA 01 Filter ===
//o=ema(open,ma1_len)
//cc=ema(close,ma1_len)
//h=ema(high,ma1_len)
//l=ema(low,ma1_len)

// === HA calculator ===
//ha_t = heikinashi(syminfo.tickerid)
//ha_o = security(ha_t, timeframe.period, o)
//ha_c = security(ha_t, timeframe.period, cc)
//ha_h = security(ha_t, timeframe.period, h)
//ha_l = security(ha_t, timeframe.period, l)

// === MA 02 Filter ===
//o2=ema(ha_o, ma2_len)
//c2=ema(ha_c, ma2_len)
//h2=ema(ha_h, ma2_len)
//l2=ema(ha_l, ma2_len)

// === Color def ===
//ha_col=o2>c2 ? color.red : color.lime

// ===  PLOTITING===
//plotcandle(o2, h2, l2, c2, title="HA Smoothed", color=ha_col)

tp=input(120)
sl=input(96)
    
strategy.entry("long", strategy.long, when = longCondition)
//strategy.close("long", when = o2>c2 , comment="ha_long")
strategy.entry("short", strategy.short , when =shortCondition )
//strategy.close("short", when = o2<=c2 , comment = "ha_short" )

//strategy.close("long",when=long_profit_level1 or long_stop_level  , comment="tp/sl")
//strategy.close("short",when=short_profit_level1 or short_stop_level , comment="tp/sl")

strategy.exit("x_long","long",profit = tp, loss = sl) //when = o2>c2)
strategy.exit("x_short","short",profit = tp, loss = sl) //when = o2<c2)



Lebih lanjut