दोहरी ईएमए क्रॉसओवर ट्रेंड ट्रैकिंग रणनीति

लेखक:चाओझांग, दिनांकः 2024-02-29 11:45:42
टैगः

img

अवलोकन

रणनीति तर्क

इस रणनीति के मुख्य संकेतक ईएमए के दो सेट हैं, जिसमें एक लंबे चक्र ईएमए1 और एक छोटे चक्र ईएमए2 शामिल हैं। ईएमए1 पैरामीटर 21 है और ईएमए2 पैरामीटर 10 है। रणनीति इन दो ईएमए की गणना 4 घंटे के चक्र के आधार पर करती है।

जब छोटा चक्र ईएमए2 लंबे चक्र ईएमए1 के ऊपर से पार करता है, तो एक खरीद संकेत उत्पन्न होता है। यह इंगित करता है कि कीमतों का अल्पकालिक प्रवृत्ति मजबूत हो गया है और एक उछाल प्रवृत्ति शुरू हो गई है। जब छोटा चक्र ईएमए2 लंबे चक्र ईएमए1 के नीचे से पार करता है, तो एक बिक्री संकेत उत्पन्न होता है। यह इंगित करता है कि कीमतों का अल्पकालिक उछाल प्रवृत्ति बाधित हो गई है और एक गिरावट प्रवृत्ति शुरू हो गई है।

त्रुटिपूर्ण संकेतों को फ़िल्टर करने के लिए, रणनीति सोने के क्रॉस और मृत क्रॉस संकेतकों के दो सेट सेट करती है। संकेत तभी ट्रिगर होते हैं जब दोनों संकेतकों का सेट एक ही संकेत देता है, जो प्रभावी रूप से मूल्य उतार-चढ़ाव के कारण त्रुटियों को कम कर सकता है।

लाभ विश्लेषण

  • दोहरी ईएमए संरचना प्रभावी रूप से रुझानों को निर्धारित करने के लिए अल्पकालिक और मध्यमकालिक रुझानों में परिवर्तन को पकड़ सकती है।

  • स्वर्ण क्रॉस और मृत क्रॉस संकेतकों के दो सेटों का अतिरिक्त फ़िल्टरिंग गलत संकेतों को कम कर सकता है और मूल्य उतार-चढ़ाव के कारण अनावश्यक लेनदेन से बचा जा सकता है।

  • रणनीति संरचना सरल और स्पष्ट है, समझने और लागू करने में आसान है, और मात्रात्मक व्यापार अनुप्रयोगों के लिए उपयुक्त है।

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

  • समेकन बाजारों का आकलन करने में दोहरी ईएमए संरचना कम प्रभावी होती है। समेकन की लंबी अवधि से झूठे संकेत उत्पन्न हो सकते हैं।

  • 4 घंटे के स्तर के संकेतक अचानक घटनाओं का जवाब देने के लिए पर्याप्त संवेदनशील नहीं हैं। प्रमुख अचानक समाचार 4 घंटे के भीतर बड़े कदमों का कारण बन सकते हैं जिन्हें प्रभावी रूप से जोखिम-नियंत्रित नहीं किया जा सकता है।

इन जोखिमों को नियंत्रित किया जा सकता हैः

  1. मॉडल संयोजनों को स्थापित करने के लिए अधिक समय चक्र ईएमए संकेतक जोड़ें।

  2. गतिशील रूप से मापदंडों को समायोजित करने के लिए आर्थिक माहौल, नीतियों और कंपनी के मूलभूत परिवर्तनों को जोड़ना।

अनुकूलन

इस रणनीति को और अधिक अनुकूलित किया जा सकता हैः

  1. मॉडल संयोजन जोड़ें। रणनीति स्थिरता में सुधार के लिए विभिन्न मापदंडों के साथ अधिक संकेतक संयोजन स्थापित किए जा सकते हैं।

  2. स्टॉप-लॉस तंत्र जोड़ें। उचित स्टॉप-लॉस बिंदु एकल नुकसान को प्रभावी ढंग से नियंत्रित कर सकते हैं।

  3. मशीन लर्निंग तकनीकों को शामिल करें। टेन्सॉर्फ्लो जैसे मॉडलों को वास्तविक समय में मूल्य रुझानों को वर्गीकृत करने के लिए प्रशिक्षित किया जा सकता है।

निष्कर्ष


/*backtest
start: 2023-02-22 00:00:00
end: 2024-02-28 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3


/// Component Code Startt
testStartYear = input(2017, "Backtest Start Year")
testStartMonth = input(01, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)

testStopYear = input(2020, "Backtest Stop Year")
testStopMonth = input(1, "Backtest Stop Month")
testStopDay = input(1, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)

// A switch to control background coloring of the test period
testPeriodBackground = input(title="Color Background?", type=bool, defval=false)
testPeriodBackgroundColor = testPeriodBackground and (time >= testPeriodStart) and (time <= testPeriodStop) ? #00FF00 : na
bgcolor(testPeriodBackgroundColor, transp=97)

testPeriod() => true
// Component Code Stop

strategy(title="Ema cross strat", overlay=true)
margin = input(true, title="Margin?")
Margin = margin  ? margin : false
resCustom = input(title="EMA Timeframe", defval="240" )
source = close,
len2 = input(21, minval=1, title="EMA1")
len3 = input(10, minval=1, title="EMA2")
ema2 = request.security(syminfo.tickerid,resCustom,ema(source,len2), lookahead=barmerge.lookahead_off)
ema3 = request.security(syminfo.tickerid,resCustom,ema(source,len3), lookahead=barmerge.lookahead_off)


mylong = crossover(ema3, ema2)
myshort = crossunder(ema3,ema2)

last_long = na
last_short = na
last_long := mylong ? time : nz(last_long[1])
last_short := myshort ? time : nz(last_short[1])

in_long = last_long > last_short ? 2 : 0
in_short = last_short > last_long ? 2 : 0

mylong2 = crossover(ema3, ema2)
myshort2 = crossunder(ema3, ema2)

last_long2 = na
last_short2 = na
last_long2 := mylong2 ? time : nz(last_long2[1])
last_short2 := myshort2 ? time : nz(last_short2[1])

in_long2 = last_long2 > last_short2 ? 0 : 0
in_short2 = last_short2 > last_long2 ? 0 : 0

condlongx =   in_long + in_long2
condlong = crossover(condlongx, 1.9)
condlongclose = crossunder(condlongx, 1.9)

condshortx =  in_short + in_short2
condshort = crossover(condshortx, 1.9)
condshortclose = crossover(condshortx, 1.9)




if crossover(condlongx, 1.9) and testPeriod() and strategy.position_size <= 0
    strategy.entry("Long", strategy.long, comment="Long")

if crossover(condshortx, 1.9) and testPeriod() and strategy.position_size > 0    
    strategy.close("Long",when = not Margin)
    
if crossover(condshortx, 1.9) and testPeriod() and strategy.position_size >= 0
    strategy.entry("Short", strategy.short, comment="Short", when = Margin)

अधिक