প্রিমিয়াম ডাবল ট্রেন্ড ফিল্টার এমএ অনুপাত কৌশল

লেখক:চাওঝাং, তারিখ: ২০২৩-১২-২৮ ১৭ঃ৩৭ঃ১৪
ট্যাগঃ

img

সারসংক্ষেপ

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

কৌশলগত যুক্তি

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

সুবিধা

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

ঝুঁকি এবং সমাধান

  1. ব্যাপ্তি বাজারের সময় আরো মিথ্যা সংকেত এবং অস্পষ্ট প্রবণতা সঙ্গে বিপরীতমুখী। সমাধান সংকীর্ণ সংকেত জন্য বিবি প্রস্থ ফিল্টার সঙ্গে একত্রিত করা হয়।
  2. এমএ-র বিলম্বিত প্রভাব রয়েছে, তাৎক্ষণিকভাবে প্রবণতা বিপরীত সনাক্ত করতে ব্যর্থ। সমাধানটি এমএ পরামিতিগুলি সঠিকভাবে সংক্ষিপ্ত করা।
  3. স্টপ লস তাৎক্ষণিকভাবে মূল্য ফাঁক দিয়ে আঘাত করতে পারে, যার ফলে বড় ক্ষতি হতে পারে। সমাধানটি হ'ল স্টপ লস প্যারামিটারটি অবাধে সেট করা।

অপ্টিমাইজেশান নির্দেশাবলী

  1. সর্বোত্তম সমন্বয় খুঁজে বের করার জন্য ব্যাপক পরীক্ষার মাধ্যমে এমএ সময়কাল, দোলকের থ্রেশহোল্ড, বিবি পরামিতিগুলির উপর পরামিতি অপ্টিমাইজেশন।
  2. সঠিকতা বাড়াতে KD, MACD এর মতো প্রবণতা বিপরীতের বিচারকারী অন্যান্য সূচক অন্তর্ভুক্ত করুন।
  3. গতিশীল পরামিতি অপ্টিমাইজেশান জন্য ঐতিহাসিক তথ্য সঙ্গে মেশিন লার্নিং মডেল প্রশিক্ষণ।

সংক্ষিপ্তসার

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


