एकाधिक चलती औसत प्रवृत्ति ट्रैकिंग और गतिशील अस्थिरता फ़िल्टरिंग रणनीति

EMA TR ATR
निर्माण तिथि: 2025-01-17 15:00:37 अंत में संशोधित करें: 2025-01-17 15:00:37
कॉपी: 3 क्लिक्स: 303
1
ध्यान केंद्रित करना
1617
समर्थक

एकाधिक चलती औसत प्रवृत्ति ट्रैकिंग और गतिशील अस्थिरता फ़िल्टरिंग रणनीति

अवलोकन

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

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

रणनीति के मूल तर्क में निम्नलिखित प्रमुख घटक शामिल हैं:

  1. प्रवृत्ति की पहचान: 50-अवधि ईएमए को प्रवृत्ति फिल्टर के रूप में उपयोग करें और केवल तभी लॉन्ग जाएं जब कीमत ईएमए से ऊपर हो और तभी शॉर्ट जाएं जब कीमत ईएमए से नीचे हो।
  2. अस्थिरता फ़िल्टरिंग: ट्रू रेंज (टीआर) के ईएमए की गणना करता है और बाजार शोर को फ़िल्टर करने के लिए एक समायोज्य फ़िल्टर कारक (डिफ़ॉल्ट 1.5) का उपयोग करता है।
  3. प्रवेश की शर्तें: तीन लगातार K-लाइनों के रूपात्मक विश्लेषण के साथ, मूल्य आंदोलन निरंतर और त्वरित होना चाहिए।
  4. लाभ लेना और हानि रोकना: अल्पावधि मोड में, इसे वर्तमान TR के आधार पर निर्धारित किया जाता है; बैंड मोड में, इसे गतिशील जोखिम प्रबंधन प्राप्त करने के लिए पिछले उच्च और निम्न बिंदुओं के आधार पर निर्धारित किया जाता है।

रणनीतिक लाभ

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

रणनीतिक जोखिम

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

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

  1. प्रवृत्ति शक्ति फ़िल्टरिंग जोड़ें: प्रवृत्ति शक्ति का मूल्यांकन करने और प्रवृत्ति ट्रैकिंग प्रभावों में सुधार करने के लिए ADX जैसे संकेतक पेश किए जा सकते हैं।
  2. लाभ-प्राप्ति और स्टॉप-लॉस को अनुकूलित करें: अधिक लाभ की रक्षा के लिए मूविंग स्टॉप-लॉस शुरू करने पर विचार करें।
  3. स्विंग ट्रेडिंग मॉडल में सुधार: मध्यम और दीर्घकालिक होल्डिंग क्षमताओं में सुधार के लिए अधिक स्विंग ट्रेडिंग-विशिष्ट निर्णय स्थितियों को जोड़ा जा सकता है।
  4. वॉल्यूम विश्लेषण जोड़ें: सफलता की वैधता की पुष्टि करने के लिए वॉल्यूम परिवर्तनों को संयोजित करें।

संक्षेप

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

