
यह रणनीति एक शॉर्ट-लाइन ट्रेडिंग रणनीति है जो एमएफआई सूचकांकों का उपयोग करके ओवरबॉय और ओवरसोल्ड क्षेत्रों की पहचान करती है, जो एमए फ़िल्टरिंग के साथ मिलकर मूल्य उलट दिशा का आकलन करती है। यह स्टॉक, विदेशी मुद्रा, कमोडिटी और क्रिप्टोकरेंसी जैसे बाजारों में प्रभावी हो सकती है।
MFI सूचकांक का उपयोग करने की रणनीति बाजार में ओवरबॉय ओवरसोल की घटना का आकलन करती है। जब MFI 20 से नीचे के ओवरसोल क्षेत्र में प्रवेश करता है, तो यह नीचे के क्षेत्र को दर्शाता है, मूल्य कम हो जाता है, और यह तेजी से बढ़ जाता है; जब MFI 80 से ऊपर के ओवरबॉय क्षेत्र में प्रवेश करता है, तो यह शीर्ष क्षेत्र को दर्शाता है, संपत्ति अधिक हो जाती है, और यह गिरावट आती है।
नकली रिवर्स को फ़िल्टर करने के लिए, रणनीति में मूल्य प्रवृत्ति की दिशा का आकलन करने के लिए एमए संकेतक भी पेश किए गए हैं। केवल एमएफआई रिवर्स के साथ ही, जब कीमत एमए के ऊपर या नीचे होती है, तो ट्रेडिंग सिग्नल उत्पन्न होता है।
लेन-देन का तर्क इस प्रकार है:
इस प्रकार, दोहरे संकेतक फ़िल्टर के माध्यम से, पलटने के अवसरों की पहचान करने में सक्षम है, और प्रवेश संकेत अधिक विश्वसनीय है।
कैसे करें:
इस रणनीति में क्लासिक विश्लेषणात्मक विधियों को आधुनिक मात्रात्मक तकनीकों के साथ एकीकृत किया गया है और यह एक अनुशंसित सामान्य शॉर्ट-लाइन रणनीति है, जो विभिन्न किस्मों में मजबूत अनुकूलनशीलता का प्रदर्शन करती है, जो सख्त दोहरे सूचक फ़िल्टरिंग के माध्यम से है।
/*backtest
start: 2023-12-19 00:00:00
end: 2023-12-26 00:00:00
period: 1m
basePeriod: 1m
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/
// © vikris
//@version=4
strategy("[VJ]Thor for MFI", overlay=true, calc_on_every_tick = false,pyramiding=0)
// ********** Strategy inputs - Start **********
// Used for intraday handling
// Session value should be from market start to the time you want to square-off
// your intraday strategy
// Important: The end time should be at least 2 minutes before the intraday
// square-off time set by your broker
var i_marketSession = input(title="Market session", type=input.session,
defval="0915-1455", confirm=true)
// Make inputs that set the take profit % (optional)
longProfitPerc = input(title="Long Take Profit (%)",
type=input.float, minval=0.0, step=0.1, defval=1) * 0.01
shortProfitPerc = input(title="Short Take Profit (%)",
type=input.float, minval=0.0, step=0.1, defval=1) * 0.01
// Set stop loss level with input options (optional)
longLossPerc = input(title="Long Stop Loss (%)",
type=input.float, minval=0.0, step=0.1, defval=0.5) * 0.01
shortLossPerc = input(title="Short Stop Loss (%)",
type=input.float, minval=0.0, step=0.1, defval=0.5) * 0.01
i_MFI = input(3, title="MFI Length")
OB=input(100, title="Overbought Level")
OS=input(0, title="Oversold Level")
barsizeThreshold=input(.5, step=.05, minval=.1, maxval=1, title="Bar Body Size, 1=No Wicks")
i_MAFilter = input(true, title="Use MA Trend Filter")
i_MALen = input(80, title="MA Length")
// ********** Strategy inputs - End **********
// ********** Supporting functions - Start **********
// A function to check whether the bar or period is in intraday session
barInSession(sess) => time(timeframe.period, sess) != 0
// Figure out take profit price
longExitPrice = strategy.position_avg_price * (1 + longProfitPerc)
shortExitPrice = strategy.position_avg_price * (1 - shortProfitPerc)
// Determine stop loss price
longStopPrice = strategy.position_avg_price * (1 - longLossPerc)
shortStopPrice = strategy.position_avg_price * (1 + shortLossPerc)
// ********** Supporting functions - End **********
// ********** Strategy - Start **********
// See if intraday session is active
bool intradaySession = true
// Trade only if intraday session is active
//=================Strategy logic goes in here===========================
MFI=mfi(close,i_MFI)
barsize=high-low
barbodysize=close>open?(open-close)*-1:(open-close)
shortwicksbar=barbodysize>barsize*barsizeThreshold
SMA=sma(close, i_MALen)
MAFilter=close > SMA
BUY = MFI[1] == OB and close > open and shortwicksbar and (i_MAFilter ? MAFilter : true)
SELL = MFI[1] == OS and close < open and shortwicksbar and (i_MAFilter ? not MAFilter : true)
//Final Long/Short Condition
longCondition = BUY
shortCondition = SELL
//Long Strategy - buy condition and exits with Take profit and SL
if (longCondition and intradaySession)
stop_level = longStopPrice
profit_level = longExitPrice
strategy.entry("Buy", strategy.long)
strategy.exit("TP/SL", "Buy", stop=stop_level, limit=profit_level)
//Short Strategy - sell condition and exits with Take profit and SL
if (shortCondition and intradaySession)
stop_level = shortStopPrice
profit_level = shortExitPrice
strategy.entry("Sell", strategy.short)
strategy.exit("TP/SL", "Sell", stop=stop_level, limit=profit_level)
// Square-off position (when session is over and position is open)
squareOff = (not intradaySession) and (strategy.position_size != 0)
strategy.close_all(when = squareOff, comment = "Square-off")
// ********** Strategy - End **********