Strategi Penembusan Tren Bulanan

Penulis:ChaoZhang, Tanggal: 2023-10-24 16:08:33
Tag:

img

Gambaran umum

Strategi Breakout Tren Bulanan adalah indikator TradingView berdasarkan Pine Script. Ini menggabungkan rata-rata bergerak adaptif, trendline breakout dan indikator RSI untuk menentukan sinyal masuk panjang sebulan sekali. Exits terjadi ketika RSI menunjukkan kondisi overbought.

Logika Strategi

  1. Tentukan variabel lastEntryMonth untuk melacak bulan entri terakhir. currentMonth mendapatkan bulan saat ini.

  2. Atur parameter MA adaptif TRAMA panjang = 99 untuk merata harga dan menentukan tren.

  3. Set length_trend=14 untuk memetakan garis tren atas berdasarkan pivot high.

  4. Menghitung indikator RSI dengan rsiLength=14 untuk menentukan overbought/oversold.

  5. Logika entri: Go long jika close > TRAMA dan close break di atas trendline atas, jika tidak ada entri bulan lalu.

  6. Logika keluar: Tutup panjang jika RSI > 70 (terlalu banyak dibeli).

  7. Grafik garis TRAMA dan RSI overbought level 70.

Strategi ini menggabungkan 3 indikator teknis utama untuk menemukan low risk long entries sekali per bulan.

Keuntungan

  1. Menggabungkan beberapa indikator untuk analisis pasar yang kuat dan akurasi yang lebih tinggi.

  2. Batasi entri untuk jangka waktu bulanan, menghindari overtrading.

  3. Adaptive MA cepat beradaptasi dengan perubahan tren.

  4. RSI oversold menghindari pembelian di puncak pasar dan mengontrol risiko.

  5. Aturan masuk/keluar yang sederhana mudah diterapkan.

  6. Parameter yang dapat disesuaikan memungkinkan optimasi strategi.

Risiko

  1. Whipsaw risiko jika breakout gagal. Stop loss jika harga pecah kembali di bawah garis tren.

  2. Waktu yang buruk menyebabkan entri dekat puncak.

  3. Parameter indikator yang buruk menyebabkan sinyal yang menyesatkan.

  4. Penembusan mungkin mencerminkan volatilitas pasar baru-baru ini.

  5. Pertimbangkan hanya perdagangan pullbacks atau menambahkan filter konfirmasi lainnya.

  6. Mengvalidasi indikator pada beberapa kerangka waktu. Gunakan kerangka waktu yang lebih tinggi untuk mengidentifikasi tren dan lebih rendah untuk masuk.

  7. Backtest pada kondisi pasar yang berbeda. Optimalkan parameter untuk mencocokkan strategi dengan jenis pasar.

Optimalisasi

  1. Tambahkan indikator volume untuk menghindari kebocoran palsu dengan volume rendah.

  2. Pertimbangkan keuntungan parsial mengambil RSI overbought keluar, menjaga posisi parsial.

  3. Mengoptimalkan parameter MA untuk menyesuaikan diri dengan perubahan tren.

  4. Tambahkan zona sebelum/setelah titik breakout untuk menghindari membeli tepat pada pembalikan.

  5. Tambahkan filter seperti saluran, volatilitas untuk akurasi yang lebih tinggi.

  6. Skala dengan penyemburan tambahan pada tingkat resistensi baru.

Kesimpulan

Strategi Breakout Tren Bulanan menganalisis tren, momentum dan ekstrem. Ini menentukan tren pada kerangka waktu bulanan tetapi masuk pada kerangka waktu yang lebih pendek. RSI mengawasi manajemen risiko. Logika sederhana mengidentifikasi entri panjang bulanan yang dioptimalkan. Ini menyeimbangkan mengikuti tren dan pengendalian risiko. Optimasi parameter menyesuaikan dengan kondisi pasar yang berbeda. Secara keseluruhan, ini adalah strategi sederhana namun kuat yang menggabungkan kegunaan dan manajemen risiko yang efektif.


/*backtest
start: 2022-10-17 00:00:00
end: 2023-10-23 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy('Bannos Strategy', shorttitle='Bannos', overlay=true)

//The provided script is an indicator for TradingView written in Pine Script version 5. The indicator is used to determine entry and exit points for a trading strategy. Here's a detailed breakdown of what the script does:

// Strategy Definition:

// Bannos Strategy is the full name, with a short title Bannos.
// The overlay=true option indicates that the strategy will be overlayed on the price chart.
// Tracking Entry Month:

// A variable lastEntryMonth is set up to track the month of the last entry.
// currentMonth identifies the current month.
// Trend Regularity Adaptive Moving Average (TRAMA):

// It takes an input of length 99 as default.
// It uses adaptive calculations to track trend changes.
// Trendlines with Breaks:

// Identifies local peaks over a given period (in this case, 14) and calculates a slope based on these peaks.
// Relative Strength Index (RSI):

// Uses a length of 14 (default) to calculate the RSI.
// RSI is an oscillation indicator that indicates overbought or oversold conditions.
// Strategy Logic for Long Entry:

// A long position is opened if:
// The close price is above the TRAMA.
// There's a crossover of the close price and the upper trendline.
// The position is taken only once per month.
// Strategy Logic for Long Exit:

// The long position is closed if the RSI exceeds 70, indicating an overbought condition.
// Plotting:

// The TRAMA is plotted in red on the chart.
// A horizontal line is also drawn at 70 to indicate the RSI's overbought zone.
// In summary, this strategy aims to enter a long position when certain trend and crossover conditions are met, and close the position when the market is considered overbought as per the RSI. Additionally, it ensures entries only occur once a month.
//



// Variable pour suivre le mois de la dernière entrée
var float lastEntryMonth = na
currentMonth = month(time)

// Parameters for Trend Regularity Adaptive Moving Average (TRAMA)
length_trama = input(99)
src_trama = close
ama = 0.
hh = math.max(math.sign(ta.change(ta.highest(length_trama))), 0)
ll = math.max(math.sign(ta.change(ta.lowest(length_trama)) * -1), 0)
tc = math.pow(ta.sma(hh or ll ? 1 : 0, length_trama), 2)
ama := nz(ama[1] + tc * (src_trama - ama[1]), src_trama)

// Parameters for Trendlines with Breaks
length_trend = 14
mult = 1.0
ph = ta.pivothigh(length_trend, length_trend)
upper = 0.
slope_ph = 0.
slope_ph := ph ? mult : slope_ph
upper := ph ? ph : upper - slope_ph

// Parameters for RSI
rsiLength = 14
up = ta.rma(math.max(ta.change(close), 0), rsiLength)
down = ta.rma(-math.min(ta.change(close), 0), rsiLength)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))

// Strategy Logic for Long Entry
longCondition = close > ama and ta.crossover(close, upper) and (na(lastEntryMonth) or lastEntryMonth != currentMonth)
if (longCondition)
    lastEntryMonth := currentMonth
    strategy.entry('Long', strategy.long)

// Strategy Logic for Long Exit
exitCondition = rsi > 70
if (exitCondition)
    strategy.close('Long')

// Plotting
plot(ama, 'TRAMA', color=color.red)
hline(70, 'Overbought', color=color.red)


Lebih banyak