
Strategi penembusan saluran Dongguan adalah strategi pelacakan tren yang membentuk saluran harga dengan menghitung harga tertinggi dan terendah dalam jangka waktu tertentu, dan menggunakan batas saluran sebagai sinyal beli dan jual. Ketika harga menerobos tren, buat kosong; ketika harga menerobos tren, buat lebih banyak.
Strategi ini menggunakan indikator saluran Tongxian untuk menilai tren harga dan menghitung titik keluar masuk. Saluran Tongxian terdiri dari lintasan atas, lintasan bawah, dan lintasan tengah. Lintasan atas adalah harga tertinggi, lintasan bawah adalah harga terendah, dan lintasan tengah adalah harga rata-rata dalam periode tertentu.
Panjang siklus masuk dan keluar dapat dikonfigurasi secara independen. Ketika harga naik, masuk lebih banyak; Ketika harga turun, masuk lebih banyak.
Selain itu, dalam strategi juga diatur titik berhenti. Untuk melakukan lebih banyak posisi, stop loss adalah rasio antara harga masuk ((1 + stop loss), sedangkan untuk posisi short position sebaliknya. Mengaktifkan fitur ini dapat mengunci keuntungan dan menghindari perluasan kerugian.
Secara keseluruhan, strategi ini menilai tren dan memastikan bahwa ada cukup ruang untuk mengatur stop loss dan stop loss. Ini membuatnya sangat cocok untuk varietas dengan volatilitas tinggi seperti mata uang digital.
Strategi ini memiliki keuntungan sebagai berikut:
Strategi ini juga memiliki risiko sebagai berikut:
Untuk mengendalikan risiko tersebut, disarankan untuk mengambil langkah-langkah berikut:
Strategi ini dapat dioptimalkan lebih lanjut dari dimensi-dimensi berikut:
Secara keseluruhan, strategi penembusan saluran Dongguan adalah strategi pelacakan tren dengan penilaian yang jelas dan risiko yang dapat dikendalikan. Ini sangat cocok untuk varietas yang sangat fluktuatif seperti mata uang digital dengan potensi pendapatan yang tinggi.
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 4h
basePeriod: 15m
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/
// © algotradingcc
// Strategy testing and optimisation for free trading bot
//@version=4
strategy("Donchian Channel Strategy [for free bot]", overlay=true )
//Long optopns
buyPeriodEnter = input(10, "Channel Period for Long enter position")
buyPeriodExit = input(10, "Channel Period for Long exit position")
isMiddleBuy = input(true, "Is exit on Base Line? If 'no' - exit on bottom line")
takeProfitBuy = input(2.5, "Take Profit (%) for Long position")
isBuy = input(true, "Allow Long?")
//Short Options
sellPeriodEnter = input(20, "Channel Period for Short enter position")
sellPeriodExit = input(20, "Channel Period for Short exit position")
isMiddleSell = input(true, "Is exit on Base Line? If 'no' - exit on upper line")
takeProfitSell = input(2.5, "Take Profit (%) for Short position")
isSell = input(true, "Allow Short?")
// Test Start
startYear = input(2005, "Test Start Year")
startMonth = input(1, "Test Start Month")
startDay = input(1, "Test Start Day")
startTest = timestamp(startYear,startMonth,startDay,0,0)
//Test End
endYear = input(2050, "Test End Year")
endMonth = input(12, "Test End Month")
endDay = input(30, "Test End Day")
endTest = timestamp(endYear,endMonth,endDay,23,59)
timeRange = time > startTest and time < endTest ? true : false
// Long&Short Levels
BuyEnter = highest(buyPeriodEnter)
BuyExit = isMiddleBuy ? ((highest(buyPeriodExit) + lowest(buyPeriodExit)) / 2): lowest(buyPeriodExit)
SellEnter = lowest(sellPeriodEnter)
SellExit = isMiddleSell ? ((highest(sellPeriodExit) + lowest(sellPeriodExit)) / 2): highest(sellPeriodExit)
// Plot Data
plot(BuyEnter, style=plot.style_line, linewidth=2, color=color.blue, title="Buy Enter")
plot(BuyExit, style=plot.style_line, linewidth=1, color=color.blue, title="Buy Exit", transp=50)
plot(SellEnter, style=plot.style_line, linewidth=2, color=color.red, title="Sell Enter")
plot(SellExit, style=plot.style_line, linewidth=1, color=color.red, title="Sell Exit", transp=50)
// Calc Take Profits
TakeProfitBuy = 0.0
TakeProfitSell = 0.0
if strategy.position_size > 0
TakeProfitBuy := strategy.position_avg_price*(1 + takeProfitBuy/100)
if strategy.position_size < 0
TakeProfitSell := strategy.position_avg_price*(1 - takeProfitSell/100)
// Long Position
if isBuy and timeRange
strategy.entry("Long", strategy.long, stop = BuyEnter, when = strategy.position_size == 0)
strategy.exit("Long Exit", "Long", stop=BuyExit, limit = TakeProfitBuy, when = strategy.position_size > 0)
// Short Position
if isSell and timeRange
strategy.entry("Short", strategy.short, stop = SellEnter, when = strategy.position_size == 0)
strategy.exit("Short Exit", "Short", stop=SellExit, limit = TakeProfitSell, when = strategy.position_size < 0)
// Close & Cancel when over End of the Test
if time > endTest
strategy.close_all()
strategy.cancel_all()