Sistem pelacakan tren kotak ganda


Tanggal Pembuatan: 2023-11-02 17:19:22 Akhirnya memodifikasi: 2023-11-02 17:19:22
menyalin: 0 Jumlah klik: 649
1
fokus pada
1621
Pengikut

Sistem pelacakan tren kotak ganda

Ringkasan

Sistem pelacakan tren adalah strategi pelacakan tren yang didasarkan pada sistem dua kotak. Ini menggunakan kotak siklus jangka panjang untuk menilai arah tren keseluruhan dan, ketika sinyal dihasilkan oleh kotak jangka pendek, memilih sinyal perdagangan yang sesuai dengan arah tren jangka panjang untuk masuk. Strategi ini melacak tren dan mengendalikan risiko sambil memaksimalkan keuntungan.

Prinsip Strategi

Strategi ini menggunakan dua kotak untuk menilai tren. kotak jangka panjang menggunakan siklus yang lebih panjang untuk menentukan arah tren utama, dan kotak jangka pendek menggunakan siklus yang lebih pendek untuk menentukan sinyal perdagangan tertentu.

Strategi ini pertama-tama menghitung harga tertinggi dan terendah dari kotak jangka panjang untuk menentukan arah tren utama. Arah tren dibagi menjadi tiga jenis:

  • Harga tertinggi dengan garis K di atasnya, didefinisikan sebagai tren naik, dengan nilai 1
  • Harga minimum di bawah harga minimum diletakkan pada garis K, didefinisikan sebagai tren turun, dengan nilai -1
  • Jika tidak, tetap pada arah yang sama.

Setelah menentukan arah tren utama, strategi dimulai dengan masuk ke dalam kotak jangka pendek. Secara khusus:

  • Bila tren utama adalah naik, dan harga minimum kotak jangka pendek sama dengan harga minimum garis K di atas, dan lebih rendah dari harga minimum kotak jangka pendek saat ini, lakukan lebih banyak
  • Bila tren utama adalah turun dan harga tertinggi dalam kotak pendek sama dengan harga tertinggi di garis K di atas dan lebih tinggi dari harga tertinggi dalam kotak pendek saat ini, maka melakukan shorting

Selain itu, strategi juga mengatur stop loss dan stop loss:

  • Multiple stop loss adalah harga terendah untuk long term box, single stop loss adalah harga tertinggi untuk long term box
  • Harga tertinggi untuk kotak multi-stop, harga terendah untuk kotak kosong

Semua posisi ditutup ketika tren utama berbalik.

Analisis Keunggulan

Strategi ini memiliki keuntungan sebagai berikut:

  1. Menggunakan sistem penilaian dua kotak, dapat secara efektif mengidentifikasi arah tren, mengurangi probabilitas perdagangan yang salah
  2. Hanya masuk jika sinyal pembalikan jangka pendek sesuai dengan arah tren jangka panjang, untuk menghindari kebisingan pasar jangka pendek yang menyesatkan
  3. Menggunakan jangka panjang dan jangka pendek untuk memastikan kemampuan untuk menangkap tren utama dan memiliki fleksibilitas untuk menyesuaikan posisi dengan tepat
  4. Pengaturan stop loss yang lebih masuk akal untuk mengontrol risiko sambil mengontrol tren
  5. Peningkatan posisi cepat pada saat perubahan tren utama, pengendalian kerugian tepat waktu

Analisis risiko

Strategi ini juga memiliki risiko sebagai berikut:

  1. Tidak tepatnya pengaturan jangka pendek yang panjang, mudah menyebabkan perdagangan yang sering atau kehilangan peluang
  2. Kejadian tak terduga yang menyebabkan pembalikan tren jangka pendek tidak selalu berarti pembalikan tren jangka panjang, di mana risiko kerugian tetap ada
  3. Stop loss yang terlalu dekat dapat membuat pasar terguncang
  4. Stop-loss terlalu longgar dan mungkin tidak maksimal
  5. Kesalahan dalam penilaian tren jangka panjang menyebabkan kerugian transaksi berikutnya berkembang.
  6. Metode untuk mengatasi risiko ini meliputi: penyesuaian parameter siklus panjang dan pendek, pengoptimalan posisi stop loss, peningkatan kondisi filter, dan lain-lain.

Arah optimasi

Strategi ini dapat dioptimalkan dalam beberapa hal:

  1. Meningkatkan kondisi penyaringan untuk menghindari sinyal yang tertipu oleh penembusan palsu jangka pendek
  2. Optimalkan parameter siklus panjang dan pendek agar lebih sesuai dengan karakteristik varietas yang berbeda
  3. Dinamiskan posisi stop loss agar stop loss lebih akurat dan stop loss lebih lengkap
  4. Menambahkan strategi manajemen posisi untuk membuat ukuran posisi lebih masuk akal
  5. Keandalan perubahan tren yang digabungkan dengan indikator volume
  6. Mengoptimalkan parameter dan kondisi penyaringan secara otomatis menggunakan metode pembelajaran mesin

Meringkaskan

Sistem pelacakan tren secara keseluruhan adalah strategi pelacakan tren yang sangat praktis. Ini memiliki kemampuan untuk menilai tren dan melakukan penyesuaian jangka pendek, serta mengendalikan risiko saat melacak tren. Dengan terus dioptimalkan, strategi ini dapat menjadi sistem perdagangan tren otomatis yang kuat.

