एडीएक्स + आरएसआई रणनीति

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

अवलोकन

यह एक प्रवृत्ति-अनुसरण रणनीति है जो ADX और RSI संकेतकों को जोड़ती है। यह ट्रेडिंग सिग्नल उत्पन्न करने के लिए ओवरबॉट और ओवरसोल्ड स्तरों की पहचान करने के लिए RSI का उपयोग करती है, और जब प्रवृत्ति अस्पष्ट होती है तो ट्रेडों को फ़िल्टर करने के लिए प्रवृत्ति निर्धारित करने के लिए ADX, इस प्रकार रेंज-बाउंड बाजारों में whipsaws से बचने के लिए।

रणनीति तर्क

  1. ओवरबॉट और ओवरसोल्ड स्तरों की पहचान करने के लिए 7 अवधि के आरएसआई का प्रयोग करें
  • 30 से नीचे का आरएसआई ओवरसोल्ड माना जाता है।
  • 70 से ऊपर का आरएसआई ओवरबॉट माना जाता है।
  1. प्रवृत्ति निर्धारित करने के लिए ADX का प्रयोग करें
  • 30 से ऊपर का ADX एक मजबूत प्रवृत्ति का संकेत देता है
  • 30 से नीचे का ADX कोई रुझान नहीं दर्शाता है
  1. प्रवेश के नियम
  • दीर्घ जब आरएसआई < 30 और एडीएक्स > 30 हो
  • लघु जब आरएसआई > 70 और एडीएक्स > 30 हो
  1. लाभ लें और हानि रोकें
  • वैकल्पिक लाभ लेने और हानि रोकने के तरीके - बंद आधारित या स्विंग आधारित
  • निकट आधारित उपयोगों की समापन कीमतें
  • स्विंग आधारित उपयोग हाल के स्विंग उच्च/निम्न

लाभ विश्लेषण

  1. आरएसआई प्रभावी रूप से खरीद/बिक्री जाल से बचने के लिए ओवरबॉट और ओवरसोल्ड स्तरों की पहचान करता है

  2. एडीएक्स विप्स से बचने के लिए रेंज-बाउंड बाजारों को फ़िल्टर करता है

  3. वैकल्पिक लाभ लेने/हानि रोकने के तरीके जोखिम को बेहतर ढंग से नियंत्रित करने में मदद करते हैं

  4. सरल और समझने में आसान, एल्गोरिथ्म ट्रेडिंग सीखने के लिए शुरुआती के लिए अच्छा है

  5. पैरामीटर अनुकूलन और परिष्करण के लिए बहुत जगह

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

  1. आरएसआई ओवरबॉट/ओवरसोल्ड में पॉलबैक और रिवर्स हो सकते हैं

  2. एडीएक्स रुझान निर्धारण में देरी है, रुझान मोड़ बिंदुओं को याद कर सकता है

  3. गलत स्टॉप लॉस प्लेसमेंट से नुकसान हो सकता है

  4. सरलता के कारण अति-अनुकूलन का जोखिम

  5. बेहतर प्रदर्शन के लिए आवश्यक पैरामीटर अनुकूलन

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

  1. आरएसआई मापदंडों और ओवरबॉट/ओवरसोल्ड स्तरों को अनुकूलित करें

  2. इष्टतम सेटिंग खोजने के लिए विभिन्न ADX अवधि का परीक्षण करें

  3. लाभ लेने/हटाने के विभिन्न तरीकों का परीक्षण करें

  4. विपरीत प्रवृत्ति व्यापार से बचने के लिए प्रवृत्ति फ़िल्टर जोड़ें

  5. बेहतर प्रदर्शन के लिए अन्य संकेतकों के साथ संयोजन

सारांश