रणनीति स्रोत कोड
/*backtest
start: 2024-12-17 00:00:00
end: 2025-01-15 08:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Creativ3mindz

//@version=5
strategy("Scalp Slayer (I)", overlay=true)

// Input Parameters
filterNumber = input.float(1.5, "Filter Number", minval=1.0, maxval=10.0, tooltip="Higher = More aggressive Filter, Lower = Less aggressive")
emaTrendPeriod = input.int(50, "EMA Trend Period", minval=1, tooltip="Period for the EMA used for trend filtering")
lookbackPeriod = input.int(20, "Lookback Period for Highs/Lows", minval=1, tooltip="Period for determining recent highs/lows")
colorTP = input.color(title='Take Profit Color', defval=color.orange)
colorSL = input.color(title='Stop Loss Color', defval=color.red)

// Inputs for visibility
showBuyLabels = input.bool(true, title="Show Buy Labels")
showSellLabels = input.bool(true, title="Show Sell Labels")

// Alert Options
alertOnCondition = input.bool(true, title="Alert on Condition Met", tooltip="Enable to alert when condition is met")

// Trade Mode Toggle
tradeMode = input.bool(false, title="Trade Mode (ON = Swing, OFF = Scalp)", tooltip="Swing-mode you can use your own TP/SL.")

// Calculations
tr = high - low
ema = filterNumber * ta.ema(tr, 50)
trendEma = ta.ema(close, emaTrendPeriod)  // Calculate the EMA for the trend filter

// Highest and lowest high/low within lookback period for swing logic
swingHigh = ta.highest(high, lookbackPeriod)
swingLow = ta.lowest(low, lookbackPeriod)

// Variables to track the entry prices and SL/TP levels
var float entryPriceLong = na
var float entryPriceShort = na
var float targetPriceLong = na
var float targetPriceShort = na
var float stopLossLong = na
var float stopLossShort = na
var bool tradeActive = false

// Buy and Sell Conditions with Trend Filter
buyCondition = close > trendEma and  // Buy only if above the trend EMA
      close[2] > open[2] and close[1] > open[1] and close > open and 
      (math.abs(close[2] - open[2]) > math.abs(close[1] - open[1])) and 
      (math.abs(close - open) > math.abs(close[1] - open[1])) and 
      close > close[1] and close[1] > close[2] and tr > ema

sellCondition = close < trendEma and  // Sell only if below the trend EMA
       close[2] < open[2] and close[1] < open[1] and close < open and 
       (math.abs(close[2] - open[2]) > math.abs(close[1] - open[1])) and 
       (math.abs(close - open) > math.abs(close[1] - open[1])) and 
       close < close[1] and close[1] < close[2] and tr > ema

// Entry Rules
if (buyCondition and not tradeActive)
    entryPriceLong := close  // Track entry price for long position
    stopLossLong := tradeMode ? ta.lowest(low, lookbackPeriod) : swingLow  // Scalping: recent low, Swing: lowest low of lookback period
    targetPriceLong := tradeMode ? close + tr : swingHigh  // Scalping: close + ATR, Swing: highest high of lookback period
    tradeActive := true

if (sellCondition and not tradeActive)
    entryPriceShort := close  // Track entry price for short position
    stopLossShort := tradeMode ? ta.highest(high, lookbackPeriod) : swingHigh  // Scalping: recent high, Swing: highest high of lookback period
    targetPriceShort := tradeMode ? close - tr : swingLow  // Scalping: close - ATR, Swing: lowest low of lookback period
    tradeActive := true

// Take Profit and Stop Loss Logic
signalBuyTPPrint = (not na(entryPriceLong) and close >= targetPriceLong)
signalSellTPPrint = (not na(entryPriceShort) and close <= targetPriceShort)

signalBuySLPrint = (not na(entryPriceLong) and close <= stopLossLong)
signalSellSLPrint = (not na(entryPriceShort) and close >= stopLossShort)

if (signalBuyTPPrint or signalBuySLPrint)
    entryPriceLong := na  // Reset entry price for long position
    targetPriceLong := na  // Reset target price for long position
    stopLossLong := na  // Reset stop-loss for long position
    tradeActive := false

if (signalSellTPPrint or signalSellSLPrint)
    entryPriceShort := na  // Reset entry price for short position
    targetPriceShort := na  // Reset target price for short position
    stopLossShort := na  // Reset stop-loss for short position
    tradeActive := false

// Plot Buy and Sell Labels with Visibility Conditions
plotshape(showBuyLabels and buyCondition, "Buy", shape.labelup, location=location.belowbar, color=color.green, text="BUY", textcolor=color.white, size=size.tiny)
plotshape(showSellLabels and sellCondition, "Sell", shape.labeldown, location=location.abovebar, color=color.red, text="SELL", textcolor=color.white, size=size.tiny)

// Plot Take Profit Flags
plotshape(showBuyLabels and signalBuyTPPrint, title="Take Profit (buys)", text="TP", style=shape.flag, location=location.abovebar, color=colorTP, textcolor=color.white, size=size.tiny)
plotshape(showSellLabels and signalSellTPPrint, title="Take Profit (sells)", text="TP", style=shape.flag, location=location.belowbar, color=colorTP, textcolor=color.white, size=size.tiny)

// Plot Stop Loss "X" Marker
plotshape(showBuyLabels and signalBuySLPrint, title="Stop Loss (buys)", text="X", style=shape.xcross, location=location.belowbar, color=colorSL, textcolor=color.white, size=size.tiny)
plotshape(showSellLabels and signalSellSLPrint, title="Stop Loss (sells)", text="X", style=shape.xcross, location=location.abovebar, color=colorSL, textcolor=color.white, size=size.tiny)

// Alerts

alertcondition(buyCondition and alertOnCondition, title="Buy Alert", message='{"content": "Buy {{ticker}} at {{close}}"}')
alertcondition(sellCondition and alertOnCondition, title="Sell Alert", message='{"content": "Sell {{ticker}} at {{close}}"}')
alertcondition(signalBuyTPPrint and alertOnCondition, title="Buy TP Alert", message='{"content": "Buy TP {{ticker}} at {{close}}"}')
alertcondition(signalSellTPPrint and alertOnCondition, title="Sell TP Alert", message='{"content": "Sell TP {{ticker}} at {{close}}"}')
alertcondition(signalBuySLPrint and alertOnCondition, title="Buy SL Alert", message='{"content": "Buy SL {{ticker}} at {{close}}"}')
alertcondition(signalSellSLPrint and alertOnCondition, title="Sell SL Alert", message='{"content": "Sell SL {{ticker}} at {{close}}"}')

if buyCondition
    strategy.entry("Enter Long", strategy.long)
else if sellCondition
    strategy.entry("Enter Short", strategy.short)