
یہ حکمت عملی MACD اشارے کی دوہری مساوی لائن کراسنگ کا حساب کرکے خرید اور فروخت کا وقت طے کرتی ہے۔ یہ چارٹ پر تیر کی شکل میں ڈرائنگ کرتا ہے تاکہ ٹریڈنگ سگنل کو اشارہ کیا جاسکے۔
یہ حکمت عملی سب سے پہلے فوری لائن (ای ایم اے 12 ایڈیشن) ، سست لائن (ای ایم اے 26 ایڈیشن) اور MACD فرق کا حساب لگاتی ہے۔ اس کے بعد فوری لائن اور سست لائن کے گولڈ فورک اور MACD فرق کے مثبت اور منفی پر مبنی خرید و فروخت کے وقت کا تعین کرتی ہے۔
جعلی سگنل کو فلٹر کرنے کے لئے ، کوڈ میں پچھلے K لائن کی سگنل کی صورتحال کا بھی فیصلہ کیا گیا ہے۔ موجودہ سگنل صرف اس وقت متحرک کیا جائے گا جب موجودہ K لائن الٹا سگنل ہے ((خریدنے کو فروخت میں تبدیل کیا گیا ہے یا فروخت کو خریدنے میں تبدیل کیا گیا ہے) ۔
اس کے علاوہ، اس کوڈ میں K لائن پر خرید و فروخت کے اوقات کے بارے میں اشارہ کرنے کے لئے ایک تیر کا گرافک بھی تیار کیا گیا ہے۔
یہ حکمت عملی مندرجہ ذیل فوائد رکھتی ہے:
اس حکمت عملی کے کچھ خطرات بھی ہیں:
اس حکمت عملی کو مندرجہ ذیل طریقوں سے بہتر بنایا جاسکتا ہے:
یہ دوہری یکساں کراس تیر حکمت عملی مجموعی طور پر نسبتا simple آسان اور عملی ہے ، دوہری یکساں کراس فیصلے اور MACD فرق فلٹرنگ کے ذریعہ ، وسط لمبی لائن رجحان میں خرید و فروخت کے مقامات کی شناخت کی جاسکتی ہے ، قیمتوں میں ہونے والی تبدیلیوں سے بچنے سے بچنے کے لئے۔ تیر اشارے بھی آپریشن کو زیادہ واضح اور واضح بناتے ہیں۔ بعد میں پیرامیٹرز کو بہتر بنانے ، فلٹرنگ کے حالات میں اضافہ کرنے وغیرہ کے ذریعہ حکمت عملی کی استحکام اور منافع کو مزید بڑھا سکتے ہیں۔
/*backtest
start: 2022-11-14 00:00:00
end: 2023-11-20 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
//Daniels stolen code
strategy(shorttitle="Daniels Stolen Code", title="Daniels Stolen Code", overlay=true, calc_on_order_fills=true, pyramiding=0)
//Define MACD Variables
fast = 12, slow = 26
fastMACD = ema(hlc3, fast)
slowMACD = ema(hlc3, slow)
macd = fastMACD - slowMACD
signal = sma(macd, 9)
hist = macd - signal
currMacd = hist[0]
prevMacd = hist[1]
currPrice = hl2[0]
prevPrice = hl2[1]
buy = currPrice > prevPrice and currMacd > prevMacd
sell = currPrice < prevPrice and currMacd < prevMacd
neutral = (currPrice < prevPrice and currMacd > prevMacd) or (currPrice > prevPrice and currMacd < prevMacd)
//Plot Arrows
timetobuy = buy==1 and (sell[1]==1 or (neutral[1]==1 and sell[2]==1) or (neutral[1]==1 and neutral[2]==1 and sell[3]==1) or (neutral[1]==1 and neutral[2]==1 and neutral[3]==1 and sell[4]==1) or (neutral[1]==1 and neutral[2]==1 and neutral[3]==1 and neutral[4]==1 and sell[5]==1) or (neutral[1]==1 and neutral[2]==1 and neutral[3]==1 and neutral[4]==1 and neutral[5]==1 and sell[6]==1))
timetosell = sell==1 and (buy[1]==1 or (neutral[1]==1 and buy[2]==1) or (neutral[1]==1 and neutral[2]==1 and buy[3]==1) or (neutral[1]==1 and neutral[2]==1 and neutral[3]==1 and buy[4]==1) or (neutral[1]==1 and neutral[2]==1 and neutral[3]==1 and neutral[4]==1 and buy[5]==1) or (neutral[1]==1 and neutral[2]==1 and neutral[3]==1 and neutral[4]==1 and neutral[5]==1 and buy[6]==1))
plotshape(timetobuy, color=blue, location=location.belowbar, style=shape.arrowup)
plotshape(timetosell, color=red, location=location.abovebar, style=shape.arrowdown)
//plotshape(neutral, color=black, location=location.belowbar, style=shape.circle)
//Test Strategy
// strategy.entry("long", true, 1, when = timetobuy and time > timestamp(2017, 01, 01, 01, 01)) // buy by market if current open great then previous high
// strategy.close("long", when = timetosell and time > timestamp(2017, 01, 01, 01, 01))
strategy.order("buy", true, 1, when=timetobuy==1 and time > timestamp(2019, 01, 01, 01, 01))
strategy.order("sell", false, 1, when=timetosell==1 and time > timestamp(2019, 01, 01, 01, 01))
// strategy.entry(id = "Short", long = false, when = enterShort())
// strategy.close(id = "Short", when = exitShort())
//strategy.entry("long", true, 1, when = open > high[1]) // enter long by market if current open great then previous high
// strategy.exit("exit", "long", profit = 10, loss = 5) // ge