/*backtest
start: 2023-12-20 00:00:00
end: 2023-12-27 00:00:00
period: 3m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("Premium MA Ratio Strategy", overlay = true)

// Input: Adjustable parameters for Premium MA Ratio
fast_length = input(10, title = "Fast MA Length")
slow_length = input(50, title = "Slow MA Length")
oscillator_threshold_buy = input(10, title = "Oscillator Buy Threshold")
oscillator_threshold_sell = input(90, title = "Oscillator Sell Threshold")

// Input: Adjustable parameters for Bollinger Bands
bb_length = input(20, title = "Bollinger Bands Length")
bb_source = input(close, title = "Bollinger Bands Source")
bb_deviation = input(2.0, title = "Bollinger Bands Deviation")
bb_width_threshold = input(30, title = "BB Width Threshold")
use_bb_filter = input(true, title = "Use BB Width Filter?")

// Input: Adjustable parameters for Trend Filter
use_trend_filter = input(true, title = "Use Trend Filter?")
trend_filter_period_1 = input(50, title = "Trend Filter Period 1")
trend_filter_period_2 = input(200, title = "Trend Filter Period 2")
use_second_trend_filter = input(true, title = "Use Second Trend Filter?")

// Input: Adjustable parameters for Exit Strategies
use_exit_strategies = input(true, title = "Use Exit Strategies?")
use_take_profit = input(true, title = "Use Take Profit?")
take_profit_ticks = input(150, title = "Take Profit in Ticks")
use_stop_loss = input(true, title = "Use Stop Loss?")
stop_loss_ticks = input(100, title = "Stop Loss in Ticks")
use_combined_exit = input(true, title = "Use Combined Exit Strategy?")
combined_exit_ticks = input(50, title = "Combined Exit Ticks")

// Input: Adjustable parameters for Time Filter
use_time_filter = input(false, title = "Use Time Filter?")
start_hour = input(8, title = "Start Hour")
end_hour = input(16, title = "End Hour")

// Calculate moving averages
fast_ma = sma(close, fast_length)
slow_ma = sma(close, slow_length)

// Calculate the premium price moving average ratio
premium_ratio = fast_ma / slow_ma * 100

// Calculate the percentile rank of the premium ratio
percentile_rank(src, length) =>
    rank = 0.0
    for i = 1 to length
        if src > src[i]
            rank := rank + 1.0
    percentile = rank / length * 100

// Calculate the percentile rank for the premium ratio using slow_length periods
premium_ratio_percentile = percentile_rank(premium_ratio, slow_length)

// Calculate the oscillator based on the percentile rank
oscillator = premium_ratio_percentile

// Dynamic coloring for the oscillator line
oscillator_color = oscillator > 50 ? color.green : color.red

// Plot the oscillator on a separate subplot as a line
hline(50, "Midline", color = color.gray)
plot(oscillator, title = "Oscillator", color = oscillator_color, linewidth = 2)

// Highlight the overbought and oversold areas
bgcolor(oscillator > oscillator_threshold_sell ? color.red : na, transp = 80)
bgcolor(oscillator < oscillator_threshold_buy ? color.green : na, transp = 80)

// Plot horizontal lines for threshold levels
hline(oscillator_threshold_buy, "Buy Threshold", color = color.green)
hline(oscillator_threshold_sell, "Sell Threshold", color = color.red)

// Calculate Bollinger Bands width
bb_upper = sma(bb_source, bb_length) + bb_deviation * stdev(bb_source, bb_length)
bb_lower = sma(bb_source, bb_length) - bb_deviation * stdev(bb_source, bb_length)
bb_width = bb_upper - bb_lower

// Calculate the percentile rank of Bollinger Bands width
bb_width_percentile = percentile_rank(bb_width, bb_length)

// Plot the Bollinger Bands width percentile line
plot(bb_width_percentile, title = "BB Width Percentile", color = color.blue, linewidth = 2)

// Calculate the trend filters
trend_filter_1 = sma(close, trend_filter_period_1)
trend_filter_2 = sma(close, trend_filter_period_2)

// Strategy logic
longCondition = crossover(premium_ratio_percentile, oscillator_threshold_buy)
shortCondition = crossunder(premium_ratio_percentile, oscillator_threshold_sell)

// Apply Bollinger Bands width filter if enabled
if (use_bb_filter)
    longCondition := longCondition and bb_width_percentile < bb_width_threshold
    shortCondition := shortCondition and bb_width_percentile < bb_width_threshold

// Apply trend filters if enabled
if (use_trend_filter)
    longCondition := longCondition and (close > trend_filter_1)
    shortCondition := shortCondition and (close < trend_filter_1)

// Apply second trend filter if enabled
if (use_trend_filter and use_second_trend_filter)
    longCondition := longCondition and (close > trend_filter_2)
    shortCondition := shortCondition and (close < trend_filter_2)

// Apply time filter if enabled
if (use_time_filter)
    longCondition := longCondition and (hour >= start_hour and hour <= end_hour)
    shortCondition := shortCondition and (hour >= start_hour and hour <= end_hour)

// Generate trading signals with exit strategies
if (use_exit_strategies)
    strategy.entry("Buy", strategy.long, when = longCondition)
    strategy.entry("Sell", strategy.short, when = shortCondition)
    
    // Define unique exit names for each order
    buy_take_profit_exit = "Buy Take Profit"
    buy_stop_loss_exit = "Buy Stop Loss"
    sell_take_profit_exit = "Sell Take Profit"
    sell_stop_loss_exit = "Sell Stop Loss"
    combined_exit = "Combined Exit"
    
    // Exit conditions for take profit
    if (use_take_profit)
        strategy.exit(buy_take_profit_exit, from_entry = "Buy", profit = take_profit_ticks)
        strategy.exit(sell_take_profit_exit, from_entry = "Sell", profit = take_profit_ticks)
    
    // Exit conditions for stop loss
    if (use_stop_loss)
        strategy.exit(buy_stop_loss_exit, from_entry = "Buy", loss = stop_loss_ticks)
        strategy.exit(sell_stop_loss_exit, from_entry = "Sell", loss = stop_loss_ticks)
    
    // Combined exit strategy
    if (use_combined_exit)
        strategy.exit(combined_exit, from_entry = "Buy", loss = combined_exit_ticks, profit = combined_exit_ticks)



আরো