यह रणनीति रुझानों की पहचान करने और whipsaws से बचने के लिए क्लासिक आरएसआई और एडीएक्स संकेतकों की ताकतों को जोड़ती है। इसमें बेहतर प्रदर्शन प्राप्त करने के लिए अनुकूलन के लिए बहुत जगह है। कुल मिलाकर, यह एक शुरुआती के परिचयात्मक एल्गोरिथ्म ट्रेडिंग रणनीति के रूप में अच्छी तरह से काम करता है, और इसे अधिक जटिल ट्रेडिंग सिस्टम में भी शामिल किया जा सकता है।


/*backtest
start: 2023-09-19 00:00:00
end: 2023-09-26 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © tweakerID

// This is a strategy that uses the 7 Period RSI to buy when the indicator is shown as oversold (OS) and sells when 
// the index marks overbought (OB). It also uses the ADX to determine whether the trend is ranging or trending
// and filters out the trending trades. Seems to work better for automated trading when the logic is inversed (buying OB 
// and selling the OS) wihout stop loss.

//@version=4
strategy("ADX + RSI Strat", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, initial_capital=100, commission_value=0.04, calc_on_every_tick=false)

direction = input(0, title = "Strategy Direction", type=input.integer, minval=-1, maxval=1)
strategy.risk.allow_entry_in(direction == 0 ? strategy.direction.all : (direction < 0 ? strategy.direction.short : strategy.direction.long))


//SL & TP Inputs
i_SL=input(false, title="Use Swing Lo/Hi Stop Loss & Take Profit")
i_SwingLookback=input(20, title="Swing Lo/Hi Lookback")
i_SLExpander=input(defval=0, step=.2, title="SL Expander")
i_TPExpander=input(defval=0, step=.2, title="TP Expander")
i_reverse=input(true, title="Reverse Trades")

//SL & TP Calculations
SwingLow=lowest(i_SwingLookback)
SwingHigh=highest(i_SwingLookback)
bought=strategy.position_size != strategy.position_size[1]
LSL=valuewhen(bought, SwingLow, 0)-((valuewhen(bought, atr(14), 0))*i_SLExpander)
SSL=valuewhen(bought, SwingHigh, 0)+((valuewhen(bought, atr(14), 0))*i_SLExpander)
lTP=strategy.position_avg_price + (strategy.position_avg_price-(valuewhen(bought, SwingLow, 0))+((valuewhen(bought, atr(14), 0))*i_TPExpander))
sTP=strategy.position_avg_price - (valuewhen(bought, SwingHigh, 0)-strategy.position_avg_price)-((valuewhen(bought, atr(14), 0))*i_TPExpander)
islong=strategy.position_size > 0
isshort=strategy.position_size < 0
SL= islong ? LSL : isshort ? SSL : na
TP= islong ? lTP : isshort ? sTP : na

//RSI Calculations
RSI=rsi(close, 7)
OS=input(30, step=5)
OB=input(80, step=5)

//ADX Calculations
adxlen = input(14, title="ADX Smoothing")
dilen = input(14, title="DI Length")
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)
adxlevel=input(30, step=5)


//Entry Logic
BUY = sig < adxlevel and (RSI < OS) 
SELL = sig < adxlevel and (RSI > OB) 

//Entries
strategy.entry("long", strategy.long, when=i_reverse?SELL:BUY)
strategy.entry("short", strategy.short, when=not i_reverse?SELL:BUY)
//Exits
if i_SL
    strategy.exit("longexit", "long", stop=SL, limit=TP)
    strategy.exit("shortexit", "short", stop=SL, limit=TP)

//Plots
plot(i_SL ? SL : na, color=color.red, style=plot.style_cross, title="SL")
plot(i_SL ? TP : na, color=color.green, style=plot.style_cross, title="TP")
plotshape(BUY ? 1 : na, style=shape.triangleup, location=location.belowbar, color=color.green, title="Bullish Setup")
plotshape(SELL ? 1 : na, style=shape.triangledown, location=location.abovebar, color=color.red, title="Bearish Setup")

अधिक