डोंगचीन चैनल ब्रेकआउट रणनीति डोंगचीन चैनल पर आधारित एक प्रवृत्ति ट्रैकिंग रणनीति है। यह रणनीति विभिन्न चक्रों के उच्चतम और निम्नतम कीमतों का उपयोग करके बहु- और शून्य-प्रवेश बिंदुओं और स्टॉप-लॉस बिंदुओं को निर्धारित करती है।
रणनीति का प्रवेश नियम यह हैः जब कीमत निर्दिष्ट अवधि (जैसे 20 दिन) के उच्चतम मूल्य को तोड़ती है, तो अधिक करें; जब कीमत निर्दिष्ट अवधि (जैसे 10 दिन) के निम्नतम मूल्य को तोड़ती है, तो शून्य करें।
EXIT नियम है: मल्टी हेड पोजीशन मिड-रेल या डाउन-रेल पर बंद होती है; खाली हेड पोजीशन मिड-रेल या अपर-रेल पर बंद होती है। मिड-रेल एक निर्दिष्ट अवधि (जैसे 10 दिन) के लिए उच्चतम और निम्नतम कीमतों का औसत है।
मान लीजिए कि ट्रेडिंग किस्म BTCUSDT है, और पैरामीटर निम्नानुसार हैंः
तो प्रवेश और रोक नियम इस प्रकार हैं:
प्रविष्टि और स्टॉप-लॉस चक्रों के पैरामीटर को गतिशील रूप से समायोजित करके, विभिन्न बाजार चक्रों में अनुकूलन किया जा सकता है, जिससे ट्रेंडिंग स्थितियों में बेहतर रिटर्न प्राप्त किया जा सकता है।
डोंगचीआन चैनल तोड़ने की रणनीति को ट्रेंड की दिशा का निर्धारण करने के लिए तोड़ने के लिए, स्टॉप-लॉस को चैनल के मध्य बिंदु या ट्रेलर के रूप में सेट किया जाता है, जिससे जोखिम को प्रभावी ढंग से नियंत्रित किया जा सकता है। अनुकूलित पैरामीटर सेटिंग के माध्यम से, रणनीति को ट्रेंडिंग स्थिति में पकड़ने की दर में सुधार किया जा सकता है। हालांकि, तोड़ने की प्रभावशीलता के फैसले और सावधानी से उपयोग करने पर ध्यान देना चाहिए, ताकि पैच या अति-व्यापार से बचा जा सके। कुल मिलाकर, यह रणनीति मध्य-रेखा ट्रेंडिंग स्थिति का पीछा करने के लिए उपयुक्त है, लेकिन इसका उपयोग अस्थिरता में नहीं किया जाना चाहिए।
/*backtest
start: 2023-08-14 00:00:00
end: 2023-09-13 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Donchian Channel Strategy", overlay=true, default_qty_type= strategy.percent_of_equity, initial_capital = 1000, default_qty_value = 20, commission_type=strategy.commission.percent, commission_value=0.036)
//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()