
এই কৌশলটি বহু-চক্রের ডানচিয়ান চ্যানেলের সূচকগুলির উপর ভিত্তি করে একটি প্রবণতা ট্র্যাকিং সিস্টেম তৈরি করে। বিভিন্ন সময়কালের ডানচিয়ান চ্যানেলের ব্রেকডাউনগুলি বিশ্লেষণ করে, প্রধান প্রবণতা এবং স্থানীয় প্রবণতার সমন্বয়যুক্ত সম্পর্কগুলিকে একত্রিত করে, একটি দৃশ্যমান প্রবণতা-ব্যান্ডযুক্ত গ্রাফ গঠন করে। কৌশলটি প্রবণতার দুর্বলতা দেখানোর জন্য রঙের গভীর পরিবর্তন ব্যবহার করে, সবুজ অঞ্চলটি উত্থান প্রবণতা প্রতিনিধিত্ব করে, লাল অঞ্চলটি নিম্ন প্রবণতা প্রতিনিধিত্ব করে, রঙের গভীরতা প্রবণতা আরও স্পষ্ট।
কৌশলটির মূল অংশটি হ’ল ডনচিয়ান চ্যানেলের সূচকগুলির উপর ভিত্তি করে প্রবণতা নির্ধারণ করা। ডনচিয়ান চ্যানেলটি সর্বোচ্চ মূল্যের চ্যানেল এবং সর্বনিম্ন মূল্যের চ্যানেলের সমন্বয়ে গঠিত, যা বর্তমান মূল্যের সাথে চ্যানেলের অবস্থানের সম্পর্কের তুলনা করে প্রবণতা নির্ধারণ করে। প্রধানত নিম্নলিখিত কয়েকটি মূল উপাদান রয়েছেঃ
এই কৌশলটি একাধিক চক্রের ডং চিয়াং চ্যানেলের উদ্ভাবনী প্রয়োগের মাধ্যমে একটি দৃশ্যমান, যুক্তিসঙ্গতভাবে স্পষ্ট প্রবণতা ট্র্যাকিং ট্রেডিং সিস্টেম তৈরি করেছে। কৌশলটির মূল সুবিধা হ’ল জটিল প্রবণতা বিশ্লেষণ প্রক্রিয়াটি ভিজ্যুয়ালাইজ করা, যা ব্যবসায়ীদের বাজারের গতিবিধিকে সহজেই উপলব্ধি করতে সহায়তা করে। যুক্তিসঙ্গত প্যারামিটার অপ্টিমাইজেশন এবং ঝুঁকি নিয়ন্ত্রণ ব্যবস্থাগুলির সাথে, কৌশলটির ভাল রিয়েল-টাইম অ্যাপ্লিকেশন মূল্য রয়েছে। ব্যবসায়ীদের রিয়েল-টাইম প্রয়োগের সময় বাজারের পরিবেশের পছন্দগুলি বিবেচনা করার পরামর্শ দেওয়া হয় এবং তাদের ঝুঁকি সহনশীলতার সাথে পজিশন পরিচালনার পরামর্শ দেওয়া হয়।
/*backtest
start: 2024-06-12 00:00:00
end: 2025-02-19 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=6
strategy("Donchian Trend Ribbon Strategy", shorttitle="DonchianTrendRibbonStrat", overlay=true, precision=0)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Parameters
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dlen = input.int(defval=20, title="Donchian Channel Period", minval=10)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Helper function to determine color
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
f_color(mainTrend, localTrend) =>
// mainTrend = 1 => uptrend, -1 => downtrend
// localTrend = 1 => local uptrend, -1 => local downtrend
// Return color based on whether local trend aligns with the main trend
color c = na
if mainTrend == 1
c := localTrend == 1 ? color.new(color.lime, 0) : color.new(color.lime, 60)
else if mainTrend == -1
c := localTrend == -1 ? color.new(color.red, 0) : color.new(color.red, 60)
else
c := na
c
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Function dchannel - determines main trend (1 or -1)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dchannel(len) =>
float hh = ta.highest(len)
float ll = ta.lowest(len)
var int tr = 0
tr := close > hh[1] ? 1 : close < ll[1] ? -1 : nz(tr[1])
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Function dchannelalt - determines local trend and returns color
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dchannelalt(len, maintrend) =>
float hh = ta.highest(len)
float ll = ta.lowest(len)
var int tr = 0
tr := close > hh[1] ? 1 : close < ll[1] ? -1 : nz(tr[1])
f_color(maintrend, tr)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Calculate main trend
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
maintrend = dchannel(dlen)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Plotting the Donchian Trend Ribbon
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
plot( 5, color=dchannelalt(dlen - 0, maintrend), style=plot.style_columns, histbase= 0)
plot(10, color=dchannelalt(dlen - 1, maintrend), style=plot.style_columns, histbase= 5)
plot(15, color=dchannelalt(dlen - 2, maintrend), style=plot.style_columns, histbase=10)
plot(20, color=dchannelalt(dlen - 3, maintrend), style=plot.style_columns, histbase=15)
plot(25, color=dchannelalt(dlen - 4, maintrend), style=plot.style_columns, histbase=20)
plot(30, color=dchannelalt(dlen - 5, maintrend), style=plot.style_columns, histbase=25)
plot(35, color=dchannelalt(dlen - 6, maintrend), style=plot.style_columns, histbase=30)
plot(40, color=dchannelalt(dlen - 7, maintrend), style=plot.style_columns, histbase=35)
plot(45, color=dchannelalt(dlen - 8, maintrend), style=plot.style_columns, histbase=40)
plot(50, color=dchannelalt(dlen - 9, maintrend), style=plot.style_columns, histbase=45)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Trading Logic (STRATEGY)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool goLong = (maintrend == 1)
bool goShort = (maintrend == -1)
// Entry signals
if goLong
strategy.entry("Long", strategy.long)
if goShort
strategy.entry("Short", strategy.short)
// Close positions when trend changes
if strategy.position_size > 0 and goShort
strategy.close("Long")
if strategy.position_size < 0 and goLong
strategy.close("Short")