
یہ حکمت عملی G چینل اشارے کا استعمال کرتے ہوئے مارکیٹ کے رجحان کی سمت کی شناخت کے لئے ، جبکہ EMA اور ATR اشارے کے ساتھ مل کر داخلے اور باہر نکلنے کے مقامات کو بہتر بنانے کے لئے استعمال کرتی ہے۔ حکمت عملی کا بنیادی نظریہ یہ ہے کہ: جب قیمت G چینل کو توڑنے اور EMA کے نچلے حصے پر زیادہ کام کرتی ہے تو ، G چینل کو توڑنے اور EMA کے اوپری حصے پر خالی ہوجاتی ہے۔ اس کے ساتھ ہی ، ATR کا استعمال کرتے ہوئے متحرک اسٹاپ اور اسٹاپ پوزیشن قائم کی جاتی ہے ، جس میں اسٹاپ نقصان 2xATR ہے اور اسٹاپ پوزیشن 4xATR ہے۔ اس طرح سے رجحان کی صورت حال میں زیادہ منافع حاصل کیا جاسکتا ہے ، جبکہ خطرے کو سختی سے کنٹرول کیا جاسکتا ہے۔
اس حکمت عملی نے جی چینل ، ای ایم اے ، اے ٹی آر اور دیگر اشارے کے ذریعہ ایک سادہ اور موثر رجحان سے باخبر رہنے کا تجارتی نظام تشکیل دیا ہے۔ یہ رجحان کے حالات میں اچھا اثر ڈال سکتا ہے ، لیکن یہ عام طور پر ہنگامہ خیز حالات میں کارکردگی کا مظاہرہ کرتا ہے۔ اس کے بعد حکمت عملی کو رجحان فلٹرنگ ، پیرامیٹرز کی اصلاح ، پوزیشن مینجمنٹ ، مجموعہ حکمت عملی وغیرہ سے بہتر بنایا جاسکتا ہے ، تاکہ حکمت عملی کی استحکام اور منافع بخش صلاحیت کو مزید بہتر بنایا جاسکے۔
/*backtest
start: 2024-05-01 00:00:00
end: 2024-05-31 23:59:59
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
// Full credit to AlexGrover: https://www.tradingview.com/script/fIvlS64B-G-Channels-Efficient-Calculation-Of-Upper-Lower-Extremities/
strategy ("G-Channel Trend Detection with EMA Strategy and ATR", shorttitle="G-Trend EMA ATR Strategy", overlay=true)
// Inputs for G-Channel
length = input(100, title="G-Channel Length")
src = input(close, title="Source")
// G-Channel Calculation
var float a = na
var float b = na
a := max(src, nz(a[1])) - (nz(a[1] - b[1]) / length)
b := min(src, nz(b[1])) + (nz(a[1] - b[1]) / length)
avg = (a + b) / 2
// G-Channel Signals
crossup = b[1] < close[1] and b > close
crossdn = a[1] < close[1] and a > close
bullish = barssince(crossdn) <= barssince(crossup)
c = bullish ? color.lime : color.red
// Plot G-Channel Average
p1 = plot(avg, "Average", color=c, linewidth=1, transp=90)
p2 = plot(close, "Close price", color=c, linewidth=1, transp=100)
fill(p1, p2, color=c, transp=90)
// Show Buy/Sell Labels
showcross = input(true, title="Show Buy/Sell Labels")
plotshape(showcross and not bullish and bullish[1] ? avg : na, location=location.absolute, style=shape.labeldown, color=color.red, size=size.tiny, text="Sell", textcolor=color.white, transp=0, offset=-1)
plotshape(showcross and bullish and not bullish[1] ? avg : na, location=location.absolute, style=shape.labelup, color=color.lime, size=size.tiny, text="Buy", textcolor=color.white, transp=0, offset=-1)
// Inputs for EMA
emaLength = input(50, title="EMA Length")
emaValue = ema(close, emaLength)
// Plot EMA
plot(emaValue, title="EMA", color=color.blue, linewidth=1)
// ATR Calculation
atrLength = input(14, title="ATR Length")
atrValue = atr(atrLength)
// Strategy Conditions
buyCondition = bullish and close < emaValue
sellCondition = not bullish and close > emaValue
// Stop Loss and Take Profit Levels
longStopLoss = close - 2 * atrValue
longTakeProfit = close + 4 * atrValue
shortStopLoss = close + 2 * atrValue
shortTakeProfit = close - 4 * atrValue
// Execute Strategy with ATR-based stop loss and take profit
if (buyCondition)
strategy.entry("Buy", strategy.long)
strategy.exit("Sell", "Buy", stop=longStopLoss, limit=longTakeProfit)
if (sellCondition)
strategy.entry("Sell", strategy.short)
strategy.exit("Cover", "Sell", stop=shortStopLoss, limit=shortTakeProfit)
// Plot Buy/Sell Signals on the chart
plotshape(series=buyCondition, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", offset=-1)
plotshape(series=sellCondition, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", offset=-1)