
Chiến lược phá vỡ kênh Dongguan là một chiến lược theo dõi xu hướng, nó tạo ra một kênh giá bằng cách tính toán giá cao nhất và giá thấp nhất trong một khoảng thời gian nhất định, và sử dụng biên giới của kênh làm tín hiệu mua và bán. Khi giá phá vỡ đường mòn, hãy làm trống; khi giá phá vỡ đường mòn, hãy làm nhiều hơn.
Chiến lược này sử dụng chỉ số đường Dongxian để đánh giá xu hướng giá và tính điểm thoát vào. Các đường Dongxian bao gồm đường lên, đường xuống và đường giữa. đường lên là giá cao nhất, đường dưới là giá thấp nhất và đường giữa là giá trung bình trong một chu kỳ nhất định.
Độ dài của chu kỳ vào và thoát có thể được cấu hình riêng biệt. Khi giá vượt lên, hãy nhập nhiều hơn. Khi giá vượt lên, hãy vào.
Ngoài ra, trong chiến lược cũng có điểm dừng. Đặt điểm dừng của nhiều vị trí là tỷ lệ {1 + điểm dừng của giá nhập, trái ngược với vị trí không có giá. Việc kích hoạt chức năng này có thể khóa lợi nhuận và tránh tổn thất mở rộng.
Nhìn chung, chiến lược này đánh giá xu hướng, đồng thời đảm bảo có đủ không gian để thiết lập các lệnh dừng và dừng. Điều này làm cho nó đặc biệt phù hợp với các loại tiền tệ kỹ thuật số có độ biến động cao.
Chiến lược này có những ưu điểm sau:
Chiến lược này cũng có những rủi ro sau:
Để kiểm soát những rủi ro trên, các biện pháp sau đây được khuyến cáo:
Chiến lược này có thể được tối ưu hóa thêm từ các khía cạnh sau:
Chiến lược đột phá kênh Đường Đông Dương nói chung là một chiến lược theo dõi xu hướng có sự phán đoán rõ ràng, có thể kiểm soát rủi ro. Nó đặc biệt phù hợp với các loại tiền tệ kỹ thuật số có biến động cao, có tiềm năng thu nhập cao. Đồng thời, chiến lược này cũng có một số tham số tối ưu hóa và khả năng kết hợp với các chỉ số khác, đây là những hướng có thể mở rộng trong tương lai.
/*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()