||

Overview

The Trend Following System is a trend tracking strategy based on a double box system. It uses a long-term box to determine the overall trend direction and takes signals that align with the major trend when the short-term box triggers. This strategy follows trends while managing risks.

Strategy Logic

The strategy uses two boxes to determine the trend. The long-term box uses a longer period to judge the major trend direction, and the short-term box uses a shorter period to generate trading signals.

First, the strategy calculates the highest and lowest prices of the long-term box to determine the major trend direction. The trend direction can be:

  • If the highest price crosses above the highest price of the previous bar, it is defined as an uptrend, assigned a value of 1
  • If the lowest price crosses below the lowest price of the previous bar, it is defined as a downtrend, assigned a value of -1
  • Otherwise, maintain the original trend direction

After determining the major trend, the strategy starts taking positions based on the short-term box signals. Specifically:

  • When the major trend is up and the short-term box’s lowest price equals the previous bar’s lowest price and is lower than the current short-term box’s lowest price, go long.
  • When the major trend is down and the short-term box’s highest price equals the previous bar’s highest price and is higher than the current short-term box’s highest price, go short.

In addition, stop loss and take profit are configured:

  • Long stop loss is the lowest price of the long-term box, short stop loss is the highest price of the long-term box
  • Long take profit is the highest price of the short-term box, short take profit is the lowest price of the short-term box

When the major trend reverses, close all positions.

Advantage Analysis

The advantages of this strategy include:

  1. The double box system effectively identifies trend directions and reduces incorrect trades
  2. Only taking reversal signals that align with the major trend avoids being misled by short-term market noise
  3. The combination of long and short periods ensures capturing major trends while maintaining position adjustment flexibility
  4. Reasonable stop loss and take profit points control risk while following trends
  5. Quickly flattening all positions when the major trend reverses minimizes losses

Risk Analysis

The risks of this strategy include:

  1. Improper long and short period settings may cause overtrading or missing opportunities
  2. Short-term reversals may not represent long-term trend changes, still posing loss risks
  3. Stop loss too close may get stopped out prematurely
  4. Take profit too loose may not maximize profits
  5. Wrong judgment of the major trend leads to losses
  6. Solutions include adjusting periods, optimizing stops/targets, adding filters etc.

Optimization Directions

The strategy can be improved by:

  1. Adding filters to avoid false breakouts
  2. Optimizing long and short periods for different products
  3. Dynamically adjusting stop loss and take profit levels
  4. Incorporating position sizing rules
  5. Using volume etc. to judge reliability of trend changes
  6. Utilizing machine learning to auto-optimize parameters and filters

Summary

The Trend Following System is a practical trend trading strategy combining trend determination and short-term adjustments. With continuous optimizations, it can become a robust automated system that tracks trends while controlling risks. It contains the core philosophies of trend trading and is worth in-depth studying.

[/trans]

Kode Sumber Strategi
/*backtest
start: 2023-10-25 00:00:00
end: 2023-10-26 07:00:00
period: 5m
basePeriod: 1m
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/
// © LonesomeTheBlue

//@version=4
strategy("Grab Trading System", overlay = true)
flb = input(defval = 80, title = "Longterm Period", minval = 1)
slb = input(defval = 21, title = "Shortterm Period", minval = 1)
showtarget = input(defval = true, title = "Show Target")
showtrend = input(defval = true, title = "Show Trend")

major_resistance = highest(flb)
major_support = lowest(flb)
minor_resistance = highest(slb)
minor_support = lowest(slb)

var int trend = 0
trend := high > major_resistance[1] ? 1 : low < major_support[1] ? -1 : trend
strategy.entry("Buy", true, when = trend == 1 and low[1] == minor_support[1] and low > minor_support)
strategy.entry("Sell", false, when = trend == -1 and high[1] == minor_resistance[1] and high < minor_resistance)

if strategy.position_size > 0
    strategy.exit("Buy", stop = major_support, comment = "Stop Buy")
    if high[1] == minor_resistance[1] and high < minor_resistance
        strategy.close("Buy", comment ="Close Buy")
    
if strategy.position_size < 0
    strategy.exit("Sell", stop = major_resistance, comment = "Stop Sell")
    if low[1] == minor_support[1] and low > minor_support
        strategy.close("Sell", comment ="Close Sell")

if strategy.position_size != 0 and change(trend)
    strategy.close_all()
    
majr = plot(major_resistance, color = showtrend and trend == -1 and trend[1] == -1 ? color.red : na)
majs = plot(major_support, color = showtrend and trend == 1 and trend[1] == 1 ? color.lime : na)
minr = plot(minor_resistance, color = showtarget and trend == 1 and strategy.position_size > 0 ? color.yellow : na, style = plot.style_circles)
mins = plot(minor_support, color = showtarget and trend == -1 and strategy.position_size < 0 ? color.yellow : na, style = plot.style_circles)

fill(majs, mins, color = showtrend and trend == 1 and trend[1] == 1 ? color.lime : na, transp = 85)
fill(majr, minr, color = showtrend and trend == -1 and trend[1] == -1 ? color.red : na, transp = 85)