इस रणनीति के आधार पर निर्णय के लिए अपेक्षाकृत मजबूत और कमजोर सूचकांक (आरएसआई) सूचक, जब आरएसआई के ऊपर सेट अपरलिमिट के ऊपर और जब आरएसआई के नीचे सेट अपरलिमिट के नीचे अधिक है, तो यह एक विशिष्ट आरएसआई रिवर्स ट्रेडिंग रणनीति है। इस रणनीति में पैरामीटर अनुकूलन, स्टॉप लॉस रणनीति और अन्य कार्य हैं, जो विभिन्न बाजार स्थितियों के लिए पैरामीटर को समायोजित करके अनुकूलित की जा सकती हैं।
इस रणनीति के मूल सिद्धांतों में शामिल हैंः
आरएसआई संकेतक यह दर्शाता है कि बाजार ओवरबॉट या ओवरसोल्ड स्थिति में है। जब आरएसआई 70 से ऊपर होता है तो इसे ओवरबॉट माना जाता है, और जब आरएसआई 30 से नीचे होता है तो इसे ओवरसोल्ड माना जाता है। ट्रेडिंग रणनीति आरएसआई की ओवरबॉट ओवरसोल्ड स्थिति के आधार पर यह निर्धारित करने के लिए है कि क्या एक खाली स्थिति या एक बहु-स्थिति स्थापित की जानी चाहिए।
यह रणनीति आरएसआई सूचक के शास्त्रीय तर्क का उपयोग करती है, आरएसआई के मूल्यों के आधार पर पूर्वनिर्धारित ऊपरी और निचले सीमा के संबंध के आधार पर स्थिति की दिशा का निर्णय करती है। साथ ही, रणनीति में समायोज्य पैरामीटर होते हैं, जो आरएसआई ऊपरी और निचले सीमा, स्टॉप-स्टॉप-लॉस की चौड़ाई आदि को अनुकूलित कर सकते हैं, ताकि बाजार में बदलाव हो सके।
प्रतिउपाय:
इस रणनीति को निम्नलिखित पहलुओं में विस्तारित और अनुकूलित किया जा सकता हैः
आरएसआई पैरामीटर रेंज को स्वचालित रूप से अनुकूलित करने के लिए मशीन लर्निंग
लेनदेन की पुष्टि को बढ़ाएं और झूठे ब्रेक से बचें
चलती औसत जैसे संकेतकों के साथ बहु-कारक सत्यापन
बाजार में उतार-चढ़ाव के आधार पर स्टॉप को समायोजित करने के लिए एक अनुकूलनशील स्टॉप रणनीति सेट करें
ट्रेडों की मात्रा में परिवर्तन का अध्ययन करें और धन के प्रवाह को देखें
अन्य अप्रासंगिक रणनीतियों के संयोजन से समग्र वापसी को कम करना
यह रणनीति आरएसआई सूचक का उपयोग करके ओवरबॉट और ओवरसोल का निर्धारण करने के लिए एक सरल और व्यावहारिक रिवर्स रणनीति है। रणनीति को बाजार में बदलाव के अनुसार पैरामीटर को समायोजित किया जा सकता है, लेकिन इसे बहु-आयामी विस्तार और अनुकूलन भी किया जा सकता है। पैरामीटर अनुकूलन, बहु-कारक सत्यापन, आत्म-स्टॉप जैसे सुधारों के माध्यम से रणनीति को अधिक स्थिर और विश्वसनीय बनाया जा सकता है।
/*backtest
start: 2023-08-19 00:00:00
end: 2023-09-18 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("4All V3", shorttitle="Strategy", overlay=true)
/////////////// Component Code Start ///////////////
testStartYear = input(2011, "Backtest Start Year")
testStartMonth = input(8, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)
testStopYear = input(2018, "Backtest Stop Year")
testStopMonth = input(9, "Backtest Stop Month")
testStopDay = input(29, "Backtest Stop Day")
// testStopDay = testStartDay + 1
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=true)
testPeriodBackgroundColor = testPeriodBackground and (time >= testPeriodStart) and (time <= testPeriodStop) ? #00FF00 : na
bgcolor(testPeriodBackgroundColor, transp=97)
testPeriod() => true
/////////////// Component Code Stop ///////////////
src = close
len = input(4, minval=1, title="Length")
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsin = input(5)
sn = 100 - rsin
ln = 0 + rsin
/////////////// STRATEGY ///////////////
ts = input(99999, "Trailing Stop") / 10000
tp = input(15, "Take Profit") / 10000
sl = input(23, "Stop Loss") / 10000
pyr = input(1, "Pyramiding")
short = crossover(rsi, sn)
long = crossunder(rsi, ln)
totalLongs = 0
totalLongs := nz(totalLongs[1])
totalShorts = 0
totalShorts := nz(totalShorts[1])
totalLongsPrice = 0
totalLongsPrice := nz(totalLongsPrice[1])
totalShortsPrice = 0
totalShortsPrice := nz(totalShortsPrice[1])
sectionLongs = 0
sectionLongs := nz(sectionLongs[1])
sectionShorts = 0
sectionShorts := nz(sectionShorts[1])
if long
sectionLongs := sectionLongs + 1
sectionShorts := 0
if short
sectionLongs := 0
sectionShorts := sectionShorts + 1
longCondition = long and sectionLongs >= pyr
shortCondition = short and sectionShorts >= pyr
last_long = na
last_short = na
last_long := longCondition ? time : nz(last_long[1])
last_short := shortCondition ? time : nz(last_short[1])
long_signal = crossover(last_long, last_short)
short_signal = crossover(last_short, last_long)
last_open_long_signal = na
last_open_short_signal = na
last_open_long_signal := long_signal ? open : nz(last_open_long_signal[1])
last_open_short_signal := short_signal ? open : nz(last_open_short_signal[1])
last_long_signal = na
last_short_signal = na
last_long_signal := long_signal ? time : nz(last_long_signal[1])
last_short_signal := short_signal ? time : nz(last_short_signal[1])
in_long_signal = last_long_signal > last_short_signal
in_short_signal = last_short_signal > last_long_signal
last_high = na
last_low = na
last_high := not in_long_signal ? na : in_long_signal and (na(last_high[1]) or high > nz(last_high[1])) ? high : nz(last_high[1])
last_low := not in_short_signal ? na : in_short_signal and (na(last_low[1]) or low < nz(last_low[1])) ? low : nz(last_low[1])
long_ts = not na(last_high) and high <= (last_high - ts) //and high >= last_open_long_signal
short_ts = not na(last_low) and low >= (last_low + ts) //and low <= last_open_short_signal
long_tp = high >= (last_open_long_signal + tp)
short_tp = low <= (last_open_short_signal - tp)
long_sl = low <= (last_open_long_signal - sl)
short_sl = high >= (last_open_short_signal + sl)
leverage = input(1, "Leverage")
long_call = last_open_long_signal - (0.8 + 0.2 * (1/leverage)) / leverage * last_open_long_signal
short_call = last_open_short_signal + (0.78 + 0.2 * (1/leverage)) / leverage * last_open_short_signal
long_call_signal = low <= long_call
short_call_signal = high >= short_call
if testPeriod()
strategy.entry("Long", strategy.long, when=longCondition)
strategy.entry("Short", strategy.short, when=shortCondition)
strategy.close("Long", when=long_call_signal)
strategy.close("Short", when=short_call_signal)
strategy.close("Long", when=long_tp)
strategy.close("Short", when=short_tp)
strategy.close("Long", when=long_sl)
strategy.close("Short", when=short_sl)
strategy.close("Long", when=long_ts)
strategy.close("Short", when=short_ts)