মাল্টি-ব্যান্ড পরিসংখ্যানগত প্রবণতা বিশ্লেষণ কৌশল

BB SMA EMA SD PL QB
সৃষ্টির তারিখ: 2025-02-20 16:45:59 অবশেষে সংশোধন করুন: 2025-02-20 16:45:59
অনুলিপি: 1 ক্লিকের সংখ্যা: 348
2
ফোকাস
319
অনুসারী

মাল্টি-ব্যান্ড পরিসংখ্যানগত প্রবণতা বিশ্লেষণ কৌশল মাল্টি-ব্যান্ড পরিসংখ্যানগত প্রবণতা বিশ্লেষণ কৌশল

ওভারভিউ

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

কৌশল নীতি

কৌশলটির মূল নীতিটি হল একাধিক পরিসংখ্যানের বন্ডের ক্রস দ্বারা বাজার প্রবণতা ধরা। প্রধানত নিম্নলিখিত কয়েকটি মূল উপাদান রয়েছেঃ

  1. ব্রিন ব্যান্ড সিস্টেম - দামের ওঠানামা নির্ধারণের জন্য ব্যবহৃত হয়, যখন দামের উত্তোলন হয় তখন এটি হলুদ সতর্কতা দেয়।
  2. ডিজিটাল ব্যান্ড সিস্টেম - দামের সর্বোচ্চ সম্ভাব্যতার মূল্যায়নের জন্য দামের উপরের এবং নীচের ডিজিটাল গণনা করে।
  3. ক্যালোরি ব্যান্ড সিস্টেম - ঐতিহাসিক রিটার্নের উপর ভিত্তি করে উল্লেখযোগ্যতার মাত্রা গণনা করে ওভারবয় ওভারসোলের পরিমাপ করা হয়।
  4. ট্রিগার সিস্টেম - উপরের ডিজিটাল ব্যান্ডের নিচের স্ট্যান্ডার্ড ডিফারেনশিয়াল লাইনটি মূল ট্রিগার সিগন্যাল হিসাবে কাজ করে, এবং এই লাইনের উপরে দাম বজায় রাখা একটি কুয়াশাচিহ্ন হিসাবে বিবেচিত হয়।
  5. কনফার্মেশন সিস্টেম - ক্রমাগত কনফার্মেশন K লাইন সংখ্যা সেট করে মিথ্যা সংকেত ফিল্টার করুন।

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

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

কৌশলগত ঝুঁকি

  1. পিছিয়ে পড়ার ঝুঁকি - পরিসংখ্যানগত সূচকগুলি কিছুটা পিছিয়ে রয়েছে এবং সম্ভবত সেরা প্রবেশের পয়েন্টটি মিস করেছে।
  2. অস্থির বাজারগুলি খারাপ - একটি অস্থির বাজারগুলির মধ্যে অতিরিক্ত ট্রেডিং সংকেত তৈরি হতে পারে।
  3. প্যারামিটার সংবেদনশীলতা - বিভিন্ন প্যারামিটার সমন্বয়গুলির প্রভাবের মধ্যে বড় পার্থক্য রয়েছে, যার জন্য বারবার অপ্টিমাইজেশন প্রয়োজন।
  4. ভারী কম্পিউটিং লোড - একাধিক পরিসংখ্যানের জন্য রিয়েল-টাইম কম্পিউটিংয়ের জন্য প্রচুর কম্পিউটিং রিসোর্স প্রয়োজন।
  5. বাজারের উপর নির্ভরশীলতা - চরম বাজারের পরিস্থিতিতে পরিসংখ্যানগত নিয়মগুলি ব্যর্থ হতে পারে।

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

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

সারসংক্ষেপ

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

কৌশল সোর্স কোড
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-18 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BNB_USDT"}]
*/

//@version=6
strategy("Multi-Band Comparison Strategy with Separate Entry/Exit Confirmation", overlay=true, 
         default_qty_type=strategy.percent_of_equity, default_qty_value=10, 
         initial_capital=5000, currency=currency.USD)

// === Inputs ===

// Basic Parameters
length         = input.int(20, "Length (SMA)", minval=1)
boll_mult      = input.float(1.0, "Bollinger Band Multiplier", minval=0.1, step=0.1)
upper_quantile = input.float(0.95, "Upper Quantile (0.0-1.0)", minval=0.0, maxval=1.0)
lower_quantile = input.float(0.05, "Lower Quantile (0.0-1.0)", minval=0.0, maxval=1.0)

