Strategi kuantitatif menggunakan penunjuk RSI dan penunjuk purata bergerak


Tarikh penciptaan: 2024-01-24 14:31:01 Akhirnya diubah suai: 2024-01-24 14:31:01
Salin: 0 Bilangan klik: 715
1
fokus pada
1617
Pengikut

Strategi kuantitatif menggunakan penunjuk RSI dan penunjuk purata bergerak

Gambaran keseluruhan

Strategi penembusan rantaian RSI ganda adalah strategi kuantitatif yang menggunakan RSI dan rantaian rantaian untuk menilai masa perdagangan. Gagasan utama strategi ini adalah menggunakan arah rantaian rantaian untuk menyaring isyarat untuk mencari titik penembusan yang lebih baik untuk membina kedudukan apabila RSI mencapai kawasan overbought dan oversold.

Prinsip Strategi

  1. Indeks RSI dan SMA mudah bergerak dikira mengikut parameter yang ditetapkan oleh pengguna.

  2. Apabila RSI melintasi garis oversold yang ditetapkan (default 30), isyarat multihead akan dihasilkan jika harga berada di bawah garis rata-rata keluar LONG.

  3. Apabila RSI melintasi garis overbought yang ditetapkan di bawah (default 70), isyarat kosong akan dihasilkan jika harga melebihi garis rata-rata keluar SHORT.

  4. Pengguna boleh memilih garisan purata penapis, dan isyarat akan dihasilkan apabila harga berada di atas garisan purata penapis.

  5. Keputusan untuk keluar dari kedudukan dilakukan mengikut garis keluar rata-rata LONG dan garis keluar rata-rata SHORT.

Analisis kelebihan

  1. Ia direka bentuk dengan dua penunjuk yang merangkumi dua faktor utama pasaran untuk meningkatkan ketepatan keputusan.

  2. Menggunakan ciri-ciri pembalikan RSI untuk mencari masa pembalikan.

  3. Filter rata-rata meningkatkan keamatan penghakiman dan mengelakkan mengejar tinggi dan rendah.

  4. Membolehkan parameter tersuai yang boleh dioptimumkan untuk pelbagai jenis dan kitaran.

  5. Reka bentuk logik yang mudah difahami dan diubah suai.

Analisis risiko

  1. Indeks RSI mudah menghasilkan garisan menegak, dan indeks ketumpatan dapat mengurangkan masalah ini.

  2. RSI dalam kitaran besar mudah gagal, boleh mengurangkan parameter pengoptimuman atau membantu petunjuk lain.

  3. Garis purata mempunyai ketinggalan, panjang garis purata boleh dipersingkat dengan sewajarnya atau membantu indikator seperti MACD.

  4. Syarat-syarat penilaian yang mudah, boleh memperkenalkan lebih banyak penunjuk untuk memastikan kesan isyarat perdagangan.

Arah pengoptimuman

  1. Mengoptimumkan parameter RSI atau memperkenalkan penunjuk ketumpatan untuk mengurangkan kemungkinan isyarat palsu.

  2. Gabungan trend dan indikator turun naik seperti DMI, BOLL untuk menentukan trend dan tahap sokongan.

  3. Memperkenalkan penunjuk gantian atau penilaian garis sejajar seperti MACD.

  4. Menambah logik syarat pembukaan untuk mengelakkan isyarat penembusan yang tidak diingini.

ringkaskan

Strategi penembusan rantaian RSI ganda menggunakan kaedah penilaian RSI untuk menilai kecenderungan overbought dan oversold dan penilaian rantaian rata-rata, secara teori dapat memanfaatkan peluang pembalikan secara berkesan. Strategi ini fleksibel, mudah dikendalikan, dan juga sesuai untuk pengoptimuman pelbagai jenis, merupakan strategi permulaan kuantitatif yang disyorkan. Dengan memperkenalkan lebih banyak petunjuk untuk membantu penilaian, strategi ini dapat meningkatkan lagi keberkesanan keputusan dan meningkatkan kebarangkalian keuntungan.

Kod sumber strategi
/*backtest
start: 2024-01-16 00:00:00
end: 2024-01-23 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Global Market Signals: RSI Strategy.
//@version=4
strategy("GMS: RSI Strategy", overlay=true)

LongShort = input(title="Long Only or Short Only or Both?", type=input.string, defval="Both", options=["Both", "Long Only", "Short Only"])
RSILength = input(title="RSI Length", type = input.integer ,defval=14)
RSIUpper = input(title="Upper Threshold", type = input.float ,defval=70)
RSILower = input(title="Lower Threshold", type = input.float ,defval=30)
LongExit = input(title="Long Exit SMA Length", type = input.integer ,defval=5)
ShortExit = input(title="Short Exit SMA Length", type = input.integer ,defval=5)
AboveBelow = input(title="Trend SMA Filter?", type=input.string, defval="Above", options=["Above", "Below", "Don't Include"])
TrendLength = input(title="Trend SMA Length", type = input.integer ,defval=200)


//Long Side

if LongShort =="Long Only" and AboveBelow == "Above"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close>sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Long Only" and AboveBelow == "Below"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close<sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Long Only" and AboveBelow == "Don't Include"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Both" and AboveBelow == "Above"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close>sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Both" and AboveBelow == "Below"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close<sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Both" and AboveBelow == "Don't Include"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
    
//SHORT SIDE

if LongShort =="Short Only" and AboveBelow == "Above"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Short Only" and AboveBelow == "Below"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Short Only" and AboveBelow == "Don't Include"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Both" and AboveBelow == "Above"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Both" and AboveBelow == "Below"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Both" and AboveBelow == "Don't Include"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit))
    strategy.close("SHORT", when = close<sma(close,ShortExit))