গাউসিয়ান চ্যানেল প্রবণতা অনুসরণ কৌশল


সৃষ্টির তারিখ: 2024-03-29 16:26:26 অবশেষে সংশোধন করুন: 2024-03-29 16:26:26
অনুলিপি: 2 ক্লিকের সংখ্যা: 1133
1
ফোকাস
1617
অনুসারী

গাউসিয়ান চ্যানেল প্রবণতা অনুসরণ কৌশল

ওভারভিউ

গাউসিয়ান চ্যানেল ট্রেন্ড ট্র্যাকিং কৌশল হল একটি ট্রেডিং কৌশল যা গাউসিয়ান চ্যানেল সূচকের উপর ভিত্তি করে ট্রেন্ড ট্র্যাকিং করে। এই কৌশলটি বাজারের প্রধান প্রবণতা ক্যাপচার করার জন্য তৈরি করা হয়েছে, একটি উত্থান প্রবণতা কিনতে এবং একটি অবস্থান রাখা, একটি পতনশীল প্রবণতা মধ্যে একটি সমান্তরাল পর্যবেক্ষণ। কৌশলটি গাউসিয়ান চ্যানেল সূচক ব্যবহার করে প্রবণতা দিক এবং শক্তি সনাক্ত করতে, দাম এবং চ্যানেলের উপর এবং নিচে ট্র্যাকের সম্পর্ক বিশ্লেষণ করে ক্রয় এবং বিক্রয় সময় নির্ধারণ করতে। প্রবণতা চলাকালীন যতটা সম্ভব লাভ অর্জন, যখন বাজারে ঘন ঘন ট্রেডিং এড়ানো।

কৌশল নীতি

