
Đây là một chiến lược giao dịch sử dụng các kênh Tonzi trên nhiều thang thời gian để đánh giá điểm vào và điểm ra. Ý tưởng chính của chiến lược là: đánh giá xu hướng trên thang thời gian dài để tìm thời gian vào; đánh giá xu hướng đảo ngược trên thang thời gian ngắn để tìm thời gian ra.
Chiến lược này chủ yếu sử dụng các khái niệm của đường tông. Các đường tông bao gồm đường trên, đường dưới và đường trung tâm. Độ rộng của đường tông thay đổi theo quy mô thời gian.
Logic nhập cảnh: Khi giá phá vỡ trên đường dài của kênh đo thời gian dài, hãy xem đó là thời điểm nhập cảnh nhiều đầu. Để tránh phá vỡ giả, chúng tôi yêu cầu ít nhất một trong ba đường K gần đây có giá đóng cửa cao hơn đường trên của đường K, để tránh phá vỡ giả do mở rộng quá mức trong ngắn hạn.
Logic Exit: Khi giá phá vỡ một đường đi ngắn hơn, đó là thời gian để phá vỡ. Chúng tôi cũng yêu cầu ít nhất một trong ba đường K gần đây có giá đóng cửa K thấp hơn đường đi của đường K đó, để xác nhận tính hiệu quả của sự phá vỡ và tránh bị đặt.
Chiến lược này kết hợp các ưu điểm của theo dõi xu hướng và giao dịch đảo ngược. Các thước đo thời gian dài đánh giá xu hướng xu hướng, các thước đo thời gian ngắn đánh giá đảo ngược địa phương, kết hợp cả hai có thể bắt được sự biến động địa phương trong xu hướng.
Sử dụng phân tích theo nhiều thang thời gian, có thể xử lý tốt hơn các vấn đề về đột phá giả, làm cho việc vào và ra sân trở nên rõ ràng và hiệu quả hơn.
Thông qua các thông số tối ưu hóa, có thể thích ứng với các giống khác nhau và môi trường thị trường.
Chiến lược này rất nhạy cảm với các tham số, các tham số khác nhau có thể có kết quả hoàn toàn khác nhau. Cần kiểm tra đầy đủ và tối ưu hóa để tìm ra sự kết hợp tham số tốt nhất.
Trong tình huống chấn động, chiến lược có thể tạo ra nhiều tín hiệu giao dịch, dẫn đến giao dịch quá mức. Bạn có thể kiểm soát tổn thất đơn lẻ bằng cách thiết lập dừng lỗ.
Chiến lược này không tính đến logic đánh giá xu hướng ở cấp độ lớn, có thể thất bại ở điểm chuyển đổi bò và gấu. Có thể kết hợp với các chỉ số khác để đánh giá xu hướng ở cấp độ lớn.
Tối ưu hóa tham số, tìm ra sự kết hợp tham số tốt nhất. Các tham số như độ dài chu kỳ tối ưu hóa, loại kênh.
Thêm logic dừng lỗ. Thiết lập dừng di động hợp lý, kiểm soát tổn thất đơn lẻ.
Kết hợp với các chỉ số khác để đánh giá xu hướng cấp độ lớn. Ví dụ: EMA, K-line channel, chỉ số Mack. Tránh thất bại tại các điểm chuyển đổi quan trọng.
Chiến lược này nói chung là một chiến lược đột phá kênh đa thời gian điển hình. Nó kết hợp tốt các ưu điểm của theo dõi xu hướng và giao dịch đảo ngược, có hiệu quả trong việc nắm bắt biến động địa phương trong xu hướng thông qua phán đoán kênh của các thang thời gian khác nhau. Nếu tham số được tối ưu hóa, hiệu quả trong thị trường có xu hướng rõ ràng.
/*backtest
start: 2023-02-20 00:00:00
end: 2024-02-26 00:00:00
period: 1d
basePeriod: 1h
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/
// © venkyrocker7777
//@version=5
strategy('Donchain channel based investment strategy', shorttitle='Donchain channel strategy', overlay=true)
Length = input.int(21, minval=1)
xPrice = close
xvnoise = math.abs(xPrice - xPrice[1])
nAMA = 0.0
nfastend = 0.666
nslowend = 0.0645
nsignal = math.abs(xPrice - xPrice[Length])
nnoise = math.sum(xvnoise, Length)
nefratio = nnoise != 0 ? nsignal / nnoise : 0
nsmooth = math.pow(nefratio * (nfastend - nslowend) + nslowend, 2)
nAMA := nz(nAMA[1]) + nsmooth * (xPrice - nz(nAMA[1]))
plot(nAMA, color=color.new(color.blue, 0), title='KAMA')
// Function to get Lower Channel, Upper Channel, Middle Channel for a period length
getLCUCMC(PeriodLength) =>
lowestValueInThePeriod = ta.lowest(PeriodLength) // LC
highestValueInThePeriod = ta.highest(PeriodLength) // UC
middleChannelInTheperiod = math.avg(highestValueInThePeriod, lowestValueInThePeriod) // MC
// Returns Lower Channel, Upper Channel, Middle Channel for a period length
[lowestValueInThePeriod, highestValueInThePeriod, middleChannelInTheperiod]
// Longer time frame for entry
longerPeriod = 52
// Shorter time frame for exit
shorterPeriod = 12
if timeframe.period == 'D'
// Longer time frame for entry
longerPeriod := 52 * 5
// Shorter time frame for exit
shorterPeriod := 12 * 5
shorterPeriod
if timeframe.period == 'M'
// Longer time frame for entry
longerPeriod := 12
// Shorter time frame for exit
shorterPeriod := 3
shorterPeriod
// Get Lower Channel, Upper Channel, Middle Channel for longerPeriod, shorterPeriod
[lowestValueInTheLongerPeriodLength, highestValueInTheLongerPeriodLength, middleChannelInLongerperiod] = getLCUCMC(longerPeriod)
[lowestValueInTheShorterPeriodLength, highestValueInTheShorterPeriodLength, middleChannelInShorterperiod] = getLCUCMC(shorterPeriod)
// Plot Upper Channel of longerPeriod in dark green
plot(highestValueInTheLongerPeriodLength, 'highestValueInTheLongerPeriodLength', color=color.new(color.green, 0))
// Plot Lower Channel of shorterPeriod in dark red
plot(lowestValueInTheShorterPeriodLength, 'lowestValueInTheShorterPeriodLength', color=color.new(color.red, 0))
// Entry Plan
// Will start to see if we can enter when high crosses up longer period high (high >= highestValueInTheLongerPeriodLength)
// Check if any of the three past candles and enter when any of the 3 past candles satisfy
// 1) high of that candle >= highestValueInTheLongerPeriodLength of that candle (high[i] >= highestValueInTheLongerPeriodLength[i])
// 2) close of entry point consideration candle is above close of that candle (close > close[i])
isThisPointAnEntry() =>
// Check last 3 bars
isThisPointAnEntry = false
offset = 0
for i = 1 to 3 by 1
isCurrentCandleALongerPeriodHigh = high >= highestValueInTheLongerPeriodLength
isCurrentCandleCloseGreaterThanPreiousIthOne = close > close[i]
isPreviousIthCandleAlsoALongerPeriodHigh = high[i] >= highestValueInTheLongerPeriodLength[i]
isThisPointAnEntry := isCurrentCandleALongerPeriodHigh and isCurrentCandleCloseGreaterThanPreiousIthOne and isPreviousIthCandleAlsoALongerPeriodHigh
if isThisPointAnEntry
offset := -i
break
[isThisPointAnEntry, offset]
// Exit Plan - same as entry plan, with things reversed and also on a shorter time frame
// Will start to see if we should exit when low crosses down longer period low (low <= lowestValueInTheShorterPeriodLength)
// Check if any of the three past candles and exit when any of the 3 past candles satisfy
// 1) low of that candle <= highestValueInTheLongerPeriodLength of that candle (low[i] <= lowestValueInTheShorterPeriodLength[i])
// 2) close of exit point consideration candle is below close of that candle (close < close[i])
isThisPointAnExit() =>
// Check last 3 bars
isThisPointAnExit = false
for i = 1 to 3 by 1
isCurrentCandleAShorterPeriodLow = low <= lowestValueInTheShorterPeriodLength
isCurrentCandleCloseLesserThanPreiousIthOne = close < close[i]
isPreviousIthCandleAlsoAShorterPeriodLow = low[i] <= lowestValueInTheShorterPeriodLength[i]
isThisPointAnExit := isCurrentCandleAShorterPeriodLow and isCurrentCandleCloseLesserThanPreiousIthOne and isPreviousIthCandleAlsoAShorterPeriodLow
break
isThisPointAnExit
[isEntry, offset] = isThisPointAnEntry()
if isEntry
strategy.entry('Buy', strategy.long)
strategy.close_all(when=isThisPointAnExit() == true)
if year(timenow) == year(time) and month(timenow) == month(time) and dayofmonth(timenow) - 2 == dayofmonth(time)
strategy.close_all()