// Separate confirmation inputs
entry_confirmBars = input.int(1, "Entry Confirmation Bars", minval=1, tooltip="Number of consecutive bars the entry condition must hold")
exit_confirmBars  = input.int(1, "Exit Confirmation Bars",  minval=1, tooltip="Number of consecutive bars the exit condition must hold")

// Toggle Visibility for Bands
show_lower_boll  = input.bool(false, "Show Lower Bollinger Band", tooltip="Enable or disable the lower Bollinger Band")
show_upper_boll  = input.bool(true,  "Show Upper Bollinger Band", tooltip="Enable or disable the upper Bollinger Band")
show_lower_quant = input.bool(true, "Show Lower Quantile Band", tooltip="Enable or disable the lower Quantile Band")
show_upper_quant = input.bool(true,  "Show Upper Quantile Band", tooltip="Enable or disable the upper Quantile Band")
show_upper_power = input.bool(true,  "Show Upper Power-Law Band", tooltip="Enable or disable the upper Power-Law Band")
show_lower_power = input.bool(false, "Show Lower Power-Law Band", tooltip="Enable or disable the lower Power-Law Band")
show_quant_std   = input.bool(true,  "Show Standard Deviation around Quantile Bands", tooltip="Enable or disable standard deviation lines around Quantile Bands")

// Individual Toggles for Std Dev Lines
show_upper_quant_std_up   = input.bool(true,  "Show Upper Quantile + Std Dev", tooltip="Enable or disable the Upper Quantile + Std Dev line")
show_upper_quant_std_down = input.bool(true,  "Show Upper Quantile - Std Dev", tooltip="Enable or disable the Upper Quantile - Std Dev line")
show_lower_quant_std_up   = input.bool(false, "Show Lower Quantile + Std Dev", tooltip="Enable or disable the Lower Quantile + Std Dev line")
show_lower_quant_std_down = input.bool(true,  "Show Lower Quantile - Std Dev", tooltip="Enable or disable the Lower Quantile - Std Dev line")

// Moving Average Toggles
show_ema = input.bool(false, "Show EMA", tooltip="Enable or disable the Exponential Moving Average")
show_sma = input.bool(false, "Show SMA", tooltip="Enable or disable the Simple Moving Average")

// EMA Parameters
ema_length = input.int(50, minval=1, title="EMA Length")
ema_source = input.source(close, title="EMA Source")

// === Data Handling ===

// Create persistent arrays to store data
var float[] data_array   = array.new_float()
var float[] return_array = array.new_float()

// Update the data array with the latest close prices
if array.size(data_array) < length
    array.push(data_array, close)
else
    array.shift(data_array)
    array.push(data_array, close)

// Update the return array with the latest returns
returns = close / close[1] - 1
if array.size(return_array) < length
    array.push(return_array, returns)
else
    array.shift(return_array)
    array.push(return_array, returns)

// === Helper Function ===

// Function to calculate a custom percentile
f_percentile(arr, quantile) =>
    arr_sorted = array.copy(arr)
    array.sort(arr_sorted, order.ascending)
    index = math.round((array.size(arr_sorted) - 1) * quantile)
    array.get(arr_sorted, index)

// === Calculations ===

// Bollinger Bands Calculation
sma        = ta.sma(close, length)
stdev      = ta.stdev(close, length)
boll_upper = sma + boll_mult * stdev
boll_lower = sma - boll_mult * stdev

// Power-Law Bands Calculation
var float power_upper = na
var float power_lower = na
if array.size(return_array) == length
    power_upper := f_percentile(return_array, upper_quantile)
    power_lower := f_percentile(return_array, lower_quantile)
var float power_upper_band = na
var float power_lower_band = na
if not na(power_upper) and not na(power_lower)
    power_upper_band := close * (1 + power_upper)
    power_lower_band := close * (1 + power_lower)

// Quantile Bands Calculation
var float quant_upper = na
var float quant_lower = na
if array.size(data_array) == length
    quant_upper := f_percentile(data_array, upper_quantile)
    quant_lower := f_percentile(data_array, lower_quantile)

// Standard Deviation around Quantile Bands
quant_upper_std_up   = quant_upper + stdev
quant_upper_std_down = quant_upper - stdev
quant_lower_std_up   = quant_lower + stdev
quant_lower_std_down = quant_lower - stdev

// === Color Calculations ===

// For the upper Bollinger band, color it yellow when price is above it, black otherwise.
upper_boll_color = close > boll_upper ? color.yellow : color.black

// The entry/exit trigger is based on the lower std dev band of the upper quantile band.
// It "turns green" (i.e. favorable for entry) when the price is above this level,
// and "turns red" (i.e. unfavorable, triggering an exit) when price is below it.
triggerCondition = close > quant_upper_std_down