গাউসিয়ান চ্যানেল ট্রেন্ড ট্র্যাকিং কৌশলটির কেন্দ্রবিন্দু হ’ল গাউসিয়ান চ্যানেল সূচক, যা এহলার্সের দ্বারা প্রস্তাবিত একটি প্রবণতা বিশ্লেষণ সরঞ্জাম যা গাউসিয়ান স্ট্রিং প্রযুক্তি এবং সত্যিকারের পরিসীমা ((True Range)) ব্যবহার করে। সূচকটি প্রথমে নমুনা চক্র এবং পোল পয়েন্টের সংখ্যা অনুসারে বিটা এবং α মান গণনা করে, তারপরে ডেটা ফিল্টার করে, সমতল কার্ভ ((Orbit) ।

কৌশলগত সুবিধা

  1. ট্রেন্ড ট্র্যাকিংঃ এই কৌশলটি বাজারের প্রধান প্রবণতাগুলিকে ধরতে এবং প্রবণতার দিকনির্দেশে বিনিয়োগ করতে সহায়তা করে যা দীর্ঘমেয়াদী স্থিতিশীল লাভ অর্জনে সহায়তা করে।
  2. ট্রেডিং ফ্রিকোয়েন্সি হ্রাস করুনঃ কৌশলটি ট্রেডিংয়ের সময় শুধুমাত্র ট্রেডিংয়ের সময় প্রবেশ করে এবং ট্রেডিং চলাকালীন সময় ধরে রাখে, যার ফলে অপ্রয়োজনীয় ট্রেডিং এবং ট্রেডিংয়ের খরচ হ্রাস পায়।
  3. বিলম্ব হ্রাস করুনঃ বিলম্ব মোড এবং দ্রুত প্রতিক্রিয়া মোড হ্রাস করে, কৌশলগুলি বাজারের পরিবর্তনের প্রতি আরও সময়মতো প্রতিক্রিয়া জানাতে পারে।
  4. প্যারামিটার নমনীয়তা: ব্যবহারকারীরা তাদের প্রয়োজন অনুযায়ী নীতির প্যারামিটারগুলিকে সামঞ্জস্য করতে পারেন, যেমন নমুনা চক্র, পোল সংখ্যা, বাস্তব পরিসীমা গুণক ইত্যাদি, নীতির কর্মক্ষমতা অনুকূলিত করতে।

কৌশলগত ঝুঁকি

  1. প্যারামিটার অপ্টিমাইজেশনের ঝুঁকিঃ অনুপযুক্ত প্যারামিটার সেটগুলি কৌশলটির দুর্বল পারফরম্যান্সের কারণ হতে পারে। প্যারামিটার অপ্টিমাইজেশন এবং বিভিন্ন বাজার পরিস্থিতিতে পুনরাবৃত্তি করার পরামর্শ দেওয়া হয় যাতে সর্বোত্তম প্যারামিটার সমন্বয় পাওয়া যায়।
  2. ট্রেন্ড রিভার্সনের ঝুঁকিঃ যখন বাজারের প্রবণতা হঠাৎ পাল্টে যায়, তখন কৌশলটি একটি বড় প্রত্যাহার তৈরি করতে পারে। স্টপ লস বা অন্যান্য সূচক প্রবর্তন করে ঝুঁকি নিয়ন্ত্রণ করা যেতে পারে।
  3. ঝড়ের বাজার ঝুঁকিঃ ঝড়ের বাজারে, কৌশলগুলি ঘন ঘন ট্রেডিং সিগন্যাল তৈরি করতে পারে, যার ফলে উপার্জন ক্ষতিগ্রস্থ হয়। সংকেতগুলিকে অপ্টিমাইজেশন প্যারামিটার বা অন্যান্য প্রযুক্তিগত সূচকগুলির সাথে সংযুক্ত করে ফিল্টার করা যেতে পারে।

কৌশল অপ্টিমাইজেশনের দিকনির্দেশনা

  1. অন্যান্য প্রযুক্তিগত সূচক প্রবর্তন করুনঃ অন্যান্য প্রবণতা বা কম্পন সূচক যেমন MACD, RSI ইত্যাদির সাথে সংযুক্ত করুন, যাতে সংকেতের নির্ভুলতা এবং নির্ভরযোগ্যতা বৃদ্ধি পায়।
  2. ডায়নামিক প্যারামিটার অপ্টিমাইজেশানঃ বাজারের অবস্থার পরিবর্তন অনুসারে, বিভিন্ন বাজারের অবস্থার সাথে খাপ খাইয়ে নিতে কৌশলগত প্যারামিটারগুলিকে গতিশীলভাবে সামঞ্জস্য করুন।
  3. ঝুঁকি নিয়ন্ত্রণ মডিউল যোগ করুনঃ যুক্তিসঙ্গত স্টপ লস এবং স্টপস্টপ নিয়ম সেট করুন, একক লেনদেনের ঝুঁকি এবং সামগ্রিক প্রত্যাহারের স্তর নিয়ন্ত্রণ করুন।
  4. মাল্টি-টাইম ফ্রেম বিশ্লেষণঃ বিভিন্ন সময়কালের সংকেত যেমন দিবালোক লাইন, 4 ঘন্টা লাইন ইত্যাদির সমন্বয় করে আরও ব্যাপক বাজার তথ্য পাওয়ার জন্য।

সারসংক্ষেপ

গাউসিয়ান চ্যানেল ট্রেন্ড ট্র্যাকিং কৌশল হল একটি গাউসিয়ান চ্যানেল ট্রেন্ড ট্র্যাকিং ট্রেডিং কৌশল যা বাজারের মূল প্রবণতাকে ক্যাপচার করে দীর্ঘমেয়াদী স্থিতিশীল আয় অর্জনের জন্য গাউসিয়ান ওয়ারেন্টি প্রযুক্তির উপর ভিত্তি করে। কৌশলটি প্রবণতা দিক এবং শক্তি সনাক্ত করতে গাউসিয়ান চ্যানেল সূচক ব্যবহার করে এবং বিলম্ব এবং দ্রুত প্রতিক্রিয়া হ্রাস করার বৈশিষ্ট্য সরবরাহ করে। কৌশলটির সুবিধাটি ভাল প্রবণতা ট্র্যাকিং ক্ষমতা এবং কম ট্রেডিং ফ্রিকোয়েন্সি, তবে এটি প্যারামিটার অপ্টিমাইজেশন, প্রবণতা বিপরীতমুখী এবং অস্থির বাজারের মতো ঝুঁকির মুখোমুখি। ভবিষ্যতে অন্যান্য প্রযুক্তিগত সূচক, গতিশীল প্যারামিটার অপ্টিমাইজেশন, ঝুঁকি নিয়ন্ত্রণ মডিউল এবং মাল্টি-ফ্রেম সময় বিশ্লেষণের সাথে যুক্ত করে কৌশলটি আরও স্থিতিশীলতা এবং লাভজনকতার জন্য উন্নত করা যেতে পারে।

কৌশল সোর্স কোড
/*backtest
start: 2023-03-23 00:00:00
end: 2024-03-28 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy(title="Gaussian Channel Strategy v2.0", overlay=true, calc_on_every_tick=false, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1, slippage=3)

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
// Gaussian Channel Indicaor - courtesy of @DonovanWall
//----------------------------------------------------------------------------------------------------------------------------------------------------------------- 

// Date condition inputs
startDate = input(timestamp("1 January 2018 00:00 +0000"), "Date Start", group="Main Algo Settings")
endDate = input(timestamp("1 January 2060 00:00 +0000"), "Date Start", group="Main Algo Settings")
timeCondition = true

// This study is an experiment utilizing the Ehlers Gaussian Filter technique combined with lag reduction techniques and true range to analyze trend activity.
// Gaussian filters, as Ehlers explains it, are simply exponential moving averages applied multiple times.
// First, beta and alpha are calculated based on the sampling period and number of poles specified. The maximum number of poles available in this script is 9.
// Next, the data being analyzed is given a truncation option for reduced lag, which can be enabled with "Reduced Lag Mode".
// Then the alpha and source values are used to calculate the filter and filtered true range of the dataset.
// Filtered true range with a specified multiplier is then added to and subtracted from the filter, generating a channel.
// Lastly, a one pole filter with a N pole alpha is averaged with the filter to generate a faster filter, which can be enabled with "Fast Response Mode". 

// Custom bar colors are included.

// Note: Both the sampling period and number of poles directly affect how much lag the indicator has, and how smooth the output is.
//      Larger inputs will result in smoother outputs with increased lag, and smaller inputs will have noisier outputs with reduced lag.
//      For the best results, I recommend not setting the sampling period any lower than the number of poles + 1. Going lower truncates the equation.

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
// Updates:
// Huge shoutout to @e2e4mfck for taking the time to improve the calculation method!
// -> migrated to v4
// -> pi is now calculated using trig identities rather than being explicitly defined.
// -> The filter calculations are now organized into functions rather than being individually defined.
// -> Revamped color scheme.

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
// Functions - courtesy of @e2e4mfck
//----------------------------------------------------------------------------------------------------------------------------------------------------------------- 

// Filter function 
f_filt9x (_a, _s, _i) => 
    int _m2 = 0, int _m3 = 0, int _m4 = 0, int _m5 = 0, int _m6 = 0, 
    int _m7 = 0, int _m8 = 0, int _m9 = 0, float _f = .0, _x = (1 - _a)
    // Weights. 
    // Initial weight _m1 is a pole number and equal to _i
    _m2 := _i == 9 ? 36  : _i == 8 ? 28 : _i == 7 ? 21 : _i == 6 ? 15 : _i == 5 ? 10 : _i == 4 ? 6 : _i == 3 ? 3 : _i == 2 ? 1 : 0
    _m3 := _i == 9 ? 84  : _i == 8 ? 56 : _i == 7 ? 35 : _i == 6 ? 20 : _i == 5 ? 10 : _i == 4 ? 4 : _i == 3 ? 1 : 0
    _m4 := _i == 9 ? 126 : _i == 8 ? 70 : _i == 7 ? 35 : _i == 6 ? 15 : _i == 5 ? 5  : _i == 4 ? 1 : 0
    _m5 := _i == 9 ? 126 : _i == 8 ? 56 : _i == 7 ? 21 : _i == 6 ? 6  : _i == 5 ? 1  : 0 
    _m6 := _i == 9 ? 84  : _i == 8 ? 28 : _i == 7 ? 7  : _i == 6 ? 1  : 0 
    _m7 := _i == 9 ? 36  : _i == 8 ? 8  : _i == 7 ? 1  : 0 
    _m8 := _i == 9 ? 9   : _i == 8 ? 1  : 0 
    _m9 := _i == 9 ? 1   : 0
    // filter
    _f :=   math.pow(_a, _i) * nz(_s) + 
      _i  *     _x      * nz(_f[1])      - (_i >= 2 ? 
      _m2 * math.pow(_x, 2)  * nz(_f[2]) : 0) + (_i >= 3 ? 
      _m3 * math.pow(_x, 3)  * nz(_f[3]) : 0) - (_i >= 4 ? 
      _m4 * math.pow(_x, 4)  * nz(_f[4]) : 0) + (_i >= 5 ? 
      _m5 * math.pow(_x, 5)  * nz(_f[5]) : 0) - (_i >= 6 ? 
      _m6 * math.pow(_x, 6)  * nz(_f[6]) : 0) + (_i >= 7 ? 
      _m7 * math.pow(_x, 7)  * nz(_f[7]) : 0) - (_i >= 8 ? 
      _m8 * math.pow(_x, 8)  * nz(_f[8]) : 0) + (_i == 9 ? 
      _m9 * math.pow(_x, 9)  * nz(_f[9]) : 0)

// 9 var declaration fun
f_pole (_a, _s, _i) =>
    _f1 =            f_filt9x(_a, _s, 1),      _f2 = (_i >= 2 ? f_filt9x(_a, _s, 2) : 0), _f3 = (_i >= 3 ? f_filt9x(_a, _s, 3) : 0)
    _f4 = (_i >= 4 ? f_filt9x(_a, _s, 4) : 0), _f5 = (_i >= 5 ? f_filt9x(_a, _s, 5) : 0), _f6 = (_i >= 6 ? f_filt9x(_a, _s, 6) : 0)
    _f7 = (_i >= 2 ? f_filt9x(_a, _s, 7) : 0), _f8 = (_i >= 8 ? f_filt9x(_a, _s, 8) : 0), _f9 = (_i == 9 ? f_filt9x(_a, _s, 9) : 0)
    _fn = _i == 1 ? _f1 : _i == 2 ? _f2 : _i == 3 ? _f3 :
      _i == 4     ? _f4 : _i == 5 ? _f5 : _i == 6 ? _f6 :
      _i == 7     ? _f7 : _i == 8 ? _f8 : _i == 9 ? _f9 : na
    [_fn, _f1]

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
// Inputs
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

// Source
src = input(defval=hlc3, title="Source")

// Poles
int N = input.int(defval=4, title="Poles", minval=1, maxval=9)

// Period
int per = input.int(defval=144, title="Sampling Period", minval=2)

// True Range Multiplier
float mult = input.float(defval=1.414, title="Filtered True Range Multiplier", minval=0)

// Lag Reduction
bool modeLag  = input.bool(defval=false, title="Reduced Lag Mode")
bool modeFast = input.bool(defval=false, title="Fast Response Mode")

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
// Definitions
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

// Beta and Alpha Components
beta  = (1 - math.cos(4*math.asin(1)/per)) / (math.pow(1.414, 2/N) - 1)
alpha = - beta + math.sqrt(math.pow(beta, 2) + 2*beta)

// Lag
lag = (per - 1)/(2*N)

// Data
srcdata = modeLag ? src + (src - src[lag]) : src
trdata  = modeLag ? ta.tr(true) + (ta.tr(true) - ta.tr(true)[lag]) : ta.tr(true)

// Filtered Values
[filtn, filt1]     = f_pole(alpha, srcdata, N)
[filtntr, filt1tr] = f_pole(alpha, trdata,  N)

// Lag Reduction
filt   = modeFast ? (filtn + filt1)/2 : filtn
filttr = modeFast ? (filtntr + filt1tr)/2 : filtntr

// Bands
hband = filt + filttr*mult
lband = filt - filttr*mult

// Colors
color1   = #0aff68
color2   = #00752d
color3   = #ff0a5a
color4   = #990032
fcolor   = filt > filt[1] ? #0aff68 : filt < filt[1] ? #ff0a5a : #cccccc
barcolor = (src > src[1]) and (src > filt) and (src < hband) ? #0aff68 : (src > src[1]) and (src >= hband) ? #0aff1b : (src <= src[1]) and (src > filt) ? #00752d : 
           (src < src[1]) and (src < filt) and (src > lband) ? #ff0a5a : (src < src[1]) and (src <= lband) ? #ff0a11 : (src >= src[1]) and (src < filt) ? #990032 : #cccccc

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
// Outputs
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

// Filter Plot
filtplot = plot(filt, title="Filter", color=fcolor, linewidth=3)

// Band Plots
hbandplot = plot(hband, title="Filtered True Range High Band", color=fcolor)
lbandplot = plot(lband, title="Filtered True Range Low Band", color=fcolor)

// Channel Fill
fill(hbandplot, lbandplot, title="Channel Fill", color=color.new(fcolor, 80))

// Bar Color
barcolor(barcolor)

longCondition = ta.crossover(close, hband) and timeCondition
closeAllCondition = ta.crossunder(close, hband) and timeCondition

if longCondition
    strategy.entry("long", strategy.long)

if closeAllCondition
    strategy.close("long")