
یہ حکمت عملی 10 ای ایم اے اور 50 ای ایم اے ڈبل کراس پر مبنی ایک رجحان ٹریکنگ حکمت عملی ہے۔ یہ گھڑی کی لائن کے 10 ای ایم اے کو معاون فیصلے کے طور پر جوڑتا ہے ، اور بیل اور ریچھ کے متبادل بازاروں میں رجحان کی سمت کو متحرک طور پر تلاش کرتا ہے ، جس سے خود کار طریقے سے ٹریکنگ اسٹاپ نقصان ہوتا ہے۔
حکمت عملی کا بنیادی منطق 10 ای ایم اے اور 50 ای ایم اے کے گولڈ فورکس پر مبنی ہے۔ خاص طور پر ، جب 10 ای ایم اے نیچے سے 50 ای ایم اے کی گولڈ فورکس کو پار کرتا ہے تو ، اس کا فیصلہ ہوتا ہے کہ یہ ایک اوپر کی طرف رجحان میں ہے۔ جب 10 ای ایم اے اوپر سے نیچے سے 50 ای ایم اے کی گولڈ فورکس کو پار کرتا ہے تو ، اس کا فیصلہ ہوتا ہے کہ یہ ایک نیچے کی طرف رجحان میں ہے۔
اس کے علاوہ ، حکمت عملی میں گھڑی کی لائن کا 10 ای ایم اے بطور معاون فیصلہ بھی متعارف کرایا گیا ہے ، جب گھڑی کی لائن کا 10 ای ایم اے بڑھتے ہوئے رجحان میں ہوتا ہے تو صرف گولڈ فورک کے پیچھے زیادہ پوزیشن کھولی جاتی ہے ، اور جب گھڑی کی لائن کا 10 ای ایم اے گرنے کے رجحان میں ہوتا ہے تو صرف ڈیڈ فورک کے بعد خالی پوزیشن کھولی جاتی ہے ، جس سے کچھ جھوٹے سگنل فلٹر ہوجاتے ہیں۔
پوزیشن کھولنے کے بعد ، حکمت عملی اسٹاپ نقصان + قیمت کی حد کو روکنے کے راستے کو اپناتی ہے۔ ٹریکنگ اسٹاپ منافع کو لاک کرنے اور زیادہ سے زیادہ تجارت کو منافع بخش بنانے کے لئے استعمال کیا جاتا ہے۔ قیمت کی حد کو روکنا اس بات کو یقینی بناتا ہے کہ جب قیمت ہدف پوائنٹ تک پہنچ جاتی ہے تو پوزیشن کو بند کرکے منافع حاصل کیا جائے۔
اس حکمت عملی کا سب سے بڑا فائدہ یہ ہے کہ بنیادی رجحان کی سمت کا فیصلہ کرنے کے لئے ای ایم اے کراس کا استعمال کرتے ہوئے ، معاون اشارے فلٹرنگ سگنل کو بھی متعارف کرایا گیا ہے۔ اس سے جعلی کراس کو مؤثر طریقے سے فلٹر کیا جاسکتا ہے ، جس سے سگنل کی وشوسنییتا میں اضافہ ہوتا ہے۔ اس کے علاوہ ، ڈبل ای ایم اے کراسنگ ٹریکنگ اسٹاپ اور قیمت کی حد کو روکنے کے ساتھ مل کر ، رجحان کی پیروی کے فوائد کو زیادہ سے زیادہ بنانے کے ساتھ ساتھ ، تجارت کے خطرے کو مؤثر طریقے سے کنٹرول کرنے میں مدد کرتا ہے۔
یہ حکمت عملی ایک ہی اشارے کی حکمت عملی کے مقابلے میں رجحان کی سمت اور طول و عرض کا زیادہ درست اندازہ لگانے میں مدد کرتی ہے۔ روایتی اسٹاپ نقصانات کے مقابلے میں ، یہ حکمت عملی زیادہ جدید ٹریکنگ اسٹاپ نقصانات کی تکنیک کا استعمال کرتی ہے ، جس سے منافع کو بہتر طور پر لاک کیا جاسکتا ہے۔
اس حکمت عملی کو بنیادی طور پر وقفے وقفے سے whipsaw اور رجحان کے الٹ جانے کا خطرہ ہے۔ جب مسلسل غلط کراس سگنل ہوتے ہیں تو اس حکمت عملی کو بیعانہ کرنے کا سبب بن سکتا ہے۔ اس کے علاوہ ، پوزیشن کھولنے کے بعد قیمت میں الٹ جانے سے نقصان بھی ہوسکتا ہے۔
وپساؤ کے خطرے کو کم کرنے کے لئے ، حکمت عملی میں معاون اشارے شامل کیے گئے ہیں تاکہ سگنل فلٹر کیا جاسکے۔ رجحان کی واپسی کے خطرے کو کنٹرول کرنے کے لئے ، حکمت عملی میں زیادہ رواداری کی حد کا استعمال کیا گیا ہے ، جبکہ قیمت کی حد روکنے کی ترتیب بھی اس طرح کے خطرے کو کم کرنے میں مدد فراہم کرتی ہے۔ جب رکاوٹ کو متحرک کیا جاتا ہے تو ، رجحان کی سمت میں دوبارہ داخل ہونے پر بھی غور کیا جاسکتا ہے۔
اس حکمت عملی میں کچھ اور اصلاحی سمتیں بھی ہیں: پہلا ، مختلف پیرامیٹرز کے مجموعے کی جانچ کی جاسکتی ہے ، جیسے کہ ای ایم اے کا دورانیہ ، پوزیشن کھولنے میں تاخیر کی جڑ ، وغیرہ ، بہترین پیرامیٹرز کی تلاش کے لئے۔ دوسرا ، سگنل کو بہتر بنانے کے لئے سگنل فلٹرنگ کے لئے مزید معاون اشارے ، جیسے MACD ، BOLL وغیرہ متعارف کروائے جاسکتے ہیں۔ تیسرا ، اسٹاپ نقصان کو روکنے کے منطق کو بہتر بنانے کے لئے ، جیسے وقت کی روک تھام ، کمپن اسٹاپ اور دیگر اسٹاپ نقصان کے طریقوں کو اپنانا۔ چوتھا ، تجارت کو شروع کرنے کی حکمت عملی کو زیادہ حالات کے ساتھ جوڑنا ، جیسے صرف کچھ عرصے میں یا قیمتوں میں اضافے یا کمی کے تحت سگنل کو متحرک کرنا۔
10 ای ایم اے ڈبل کراس ٹرینڈ ٹریکنگ حکمت عملی ، جو ای ایم اے گولڈن کراس اور ڈیتھ کراس کے ذریعہ موجودہ رجحان کی سمت کا فیصلہ کرتی ہے ، منافع کو روکنے اور کنٹرول کرنے کے لئے ٹریکنگ اسٹاپ اور قیمت کی حد کو روکنے کے لئے خطرہ طے کرتی ہے ، جبکہ معاون اشارے فلٹرنگ سگنل کے ساتھ مل کر سگنل کی کوالٹی کو بہتر بناتی ہے ، یہ ایک مکمل رجحان کی تجارت کی حکمت عملی ہے۔ واحد اشارے اور روایتی اسٹاپ نقصان کے مقابلے میں ، اس حکمت عملی میں فیصلہ کی درستگی ، اسٹاپ نقصان کی اصلاح ، اور اسی طرح کے فوائد ہیں۔
/*backtest
start: 2022-12-22 00:00:00
end: 2023-12-28 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("10ema Strat 9", overlay=true, format=format.price)
//#region // inputs for candles
//time
t1 = time(timeframe.period,"0930-1500") //last hour of market is not ideal for trading
// candle status
bullish = close > open and barstate.isconfirmed
bearish = open > close and barstate.isconfirmed
bullcandle = ta.valuewhen(bullish, close, 0)
bearcandle = ta.valuewhen(bearish, close, 0)
ema1 = input.int(10, minval=1, title="short ema")
ema2 = input.int(50, minval=1, title="long ema")
ema3 = input.int(200, minval=1, title="hourly 10 ema")
//@variable Input for source
src = input(close, title="Source")
offsetema = input.int(title="Offset", defval=0, minval=-500, maxval=500)
sema = ta.ema(src, ema1)//@variable Input for smaller ema1
lema = ta.ema(src, ema2)//@variable Input for longer ema2
hema = ta.ema(src, ema3)// @variable Input for hourly ema3
bullcrosscount = ta.barssince(ta.crossover(sema,lema)) //@variable Input 10/50 cross higher
bearcrosscount = ta.barssince(ta.crossunder(sema,lema)) //@variable Input 10/50 cross lower
ideallong = bullcrosscount <= 5 //number of candles after the cross
idealshort = bearcrosscount <= 5 //number of candles after the cross
emabull = (sema > lema) and bearish and close > sema and close > hema and ideallong and t1 and barstate.isconfirmed
xemabull = ta.barssince(emabull)
dbullema = emabull and emabull[1] and xemabull <=1
bullentry = if dbullema
ta.valuewhen(emabull[1], high + 0.05, 0)
else
ta.valuewhen(emabull, high + 0.05, 0)
bullentryh = dbullema ? bullentry[1] : bullentry
bullentrylow = ta.valuewhen(emabull, low - 0.05, 0)
bullstop = (bullentryh - bullentrylow) <= 1.00 ? bullentryh - 1.00 : (bullentryh - bullentrylow) <= 10.40 ? bullentrylow : na
bulltarget = (bullentryh - bullstop) * 1.62 + bullentryh
// bear setup
emabear = (sema < lema) and bullish and close < sema and close < hema and idealshort and t1 and barstate.isconfirmed
xemabear = ta.barssince(emabear)
dbearema = emabear and emabear [1] and xemabear <=1
bearentry = if dbearema
ta.valuewhen(emabear[1], low - 0.05, 0)
else
ta.valuewhen(emabear, low - 0.05, 0)
bearentryh = dbearema ? bearentry[1] : bearentry
bearentryhigh = ta.valuewhen(emabear, high + 0.05, 0)
bearstop = (bearentryhigh - bearentryh) <= 1.00 ? bearentryh + 1.00 : (bearentryh - bearentryhigh) <= 10.40 ? bearentryhigh : na
beartarget = bearentryh - (bearstop-bearentryh) * 1.62
bullclose = (xemabull <=7) and bullish and bullcrosscount >=1 and barstate.isconfirmed //number of candles for a close above
bearclose = (xemabear <=7) and bearish and bearcrosscount >=1 and barstate.isconfirmed //number of candles for a close below
buyzone = ta.barssince(bullclose)
shortzone = ta.barssince(bearclose)
idealbuy = close >= bullentryh and bullclose and (buyzone<=7)
idealsell = close <= bearentryh and bearclose and (shortzone<=7)
// // bull setup on chart
// if sema > lema and xemabull < 50
// var line line_bullentry = line.new(bar_index, na, bar_index + 1, na, color=color.rgb(0, 200, 0), style=line.style_solid, width=1)
// if emabull
// line.set_xy1(line_bullentry, x=bar_index, y=bullentryh)
// line.set_xy2(line_bullentry, x=bar_index, y=bullentryh)
// alert("EMA-bullish", alert.freq_once_per_bar_close)
// line.set_x2(line_bullentry, x=bar_index)
// var line line_bullstop = line.new(bar_index, na, bar_index + 1, na, color=color.rgb(250, 0, 0), style=line.style_solid, width=1)
// if emabull
// line.set_xy1(line_bullstop, x=bar_index, y=bullstop)
// line.set_xy2(line_bullstop, x=bar_index, y=bullstop)
// line.set_x2(line_bullstop, x=bar_index)
// var line line_bulltarget = line.new(bar_index, na, bar_index + 1, na, color=color.rgb(200, 100, 200), style=line.style_solid, width=1)
// if emabull
// line.set_xy1(line_bulltarget, x=bar_index, y=bulltarget)
// line.set_xy2(line_bulltarget, x=bar_index, y=bulltarget)
// line.set_x2(line_bulltarget, x=bar_index)
// //bear setup on chart
// if sema < lema and xemabear < 50
// var line line_bearentry = line.new(bar_index, na, bar_index, na, color=color.rgb(0, 200, 0), style=line.style_solid, width=1)
// if emabear
// line.set_xy1(line_bearentry, x=bar_index, y=bearentryh)
// line.set_xy2(line_bearentry, x=bar_index, y=bearentryh)
// alert("EMA-bearish", alert.freq_once_per_bar_close)
// line.set_x2(line_bearentry, x=bar_index)
// var line line_bearstop = line.new(bar_index, na, bar_index, na, color=color.rgb(250, 0, 0), style=line.style_solid, width=1)
// if emabear
// line.set_xy1(line_bearstop, x=bar_index, y=bearstop)
// line.set_xy2(line_bearstop, x=bar_index, y=bearstop)
// line.set_x2(line_bearstop, x=bar_index)
// var line line_beartarget = line.new(bar_index, na, bar_index, na, color=color.rgb(200, 100, 200), style=line.style_solid, width=1)
// if emabear
// line.set_xy1(line_beartarget, x=bar_index, y=beartarget)
// line.set_xy2(line_beartarget, x=bar_index, y=beartarget)
// line.set_x2(line_beartarget, x=bar_index)
//#endregion
//execution
if idealbuy
strategy.close("sell", comment=na)
strategy.entry("buy", strategy.long, limit=bullentryh, stop=bullstop, comment="buy")
strategy.exit("exit","buy", trail_points = low, trail_offset = 5, qty_percent=100, limit=bulltarget, stop=bullstop)
if idealsell
strategy.close("buy",comment=na)
strategy.entry("sell", strategy.short, limit=bearentryh, stop=bearstop, comment="sell")
strategy.exit("exit","sell", trail_points = low, trail_offset = 5, qty_percent=100, limit=beartarget, stop=bearstop)
// strategy.close_all(time == close_day)
//#region // graphical analysis
//Plots
plotshape(emabull, location=location.belowbar, title='emabull')
plotshape(idealbuy, style=shape.circle, color=color.green, title="bull close")
plotshape(emabear, title='emabear')
plotshape(idealsell, location=location.belowbar, style=shape.circle, color=color.red, title="bear close")
// //Dashboard
// var label id = na
// label.delete(id) // Delete last label
// i_offsetLabel = input(15, "Data Dashboard Offset")
// offset = i_offsetLabel * (time - time[1])
// dynamicText = "= Bull Setup ="
// id := label.new(x=time + offset, y=open, xloc=xloc.bar_time, text=dynamicText, color=color.rgb(255, 255, 255), size=size.normal)
// label.set_textcolor(id, color.rgb(0, 0, 0))
// label.set_text(id=id, text=dynamicText)
// label.set_textalign(id, text.align_left)
// label.set_text(id=id, text=dynamicText)
// f_round( _val, _decimals) =>
// _p = math.pow(10, _decimals)
// math.round(math.abs(_val) * _p) / _p * math.sign(_val)
// dynamicText := dynamicText + "\n" + str.tostring(f_round(bulltarget,2)) + " :Target"
// label.set_text(id=id, text=dynamicText)
// dynamicText := dynamicText + "\n" + str.tostring(f_round(bullentryh,2)) + " :Entry"
// label.set_text(id=id, text=dynamicText)
// dynamicText := dynamicText + "\n" + str.tostring(f_round(bullstop,2)) + " :Stop"
// label.set_text(id=id, text=dynamicText)
// dynamicText := dynamicText + "\n"
// label.set_text(id=id, text=dynamicText)
// dynamicText := dynamicText + "\n" + "= Bear Setup ="
// label.set_text(id=id, text=dynamicText)
// dynamicText := dynamicText + "\n" + str.tostring(f_round(bearstop,2)) + " :Stop"
// label.set_text(id=id, text=dynamicText)
// dynamicText := dynamicText + "\n" + str.tostring(f_round(bearentryh,2)) + " :Entry"
// label.set_text(id=id, text=dynamicText)
// dynamicText := dynamicText + "\n" + str.tostring(f_round(beartarget,2)) + " :Target"
// label.set_text(id=id, text=dynamicText)
// //#endregion