// For plotting purposes, define the color of the lower std dev band of the upper quantile band:
triggerColor = triggerCondition ? color.green : color.red

// (Other color definitions remain for the additional bands.)
upper_power_color = (not na(power_upper_band) and not na(quant_upper_std_up) and power_upper_band > quant_upper_std_up) ? color.new(#FF00FF, 0) : color.black
upper_quant_color = (not na(quant_upper) and not na(power_upper_band) and power_upper_band > quant_upper) ? color.new(#FFAE00, 0) : color.rgb(50, 50, 50)
upper_quant_std_down_color = (not na(quant_upper_std_down) and close > quant_upper_std_down) ? color.green : color.red
lower_quant_std_down_color = (not na(quant_lower_std_down) and close > quant_lower_std_down) ? color.rgb(24, 113, 0, 44) : color.red
lower_quant_color = (ta.cross(close, quant_lower) or close == quant_lower) ? color.red : color.rgb(0, 238, 255)

// For demonstration, a variable to toggle a color on the Bollinger crossover.
var color upper_quant_std_up_color = color.black
if ta.crossover(close, boll_upper)
    upper_quant_std_up_color := color.yellow
if ta.crossunder(close, boll_upper)
    upper_quant_std_up_color := color.black

// === Confirmation Bars Logic with Separate Counters Based on Trigger Condition ===

// Use the trigger condition (based on the lower std dev band of the upper quantile band)
// for entry/exit confirmation.
var int entryCounter = 0
var int exitCounter  = 0

// When triggerCondition is true (price above quant_upper_std_down) the "green" state holds.
entryCounter := triggerCondition ? entryCounter + 1 : 0
// When triggerCondition is false (price below quant_upper_std_down) the "red" state holds.
exitCounter  := not triggerCondition ? exitCounter + 1 : 0

// === Strategy Orders ===

// Enter long when triggerCondition has been true for at least entry_confirmBars bars and no position is active.
if (entryCounter >= entry_confirmBars) and (strategy.position_size <= 0)
    strategy.entry("Long", strategy.long)

// Exit long when triggerCondition has been false for at least exit_confirmBars bars and a long position is active.
if (exitCounter >= exit_confirmBars) and (strategy.position_size > 0)
    strategy.close("Long")

// === Plotting ===

// Plot Bollinger Bands
plot(show_upper_boll ? boll_upper : na, color=upper_boll_color, title="Bollinger Upper", linewidth=2)
plot(show_lower_boll ? boll_lower : na, color=color.red, title="Bollinger Lower", linewidth=1)

// Plot Power-Law Bands
plot(show_upper_power ? power_upper_band : na, color=upper_power_color, title="Power-Law Upper", linewidth=1)
plot(show_lower_power ? power_lower_band : na, color=color.rgb(255, 59, 248), title="Power-Law Lower", linewidth=1)

// Plot Quantile Bands
plot(show_upper_quant ? quant_upper : na, color=upper_quant_color, title="Quantile Upper", linewidth=1)
plot(show_lower_quant ? quant_lower : na, color=lower_quant_color, title="Quantile Lower", linewidth=1)

// Plot Standard Deviation around Quantile Bands
plot(show_quant_std and show_upper_quant and show_upper_quant_std_up ? quant_upper_std_up : na, color=upper_quant_std_up_color, title="Quantile Upper + Std Dev", linewidth=2)
plot(show_quant_std and show_upper_quant and show_upper_quant_std_down ? quant_upper_std_down : na, color=upper_quant_std_down_color, title="Quantile Upper - Std Dev", linewidth=2)
plot(show_quant_std and show_lower_quant and show_lower_quant_std_up ? quant_lower_std_up : na, color=color.green, title="Quantile Lower + Std Dev", linewidth=1)
plot(show_quant_std and show_lower_quant and show_lower_quant_std_down ? quant_lower_std_down : na, color=lower_quant_std_down_color, title="Quantile Lower - Std Dev", linewidth=1)

// Also plot the trigger line (lower std dev band of upper quantile band) with its own color
plot(show_quant_std ? quant_upper_std_down : na, color=triggerColor, title="Trigger (Lower Std Dev of Upper Quantile)", linewidth=2)

// Plot SMA for reference
plot(show_sma ? sma : na, color=color.rgb(0, 24, 132), title="SMA", linewidth=3)

// Plot EMA for reference
ema_value = ta.ema(ema_source, ema_length)
plot(show_ema ? ema_value : na, color=color.rgb(147, 0, 0), title="EMA", linewidth=2)