
یہ حکمت عملی ایک خودکار ٹریڈنگ سسٹم ہے جو کیش فلو انڈیکس (ایم ایف آئی) پر مبنی ہے اور بنیادی طور پر اوور سیل زون میں اثاثوں کی کارکردگی کی نشاندہی کرکے ممکنہ الٹ کے مواقع کو پکڑتا ہے۔ حکمت عملی کا مرکز خریدنے کا اشارہ پیدا کرتا ہے جب ایم ایف آئی انڈیکس اوور سیل زون (ڈیفالٹ 20 سے نیچے) سے واپس آجاتا ہے ، اور اس میں ٹریڈنگ کے خطرات اور فوائد کا انتظام کرنے کے لئے متعدد میکانزم جیسے حد کی قیمت ، اسٹاپ نقصان اور منافع کا خاتمہ ہوتا ہے۔ یہ حکمت عملی خاص طور پر موزوں ہے جب مارکیٹ میں اوور ڈراپ ریبوول ہوتا ہے۔
حکمت عملی مندرجہ ذیل اہم اقدامات پر مبنی ہے:
یہ ایک مناسب ، منطقی اور واضح طور پر ڈیزائن کردہ خودکار تجارتی حکمت عملی ہے۔ ایم ایف آئی کے اشارے کے لچکدار استعمال کے ساتھ ، آرڈر مینجمنٹ کے ایک بہتر طریقہ کار کے ساتھ مل کر ، مارکیٹ میں فروخت کے بعد واپسی کے مواقع کو مؤثر طریقے سے پکڑنے کے قابل ہے۔ حکمت عملی کی تشکیل قابل ہے ، جس سے مختلف مارکیٹ کے حالات کے مطابق بہتر ایڈجسٹمنٹ کی جاسکتی ہے۔ اگرچہ کچھ خطرات موجود ہیں ، لیکن تجویز کردہ اصلاح کی سمت سے حکمت عملی کی استحکام اور منافع کو مزید فروغ دیا جاسکتا ہے۔ یہ درمیانے اور طویل مدتی سرمایہ کاری کے لئے موزوں ہے ، خاص طور پر غیر مستحکم مارکیٹ میں واپسی کے مواقع تلاش کرنے والے سرمایہ کاروں کے لئے۔
/*backtest
start: 2024-11-04 00:00:00
end: 2024-12-04 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © traderhub
//@version=5
strategy("MFI Strategy with Oversold Zone Exit and Averaging", overlay=true)
// Strategy parameters
mfiPeriod = input.int(title="MFI Period", defval=14) // Period for calculating MFI
mfiOS = input.float(title="MFI Oversold Level", defval=20.0) // Oversold level for MFI
longEntryPercentage = input.float(title="Long Entry Percentage (%)", minval=0.0, step=0.1, defval=0.1) // Percentage for the buy limit order
stopLossPercentage = input.float(title="Stop Loss Percentage (%)", minval=0.0, step=0.1, defval=1.0) // Percentage for the stop-loss
exitGainPercentage = input.float(title="Exit Gain Percentage (%)", minval=0.0, step=0.1, defval=1.0) // Percentage gain for the take-profit
cancelAfterBars = input.int(title="Cancel Order After # Bars", minval=1, defval=5) // Cancel order after a certain number of bars
// Calculate MFI
mfi = ta.mfi(close, mfiPeriod) // MFI with specified period
// Variables for tracking state
var bool inOversoldZone = false // Flag for being in the oversold zone
var float longEntryPrice = na // Price for long entry
var int barsSinceEntryOrder = na // Counter for bars after placing an order
// Define being in the oversold zone
if (mfi < mfiOS)
inOversoldZone := true // Entered oversold zone
// Condition for exiting the oversold zone and placing a limit order
if (inOversoldZone and mfi > mfiOS)
inOversoldZone := false // Leaving the oversold zone
longEntryPrice := close * (1 - longEntryPercentage / 100) // Calculate limit price for entry
strategy.entry("Long Entry", strategy.long, limit=longEntryPrice) // Place a limit order
barsSinceEntryOrder := 0 // Reset counter for bars after placing the order
// Increase the bar counter if the order has not yet been filled
if (not na(barsSinceEntryOrder))
barsSinceEntryOrder += 1
// Cancel order if it hasn’t been filled within the specified number of bars
if (not na(barsSinceEntryOrder) and barsSinceEntryOrder >= cancelAfterBars and strategy.position_size == 0)
strategy.cancel("Long Entry")
barsSinceEntryOrder := na // Reset bar counter
// Set stop-loss and take-profit for filled positions
if (strategy.position_size > 0)
stopLossPrice = longEntryPrice * (1 - stopLossPercentage / 100) // Calculate stop-loss level
takeProfitPrice = longEntryPrice * (1 + exitGainPercentage / 100) // Calculate take-profit level
strategy.exit("Exit Long", from_entry="Long Entry", limit=takeProfitPrice, stop=stopLossPrice)
// Visualize oversold and overbought zones
bgcolor(mfi < mfiOS ? color.new(color.green, 90) : na) // Background in oversold zone
plot(mfi, title="MFI", color=color.blue) // MFI plot
hline(mfiOS, "Oversold Level", color=color.red) // Oversold level line