PresentTrend حکمت عملی ایک منفرد اپنی مرضی کے رجحان کی پیروی کی حکمت عملی ہے۔ یہ حکمت عملی قلیل مدتی اور طویل مدتی مارکیٹ کے رجحانات کو جوڑتی ہے ، جس سے یہ مختلف مارکیٹ کے حالات کے لئے موزوں ہے۔
اس حکمت عملی کے دو حصے ہیں:
اپنی مرضی کے مطابق آر ایس آئی یا ایم ایف آئی اشارے: یہ اشارے آر ایس آئی یا ایم ایف آئی کے حساب سے پریزنٹ ٹرینڈ ویلیو پر مبنی ہے ، اور اس ویلیو کے مطابق گولڈ فورک ڈیڈ فورک خرید اور فروخت سگنل پیدا کرتا ہے ، جو ممکنہ رجحان کی تبدیلی کی نشاندہی کرتا ہے۔
اے ٹی آر اشارے: یہ ایک مقبول رجحان کی پیروی کرنے والا اشارے ہے ، جس میں اوسط حقیقی اتار چڑھاو کی حد ((اے ٹی آر)) استعمال کی جاتی ہے۔
جب دونوں حکمت عملیوں کے خرید و فروخت کے سگنل ایک ساتھ ٹرگر ہوتے ہیں تو یہ حکمت عملی زیادہ یا کم پوزیشن کھولتی ہے۔ اس سے اس بات کو یقینی بنایا جاسکتا ہے کہ تجارت صرف قلیل مدتی اور طویل مدتی رجحانات کے مطابق ہوتی ہے ، جس سے حکمت عملی کی وشوسنییتا میں اضافہ ہوتا ہے۔
PresentTrend حکمت عملی مجموعی طور پر ایک بہت ہی موثر رجحان کی پیروی کی حکمت عملی ہے۔ یہ ایک ہی وقت میں قلیل اور طویل مدتی رجحان کے اشارے کو جوڑتا ہے ، جس سے حساسیت برقرار رکھتے ہوئے سگنل کی وشوسنییتا میں اضافہ ہوتا ہے۔ سمت ، پیرامیٹرز کو ایڈجسٹ کرکے اور اضافی منطق شامل کرکے ، یہ حکمت عملی مختلف مارکیٹ کے ماحول اور تاجروں کی ضروریات کے مطابق ڈھال سکتی ہے۔ اگرچہ رجحان کی پیروی کی حکمت عملی کے موروثی خطرات پر توجہ دینے کی ضرورت ہے ، لیکن مجموعی طور پر PresentTrend ایک قابل غور انتخاب ہے۔
/*backtest
start: 2023-08-21 00:00:00
end: 2023-09-20 00:00:00
period: 2h
basePeriod: 15m
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/
// © PresentTrading
//@version=5
// Define the strategy settings
strategy('PresentTrend - Strategy [presentTrading]' , overlay=true, precision=3, default_qty_type=strategy.cash,
commission_value= 0.1, commission_type=strategy.commission.percent, slippage= 1,
currency=currency.USD, default_qty_type = strategy.percent_of_equity, default_qty_value = 10, initial_capital= 10000)
// Define the input parameters
priceSource = input.source(title='Source', defval=hlc3, group='PresentTrend') // The price source to use
lengthParam = input.int(title='Length', defval=14, group='PresentTrend') // The length of the moving average
multiplier = input.float(title='Multiplier', defval=1.618, step=0.1, group='PresentTrend') // The multiplier for the ATR
indicatorChoice = input.bool(title='Whether to use RSI or MFI', defval=false, group='PresentTrend') // Whether to use RSI or MFI
// Add a parameter for choosing Long or Short
tradeDirection = input.string(title="Trade Direction", defval="Both", options=["Long", "Short", "Both"])
// Calculate the ATR and the upT and downT values
ATR = ta.sma(ta.tr, lengthParam)
upperThreshold = low - ATR * multiplier
lowerThreshold = high + ATR * multiplier
// Initialize the PresentTrend indicator
PresentTrend = 0.0
// Calculate the PresentTrend indicator
PresentTrend := (indicatorChoice ? ta.rsi(priceSource, lengthParam) >= 50 : ta.mfi(hlc3, lengthParam) >= 50) ? upperThreshold < nz(PresentTrend[1]) ? nz(PresentTrend[1]) : upperThreshold : lowerThreshold > nz(PresentTrend[1]) ? nz(PresentTrend[1]) : lowerThreshold
// Calculate the buy and sell signals
longSignal = ta.crossover(PresentTrend, PresentTrend[2])
shortSignal = ta.crossunder(PresentTrend, PresentTrend[2])
// Calculate the number of bars since the last buy and sell signals
barsSinceBuy = ta.barssince(longSignal)
barsSinceSell = ta.barssince(shortSignal)
previousBuy = ta.barssince(longSignal[1])
previousSell = ta.barssince(shortSignal[1])
// Initialize the direction variable
trendDirection = 0
// Calculate the direction of the trend
trendDirection := longSignal and previousBuy > barsSinceSell ? 1 : shortSignal and previousSell > barsSinceBuy ? -1 : trendDirection[1]
// Check the trade direction parameter before entering a trade
if (trendDirection == 1 and (tradeDirection == "Long" or tradeDirection == "Both"))
strategy.entry("Buy", strategy.long)
if (trendDirection == -1 and (tradeDirection == "Short" or tradeDirection == "Both"))
strategy.entry("Sell", strategy.short)
// Add a stop mechanism when the tradeDirection is one-sided
if (tradeDirection == "Long" and trendDirection == -1)
strategy.close("Buy")
if (tradeDirection == "Short" and trendDirection == 1)
strategy.close("Sell")
// Visualization
plot(PresentTrend, color=color.blue, title="PresentTrend")
plotshape(series=longSignal, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal")
plotshape(series=shortSignal, location=location.abovebar, color=color.red, style=shape.labeldown, title="Sell Signal")