कई संकेतकों के एकीकरण पर आधारित रणनीति का अनुसरण करने की प्रवृत्ति

लेखक:चाओझांग, दिनांकः 2023-09-13 17:16:51
टैगः

इस रणनीति का नाम Trend Following Strategy Based on Multiple Indicator Integration है। यह RSI, ADX और MACD संकेतकों को जोड़ती है ताकि अपट्रेंड की पुष्टि के बाद लंबे समय तक चल सकें, और डाउनट्रेंड की पुष्टि के बाद पदों को बंद कर सकें।

आरएसआई संकेतक ओवरबॉट/ओवरसोल्ड स्थिति निर्धारित करता है। आरएसआई 30 से ऊपर का क्रॉसिंग लंबी प्रविष्टि को ध्यान में रखते हुए ओवरसोल्ड के अंत का प्रतिनिधित्व करता है। आरएसआई 70 फ्लैग से नीचे का क्रॉसिंग ओवरबोल्ड के अंत को ध्यान में रखते हुए बंद स्थिति का प्रतिनिधित्व करता है।

ADX सूचक प्रवृत्ति की ताकत को मापता है। ADX 25 से ऊपर पार करने का अर्थ है एक प्रवृत्ति में प्रवेश करना, जबकि 25 से नीचे पार करने का अर्थ है प्रवृत्ति का अंत।

एमएसीडी अल्पकालिक प्रवृत्ति का आकलन करता है। डीआईएफएफ पार करना डीईए से ऊपर लंबी प्रविष्टि को ध्यान में रखते हुए अल्पकालिक अपट्रेंड का प्रतिनिधित्व करता है। ध्वज के नीचे पार करना बंद होने वाली स्थिति को ध्यान में रखते हुए अल्पकालिक डाउनट्रेंड का प्रतिनिधित्व करता है।

जब आरएसआई, एडीएक्स और एमएसीडी सभी तेजी के संकेत दिखाते हैं, तो लंबी ट्रेडें ली जाती हैं। जब सभी ट्रेंड समाप्त होने का संकेत देते हैं, तो पद बंद हो जाते हैं।

लाभ पुष्टि के लिए कई संकेतकों का उपयोग कर प्रभावी ढंग से झूठे संकेतों को रोक सकता है। लेकिन मापदंडों को व्यक्तिगत अनुकूलन की आवश्यकता होती है, और स्टॉप लॉस अपरिहार्य है।

संक्षेप में, संकेतक एकीकरण निर्णय की प्रभावशीलता में सुधार करता है, लेकिन व्यापारियों को अभी भी वास्तविक परिस्थितियों के आधार पर रणनीति मापदंडों को समायोजित करने और मान्य करने के लिए विवेक की आवश्यकता होती है।


/*backtest
start: 2023-09-05 00:00:00
end: 2023-09-08 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// RSI
//@version=3
// strategy("Femi Strategy", overlay=true)
strategy("Femi Strategy", overlay=false)
RSIlength = input( 14 )
overSold = input( 30 )
overBought = input( 70 )
price = close

vrsi = rsi(price, RSIlength)



//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)





// ADX

//@version=3
adxlen = input(14)
dilen = input(14)
adxThreshold = input( 25 )
dirmov(len) =>
	up = change(high)
	down = -change(low)
	plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
    minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
	truerange = rma(tr, len)
	plus = fixnan(100 * rma(plusDM, len) / truerange)
	minus = fixnan(100 * rma(minusDM, len) / truerange)
	[plus, minus]

adx(dilen, adxlen) =>
	[plus, minus] = dirmov(dilen)
	sum = plus + minus
	adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)

sig = adx(dilen, adxlen)


// MACD
//@version=3
MACDZero = input(0)
fastLength = input(12)
slowlength = input(26)
MACDLength = input(9)

MACD = ema(close, fastLength) - ema(close, slowlength)
aMACD = ema(MACD, MACDLength)
delta = MACD - aMACD



source = close
length = input(20, minval=1)
mult = input(2.0, minval=0.001, maxval=50)

basis = sma(source, length)
dev = mult * stdev(source, length)

upper = basis + dev
lower = basis - dev

if (not na(vrsi))
    if (crossover(delta, MACDZero))
        strategy.entry("FEMIMACDLE", strategy.long, comment="FEMIMACDLE")
    else
        strategy.cancel(id="FEMIMACDLE")
        
    
    if (crossunder(vrsi, overSold))
        strategy.entry("FEMIRSILE", strategy.long, comment="FEMIRSILE")
    else
        strategy.cancel(id="FEMIRSILE")
        
        
    // if(crossover(sig, adxThreshold)) // crossover(sig, adxThreshold) crossover(delta, MACDZero) crossunder(vrsi, overSold)
    //     strategy.entry("FEMIADXLE", strategy.long, comment="FEMIADXLE")
    // else
    //     strategy.cancel(id="FEMIADXLE")
        
        
    // if (crossover(source, lower))
    //     strategy.entry("FEMIBBLE", strategy.long, comment="FEMIBBLE")
    // else
    //     strategy.cancel(id="FEMIBBLE")
        
    // if(crossunder(sig, adxThreshold))
        // strategy.cancel(id="FEMILE")
        // strategy.exit(id="FEMILE")
        
    // if (crossunder(delta, MACDZero))
        // strategy.entry("FEMIMACDSE", strategy.short, comment="FEMIMACDSE")
    if (crossover(vrsi, overBought))
        // strategy.entry("FEMIRSISE", strategy.short, comment="FEMIRSISE")
        strategy.close("FEMIRSILE")
        strategy.close("FEMIMACDLE")
        strategy.close("FEMIADXLE")
        strategy.close("FEMIBBLE")
    
    if (crossunder(sig, adxThreshold) and crossunder(delta, MACDZero) and crossunder(source, upper)) // crossover(delta, MACDZero) crossover(vrsi, overSold) crossover(sig, adxThreshold)
        strategy.close("FEMIRSILE")
        strategy.close("FEMIMACDLE")
        strategy.close("FEMIADXLE")
        strategy.close("FEMIBBLE")
        
    // if(crossunder(source, upper))
    //     strategy.close("FEMIRSILE")
    //     strategy.close("FEMIMACDLE")
    //     strategy.close("FEMIADXLE")
    //     strategy.close("FEMIBBLE")
        // strategy.entry("FEMIADXSE", strategy.short, comment="FEMIADXSE")
    // else
    //     strategy.cancel(id="FEMISE")

// plot(sig, color=red, title="ADX", linewidth=2, style=areabr)
// plot(adxThreshold, color=blue, title="ADX")


// plot(vrsi, color=green, title="RSI", linewidth=2, style=areabr)
// plot(overSold, color=blue, title="RSI")
// plot(overBought, color=red, title="RSI")

// plot(delta, color=green, title="MACD", linewidth=2, style=areabr)
// plot(MACDZero, color=blue, title="MACD")
// plot(overBought, color=red, title="MACD")
//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)

अधिक