ईएमए और एमएसीडी आधारित बीटीसी व्यापार रणनीति

लेखक:चाओझांग, दिनांकः 2024-01-25 12:54:16
टैगः

img

अवलोकन

यह रणनीति अल्पकालिक बीटीसी ट्रेडिंग के लिए ईएमए अंतर और एमएसीडी संकेतक पर आधारित एक समग्र रणनीति है। यह कुछ शर्तों के तहत खरीद और बिक्री संकेत उत्पन्न करने के लिए ईएमए और एमएसीडी के संकेतों को जोड़ती है।

रणनीति तर्क

यह खरीद संकेत उत्पन्न करता है जब अंतर नकारात्मक होता है और एक सीमा से नीचे होता है और एमएसीडी में एक मंदी क्रॉसओवर होता है। यह बेच संकेत उत्पन्न करता है जब अंतर सकारात्मक होता है और एक सीमा से ऊपर होता है और एमएसीडी में एक तेजी क्रॉसओवर होता है।

ईएमए अंतर और एमएसीडी दोनों के संकेतों को मिलाकर, कुछ नकली संकेतों को फ़िल्टर किया जा सकता है और संकेतों की विश्वसनीयता में सुधार किया जा सकता है।

लाभ विश्लेषण

  1. मिश्रित संकेतकों का उपयोग करता है, अधिक विश्वसनीय संकेत
  2. अल्पकालिक व्यापार के लिए उपयुक्त अल्पकालिक मापदंडों को अपनाता है
  3. जोखिमों को नियंत्रित करने के लिए स्टॉप लॉस और ले लाभ सेटिंग्स है

जोखिम विश्लेषण

  1. मापदंडों को विभिन्न बाजार वातावरण के लिए अनुकूलित करने की आवश्यकता है
  2. विभिन्न सिक्कों और एक्सचेंजों पर प्रभावों का परीक्षण किया जाना चाहिए

अनुकूलन दिशाएँ

  1. बीटीसी अस्थिरता के अनुरूप ईएमए और एमएसीडी मापदंडों को अनुकूलित करें
  2. पूंजी दक्षता में सुधार के लिए स्थिति आकार और पिरामिड रणनीतियों को जोड़ें
  3. जोखिमों को कम करने के लिए स्टॉप लॉस के तरीकों को जोड़ें
  4. विभिन्न एक्सचेंजों और सिक्कों पर परीक्षण प्रभाव

निष्कर्ष


/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-24 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
strategy("EMA50Diff & MACD Strategy", overlay=false)
EMA = input(18, step=1)
MACDfast = input(12)
MACDslow = input(26)
EMADiffThreshold = input(8)
MACDThreshold = input(80)
TargetValidityThreshold = input(65, step=5)
Target = input(120, step=5)
StopLoss = input(650, step=5) 
ema = ema(close, EMA)
hl = plot(0, color=white, linewidth=1)
diff = close - ema
clr = color(blue, transp=100)
if diff>0
    clr := lime
else 
    if diff<0
        clr := red

fastMA = ema(close, MACDfast)
slowMA = ema(close, MACDslow)
macd = (fastMA - slowMA)*3
signal = sma(macd, 9)
plot(macd, color=aqua, linewidth=2)
plot(signal, color=purple, linewidth=2)

macdlong = macd<-MACDThreshold and signal<-MACDThreshold and crossover(macd, signal)
macdshort = macd>MACDThreshold and signal>MACDThreshold and crossunder(macd, signal)
position = 0.0
position := nz(strategy.position_size, 0.0)
long = (position < 0 and close < strategy.position_avg_price - TargetValidityThreshold and macdlong) or 
     (position == 0.0 and diff < -EMADiffThreshold and diff > diff[1] and diff[1] < diff[2] and macdlong)

short = (position > 0 and close > strategy.position_avg_price + TargetValidityThreshold and macdshort) or 
      (position == 0.0 and diff > EMADiffThreshold and diff < diff[1] and diff[1] > diff[2] and macdshort)
amount = (strategy.equity / close) //- ((strategy.equity / close / 10)%10)
bgclr = color(blue, transp=100) //#0c0c0c
if long
    strategy.entry("long", strategy.long, amount)
    bgclr := green
if short
    strategy.entry("short", strategy.short, amount)
    bgclr := maroon
bgcolor(bgclr, transp=20)
strategy.close("long", when=close>strategy.position_avg_price + Target)
strategy.close("short", when=close<strategy.position_avg_price - Target)
strategy.exit("STOPLOSS", "long", stop=strategy.position_avg_price - StopLoss)
strategy.exit("STOPLOSS", "short", stop=strategy.position_avg_price + StopLoss)
//plotshape(long, style=shape.labelup, location=location.bottom, color=green)
//plotshape(short, style=shape.labeldown, location=location.top, color=red)
pl = plot(diff, style=histogram, color=clr)
fill(hl, pl, color=clr)


अधिक