
یہ حکمت عملی ایک ذہین تجارتی نظام ہے جو ایک سے زیادہ ٹرینڈ لائن توڑنے پر مبنی ہے۔ یہ متحرک طور پر اہم معاون مزاحمت کی سطح کی نشاندہی کرتا ہے ، متعدد تکنیکی اشارے کے ساتھ مل کر رجحان لائن کے سلپ کا حساب لگاتا ہے ، اور جب قیمت ٹرینڈ لائن کو توڑتی ہے تو تجارت کرتی ہے۔ یہ حکمت عملی نہ صرف مارکیٹ کے رجحانات کے موڑ کو پکڑ سکتی ہے بلکہ پیرامیٹرز کو بہتر بنانے کے ذریعہ مختلف مارکیٹ کے حالات کے مطابق بھی اپنایا جاسکتا ہے۔
حکمت عملی کے بنیادی منطق میں تین اہم حصے شامل ہیں: سب سے پہلے ، اہم اونچائیوں اور نچلی سطحوں کی شناخت ، ابتدائی معاونت کی مزاحمت کی سطح کو تشکیل دینے کے لئے ، پیچھے کی طرف دیکھنے کی مدت کے ذریعے؛ دوسرا ، رجحان لائن کے سلپ کو متحرک طور پر حساب کتاب کرنے کے لئے ، جس سے رجحان لائن کو مارکیٹ میں اتار چڑھاؤ کے ل better بہتر طور پر ڈھالنے کے قابل بنایا جاسکتا ہے ، حساب کتاب کے منتخب کردہ طریقہ کار کے مطابق (ATR ، معیاری فرق یا لکیری رجعت) ؛ اور آخر میں ، قیمتوں اور رجحان لائنوں کے تعلقات کی نگرانی کرکے ، ایک تجارتی سگنل کو ٹرگر کیا جاتا ہے جب ایک بریک ہوتا ہے۔ اس نظام میں بیک پیمنٹنگ پیرامیٹرز کے ذریعہ حقیقی تجارتی ماحول کو ماڈل کرنے کے لئے بیک پیمنٹنگ پیرامیٹرز کو بھی شامل کیا گیا ہے۔
اس حکمت عملی نے متعدد تکنیکی تجزیہ کے طریقوں کو مربوط کرکے ایک قابل اعتماد ٹرینڈ لائن توڑنے والا تجارتی نظام تشکیل دیا ہے۔ اس کا فائدہ یہ ہے کہ مارکیٹ میں ہونے والی تبدیلیوں کو متحرک طور پر اپنانے کے ساتھ ساتھ واضح تجارتی سگنل فراہم کریں۔ اگرچہ اس میں کچھ موروثی خطرات موجود ہیں ، لیکن مناسب پیرامیٹرز کی ترتیب اور مسلسل اصلاح کے ذریعہ حکمت عملی کی استحکام اور منافع کو نمایاں طور پر بڑھایا جاسکتا ہے۔
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-18 08:00:00
period: 1d
basePeriod: 1d
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/
// © Alexgoldhunter
//@version=5
strategy("Trendlines with Breaks Strategy [AlexGoldHunter]", overlay=true)
// Input parameters
length = input.int(14, title="Swing Detection Lookback")
mult = input.float(1.0, title="Slope", minval=0, step=0.1)
calcMethod = input.string('Atr', title="Slope Calculation Method", options=['Atr','Stdev','Linreg'])
backpaint = input(true, tooltip='Backpainting offset displayed elements in the past. Disable backpainting to see real-time information returned by the indicator.')
// Style settings
upCss = input.color(color.teal, title="Up Trendline Color", group="Style")
dnCss = input.color(color.red, title="Down Trendline Color", group="Style")
showExt = input(true, title="Show Extended Lines")
// Calculations
var upper = 0.0
var lower = 0.0
var slope_ph = 0.0
var slope_pl = 0.0
var offset = backpaint ? length : 0
n = bar_index
src = close
ph = ta.pivothigh(length, length)
pl = ta.pivotlow(length, length)
// Slope Calculation Method
slope = switch calcMethod
'Atr' => ta.atr(length) / length * mult
'Stdev' => ta.stdev(src, length) / length * mult
'Linreg' => math.abs(ta.sma(src * n, length) - ta.sma(src, length) * ta.sma(n, length)) / ta.variance(n, length) / 2 * mult
// Get slopes and calculate trendlines
slope_ph := ph ? slope : slope_ph
slope_pl := pl ? slope : slope_pl
upper := ph ? ph : upper - slope_ph
lower := pl ? pl : lower + slope_pl
var upos = 0
var dnos = 0
upos := ph ? 0 : close > upper - slope_ph * length ? 1 : upos
dnos := pl ? 0 : close < lower + slope_pl * length ? 1 : dnos
// Extended Lines
// var uptl = line.new(na, na, na, na, color=upCss, style=line.style_dashed, extend=extend.right)
// var dntl = line.new(na, na, na, na, color=dnCss, style=line.style_dashed, extend=extend.right)
// if ph and showExt
// uptl.set_xy1(n - offset, backpaint ? ph : upper - slope_ph * length)
// uptl.set_xy2(n - offset + 1, backpaint ? ph - slope : upper - slope_ph * (length + 1))
// if pl and showExt
// dntl.set_xy1(n - offset, backpaint ? pl : lower + slope_pl * length)
// dntl.set_xy2(n - offset + 1, backpaint ? pl + slope : lower + slope_pl * (length + 1))
// Plots
plot(backpaint ? upper : upper - slope_ph * length, title="Upper", color=ph ? na : upCss, offset=-offset)
plot(backpaint ? lower : lower + slope_pl * length, title="Lower", color=pl ? na : dnCss, offset=-offset)
// Breakouts
plotshape(upos > upos[1] ? low : na, title="Upper Break",
style=shape.labelup, location=location.absolute, color=upCss, text="alex_buy_now", textcolor=color.white, size=size.tiny)
plotshape(dnos > dnos[1] ? high : na, title="Lower Break",
style=shape.labeldown, location=location.absolute, color=dnCss, text="alex_sell_now", textcolor=color.white, size=size.tiny)
// Strategy: Buy and Sell conditions
if (upos > upos[1])
strategy.entry("Buy", strategy.long)
if (dnos > dnos[1])
strategy.entry("Sell", strategy.short)
// Alerts
alertcondition(upos > upos[1], title="Upward Breakout", message="Price broke the down-trendline upward")
alertcondition(dnos > dnos[1], title="Downward Breakout", message="Price broke the up-trendline downward")