दोहरी प्रवृत्ति फ़िल्टर्ड चेन मूविंग औसत अनुपात रणनीति


निर्माण तिथि: 2023-12-28 17:37:14 अंत में संशोधित करें: 2023-12-28 17:37:14
कॉपी: 1 क्लिक्स: 623
1
ध्यान केंद्रित करना
1623
समर्थक

दोहरी प्रवृत्ति फ़िल्टर्ड चेन मूविंग औसत अनुपात रणनीति

अवलोकन

यह रणनीति एक ट्रेंड फॉलोइंग रणनीति है जो एक श्रृंखलाबद्ध बाहर निकलने की प्रणाली का उपयोग करते हुए, एक दोहरे चलती औसत अनुपात सूचक पर आधारित है, जो एक बुलिन-फिल्टर और दोहरे प्रवृत्ति फ़िल्टर सूचक के साथ संयुक्त है। इसका उद्देश्य मध्य-लंबी रेखा प्रवृत्ति की दिशा की पहचान करने के लिए एक चलती औसत अनुपात सूचक का उपयोग करना है, जब प्रवृत्ति की दिशा स्पष्ट हो, तो प्रवेश के लिए सबसे अच्छा स्थान चुनें, और लाभ को लॉक करने के लिए एक स्टॉपबॉक्स, स्टॉपलॉस और बाहर निकलने की प्रणाली सेट करें, और नुकसान को कम करें।

रणनीति सिद्धांत

  1. तेजी से चलती औसत ((१० दिन की रेखा) और धीमी गति से चलती औसत ((५० दिन की रेखा) की गणना करें और उनके अनुपात की गणना करें, जिसे मूल्य चलती औसत अनुपात कहा जाता है। यह अनुपात कीमतों में लंबे समय तक चलने वाली प्रवृत्तियों के परिवर्तन को प्रभावी ढंग से पहचान सकता है।
  2. मूल्य की चलती औसत अनुपात को प्रतिशत में परिवर्तित करें, जो पिछले समय में वर्तमान अनुपात की अपेक्षाकृत मजबूत है। प्रतिशत को एक ऑसिलेटर के रूप में परिभाषित किया गया है।
  3. जब ऑस्सिलेटर पर सेट खरीदारी थ्रेशोल्ड ((10) के माध्यम से एक खरीदारी संकेत उत्पन्न होता है, तो नीचे की ओर एक बिक्री थ्रेशोल्ड ((90) के माध्यम से एक बिक्री संकेत उत्पन्न होता है, और प्रवृत्ति का पालन किया जाता है।
  4. ब्रिन बैंडविड्थ सूचक के साथ ट्रेडिंग सिग्नल को फ़िल्टर करने के लिए, ब्रिन बैंड संकीर्ण होने पर ऑपरेशन करें।
  5. दोहरी प्रवृत्ति फ़िल्टरिंग सूचक का उपयोग करके, केवल एक खरीद संकेत उत्पन्न होता है जब कीमत एक उछाल प्रवृत्ति चैनल में होती है, और केवल एक बिक्री संकेत उत्पन्न होता है जब कीमत एक गिरावट चैनल में होती है, जिससे उलट संचालन से बचा जाता है।
  6. एक श्रृंखलाबद्ध निकासी तंत्र सेट करें, जिसमें स्टॉप, स्टॉप लॉस और पोर्टफोलियो निकासी शामिल है, जिसमें कई निकासी स्थितियां हैं, जिन्हें सबसे अधिक लाभदायक निकासी के लिए प्राथमिकता दी जाती है।

रणनीतिक लाभ

  1. दोहरी प्रवृत्ति फ़िल्टरिंग तंत्र, मुख्य प्रवृत्ति की दिशा का विश्वसनीय रूप से आकलन करने के लिए, विपरीत संचालन से बचने के लिए
  2. एक एकल चलती औसत की तुलना में एक चलती औसत अनुपात सूचक ट्रेंड परिवर्तन का अधिक प्रभावी ढंग से आकलन करता है।
  3. ब्रिन बैंडविड्थ सूचक बाजार के कम उतार-चढ़ाव के समय में प्रभावी रूप से स्थित है, जब ट्रेडिंग सिग्नल अधिक विश्वसनीय होते हैं।
  4. चेन-आउट-ऑफ-द-ऑर्डर के माध्यम से मुनाफे को स्थिर किया जाता है, जिससे कुल मुनाफा अधिकतम हो जाता है।

जोखिम और समाधान

  1. जब कोई स्पष्ट प्रवृत्ति नहीं होती है, तो अधिक गलत सिग्नल और रिवर्स होते हैं। समाधान ब्रीनिंग बैंडविड्थ फ़िल्टरिंग के साथ संयोजन में है और संकीर्ण होने पर ऑपरेशन करना है।
  2. जब एक स्पष्ट प्रवृत्ति उलटा होता है, तो चलती औसत में विलंबता होती है, और उलटा सिग्नल को पहले समय में नहीं समझा जा सकता है। समाधान उचित रूप से चलती औसत चक्र पैरामीटर को छोटा करना है।
  3. जब एक हवाई कूद की कमी होती है, तो स्टॉप लॉस को एक पल में मारा जा सकता है, जिससे अधिक नुकसान होता है। समाधान उचित रूप से स्टॉप लॉस के पैरामीटर को ढीला करना है।

रणनीति अनुकूलन दिशा

  1. पैरामीटर अनुकूलन: आप चलती औसत अवधि, ऑसिलेटर खरीद और बिक्री बिंदुओं, ब्रिन बैंड पैरामीटर, और रुझान फ़िल्टर पैरामीटर के साथ कदम-दर-कदम परीक्षण कर सकते हैं।
  2. अन्य संकेतकों को शामिल करना। रणनीति की सटीकता में सुधार के लिए अन्य संकेतकों को शामिल करने पर विचार किया जा सकता है, जैसे कि केडी सूचकांक, एमएसीडी सूचकांक आदि।
  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)