
यह रणनीति MACD की गतिशील परिवर्तनशील विशेषताओं पर आधारित है। रणनीति का मूल यह है कि MACD स्तंभों के परिवर्तनशील रुझानों को देखकर संभावित गोल्डफोर्क और डेडफोर्क का अनुमान लगाया जा सकता है, जिससे ट्रेडों को पहले से तैयार किया जा सके। यह रणनीति पारंपरिक MACD सूचक क्रॉस सिग्नल पर ध्यान केंद्रित करने के बजाय, स्तंभों के परिवर्तनशील विशेषताओं पर ध्यान केंद्रित करती है, जो क्रॉस सिग्नल के पूर्वनिर्धारित तरीके से बेहतर प्रवेश समय प्राप्त करती है।
रणनीति में एक सुधारित MACD सूचक प्रणाली का उपयोग किया गया है, जिसमें तेजी से चलती औसत ((EMA12) और धीमी गति से चलती औसत ((EMA26) के अंतर के साथ-साथ 2 चक्रों पर आधारित सिग्नल लाइन शामिल है। कोर ट्रेडिंग तर्क निम्नलिखित कुछ महत्वपूर्ण बिंदुओं पर आधारित हैः
इस रणनीति में MACD स्तंभों की गतिशील परिवर्तन विशेषताओं का अभिनव उपयोग किया गया है, जिससे पारंपरिक MACD ट्रेडिंग सिस्टम में सुधार और अनुकूलन किया जा सकता है। रणनीति की पूर्व-निर्णय प्रणाली पहले प्रवेश संकेत प्रदान करने में सक्षम है, जबकि सख्त ट्रेडिंग शर्तें और जोखिम नियंत्रण उपाय रणनीति की स्थिरता सुनिश्चित करते हैं। आगे के अनुकूलन और सुधार के माध्यम से, रणनीति को वास्तविक व्यापार में बेहतर प्रदर्शन करने की उम्मीद है।
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-25 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(title="Demo GPT - Moving Average Convergence Divergence", shorttitle="MACD", commission_type=strategy.commission.percent, commission_value=0.1, slippage=3, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Getting inputs
fast_length = input(title="Fast Length", defval=12)
slow_length = input(title="Slow Length", defval=26)
src = input(title="Source", defval=close)
signal_length = input.int(title="Signal Smoothing", minval=1, maxval=50, defval=2) // Set smoothing line to 2
sma_source = input.string(title="Oscillator MA Type", defval="EMA", options=["SMA", "EMA"])
sma_signal = input.string(title="Signal Line MA Type", defval="EMA", options=["SMA", "EMA"])
// Date inputs
start_date = input(title="Start Date", defval=timestamp("2018-01-01T00:00:00"))
end_date = input(title="End Date", defval=timestamp("2069-12-31T23:59:59"))
// Calculating
fast_ma = sma_source == "SMA" ? ta.sma(src, fast_length) : ta.ema(src, fast_length)
slow_ma = sma_source == "SMA" ? ta.sma(src, slow_length) : ta.ema(src, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)
hist = macd - signal
// Strategy logic
isInDateRange = true
// Calculate the rate of change of the histogram
hist_change = hist - hist[1]
// Anticipate a bullish crossover: histogram is negative, increasing, and approaching zero
anticipate_long = isInDateRange and hist < 0 and hist_change > 0 and hist > hist[1] and hist > hist[2]
// Anticipate an exit (bearish crossover): histogram is positive, decreasing, and approaching zero
anticipate_exit = isInDateRange and hist > 0 and hist_change < 0 and hist < hist[1] and hist < hist[2]
if anticipate_long
strategy.entry("Long", strategy.long)
if anticipate_exit
strategy.close("Long")
// Plotting
hline(0, "Zero Line", color=color.new(#787B86, 50))
plot(hist, title="Histogram", style=plot.style_columns, color=(hist >= 0 ? (hist > hist[1] ? #26A69A : #B2DFDB) : (hist < hist[1] ? #FF5252 : #FFCDD2)))
plot(macd, title="MACD", color=#2962FF)
plot(signal, title="Signal", color=#FF6D00)
// Plotting arrows when anticipating the crossover
plotshape(anticipate_long, title="Long +1", location=location.belowbar, color=color.green, style=shape.arrowup, size=size.tiny, text="Long +1")
plotshape(anticipate_exit, title="Short -1", location=location.abovebar, color=color.red, style=shape.arrowdown, size=size.tiny, text="Short -1")