اتار چڑھاؤ کی شرح کو دبانے کی حکمت عملی ایک ایسا تجارتی نظام ہے جو بولنگر بینڈ (BB) اور کیلٹنر چینل (Keltner Channel, KC) کو یکجا کرتا ہے۔ اس کا مقصد مارکیٹ میں اہم حرکت کو پکڑنا ہے جس میں قیمتوں میں اضافے اور رجحان کے اشارے کی نگرانی کی جاتی ہے۔ حکمت عملی مارکیٹ میں دباؤ کی مدت (کم اتار چڑھاؤ) اور اس کے نتیجے میں ہونے والی توڑ (اعلی اتار چڑھاؤ) پر توجہ مرکوز کرتی ہے ، جس میں بڑے پیمانے پر قیمتوں کی نقل و حرکت شروع ہونے سے پہلے مارکیٹ میں داخل ہونے کی کوشش کی جاتی ہے۔
اتار چڑھاؤ کی دباؤ توڑنے کی حکمت عملی کا مرکز مارکیٹ میں اتار چڑھاؤ کی کمی اور اضافے کی نشاندہی کرنا ہے۔ برن بینڈ قیمتوں کے معیاری انحراف کا حساب کتاب کرکے تشکیل دیا جاتا ہے ، جبکہ کیلٹنر چینل اوسطا حقیقی رینج پر مبنی ہوتا ہے۔ جب برن بینڈ کیلٹنر چینل کے اندر دباؤ ڈالتا ہے تو ، اس سے یہ ظاہر ہوتا ہے کہ مارکیٹ میں اتار چڑھاؤ کی شرح میں کمی ، ایک بڑے پیمانے پر قیمت کا بریک ہوسکتا ہے۔ حکمت عملی تجارت کے سگنل کو جانچنے کے ذریعہ جاری کرتی ہے کہ کیا برن بینڈ کیلٹنر چینل کے اندر ہے ، اور کیا قیمت برن بینڈ کے اوپری یا نچلے حصے کو توڑ رہی ہے۔ اس کے علاوہ ، حکمت عملی نے اشارے کی حرکت پذیری اوسط (ای ایم اے) کی رجحانات کی ترتیب کو بھی مدنظر رکھا ہے تاکہ سگنل کی تاثیر کو بڑھا سکے۔
اس حکمت عملی کا بنیادی فائدہ یہ ہے کہ یہ اتار چڑھاؤ کے اشارے اور رجحان اشارے کے ساتھ مل کر ایک جامع مارکیٹ نقطہ نظر فراہم کرتا ہے۔ بلین بینڈ اور کیلٹنر چینل کے مجموعہ کے ذریعہ ، حکمت عملی ممکنہ بڑے پیمانے پر مارکیٹ کی نقل و حرکت کو مؤثر طریقے سے شناخت کرنے کے قابل ہے۔ اس کے علاوہ ، ای ایم اے ٹرینڈ صف بندی کا استعمال مارکیٹ کی سمت کی تصدیق میں مدد کرسکتا ہے اور غلط سگنل کو کم کرسکتا ہے۔
اتار چڑھاؤ کی دباؤ توڑنے کی حکمت عملی کا بنیادی خطرہ جھوٹے توڑنے والے سگنل اور مارکیٹ کی غیر یقینی صورتحال ہے۔ مارکیٹ کی اعلی اتار چڑھاؤ کی حالت میں ، برن بینڈ کو کثرت سے توڑ دیا جاسکتا ہے ، جس سے گمراہ کن سگنل پیدا ہوتے ہیں۔ اس کے علاوہ ، اگر مارکیٹ کے رجحانات کو صحیح طریقے سے طے نہیں کیا جاتا ہے تو ، حکمت عملی سے غیر موزوں تجارت پیدا ہوسکتی ہے۔ ان خطرات کو کم کرنے کے لئے ، پیرامیٹرز کو ایڈجسٹ کرکے ، دوسرے اشارے کے ساتھ مل کر ، یا سخت شرائط کو اپنانے کے ذریعے داخلے کی حکمت عملی کو بہتر بنایا جاسکتا ہے۔
اس حکمت عملی کو کئی طریقوں سے بہتر بنایا جاسکتا ہے۔ پہلے ، مختلف مارکیٹ کے حالات کے مطابق بلینز اور کیلٹنر چینلز کے پیرامیٹرز کو ایڈجسٹ کرکے۔ دوسرا ، دیگر تکنیکی اشارے متعارف کروائے جاسکتے ہیں ، جیسے نسبتا weak مضبوط اشاریہ ((RSI) یا متحرک اوسط اختتامی پھیلاؤ ((MACD) ، اضافی تجارتی تصدیق کے اشارے فراہم کرنے کے لئے۔ آخر میں ، اس حکمت عملی کو دیگر قسم کے تجارتی نظاموں کے ساتھ جوڑنے پر غور کیا جاسکتا ہے تاکہ ایک زیادہ جامع اور متنوع تجارتی فریم ورک تشکیل دیا جاسکے۔
اتار چڑھاؤ کی دباؤ توڑنے کی حکمت عملی ایک طاقتور اور لچکدار تجارتی نظام ہے جس میں برن بینڈ اور کیلٹنر چینلز کی خوبیوں کو شامل کیا گیا ہے۔ مارکیٹ میں اتار چڑھاؤ اور رجحان کے اشارے کی نگرانی کرکے ، یہ بڑے پیمانے پر مارکیٹ میں نقل و حرکت کی مؤثر طریقے سے شناخت کرنے کے قابل ہے۔ اگرچہ حکمت عملی میں کچھ خطرہ ہے ، لیکن مناسب اصلاح اور پیرامیٹرز کی ایڈجسٹمنٹ کے ذریعہ اس کی کارکردگی اور درستگی میں بہتری آسکتی ہے۔ مجموعی طور پر ، یہ حکمت عملی مارکیٹ کے اہم رجحانات اور توڑ کو پکڑنے اور ان کا فائدہ اٹھانے کے لئے ایک انوکھا نقطہ نظر فراہم کرتی ہے۔
/*backtest
start: 2023-01-01 00:00:00
end: 2023-11-09 00:00:00
period: 1h
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/
// © Bishnu103
//@version=4
strategy(title="Squeeze Breakout using BB and KC [v1.0][Bishnu103]",shorttitle="BB BREAKOUT",overlay=true,calc_on_every_tick=true)
// ***********************************************************************************************************************
// input variables
bbLength = input(title="BB Length", minval=1, defval=20)
bbStdDev = input(title="BB StdDev", minval=1, defval=2)
kcLength = input(title="KC Length", minval=1, defval=20)
kcMult = input(title="KC Mult", defval=1.5)
atrLength = input(title="ATR Length", minval=1, defval=20)
entry_distance = input(title="Entry distance from alert", minval=1, maxval=10, defval=10)
bb_squeeze_switch = input(title="BB Squeeze Check", type=input.bool, defval=true)
bb_squeeze_width = input(title="BB Squeeze Width", minval=1.0, defval=3.0)
bb_in_kc_switch = input(title="BB within KC Check", type=input.bool, defval=false)
ema_trend_switch = input(title="EMA Trend Check", type=input.bool, defval=false)
show_bb_switch = input(title="Show BB", type=input.bool, defval=true)
show_kc_switch = input(title="Show KC", type=input.bool, defval=true)
show_8ema_switch = input(title="Show 8EMA", type=input.bool, defval=true)
show_emas_switch = input(title="Show EMAs", type=input.bool, defval=false)
// ***********************************************************************************************************************
// global variables
closed_above_bb = false
closed_below_bb = false
// variable values available across candles
var entry_price = 0.0
var sl_price = 0.0
var exit_price_8ema = 0.0
var candle_count = 0
// ***********************************************************************************************************************
// function to return bollinger band values based on candle poition passed
getBB(pos) =>
float basis = sma(close[pos], bbLength)
float dev = bbStdDev * stdev(close[pos], bbLength)
[basis, basis + dev, basis - dev]
// function to return Keltner Channel values based on candle poition passed
getKC(pos) =>
mKC = ema(close[pos],kcLength)
range = kcMult * atr(atrLength)[pos]
uKC = mKC + range
lKC = mKC - range
[mKC,uKC,lKC]
// ***********************************************************************************************************************
// strategy
//
// get current bb value
[mBB_0,uBB_0,lBB_0] = getBB(0)
[mBB_1,uBB_1,lBB_1] = getBB(1)
// if a candle closes above bb and previous candle closed inside bb then it's a bullish signal
if close[0] > uBB_0
closed_above_bb := true
entry_price := high[0]
// if a candle closes above bb and previous candle closed inside bb then it's a bullish signal
if close[0] < lBB_0
closed_below_bb := true
entry_price := low[0]
// check if BB is in squeeze
bb_in_squeeze = bb_squeeze_switch ? ((uBB_1 - lBB_1) < (atr(20)[1] * bb_squeeze_width)) : true
// 6 candle's bb prior to the alert candle, are within keltner channel on either upper side of the bands or on lower side of the bands
// bb
[mBB_2,uBB_2,lBB_2] = getBB(2)
[mBB_3,uBB_3,lBB_3] = getBB(3)
[mBB_4,uBB_4,lBB_4] = getBB(4)
[mBB_5,uBB_5,lBB_5] = getBB(5)
[mBB_6,uBB_6,lBB_6] = getBB(6)
// kc
[mKC_1,uKC_1,lKC_1] = getKC(1)
[mKC_2,uKC_2,lKC_2] = getKC(2)
[mKC_3,uKC_3,lKC_3] = getKC(3)
[mKC_4,uKC_4,lKC_4] = getKC(4)
[mKC_5,uKC_5,lKC_5] = getKC(5)
[mKC_6,uKC_6,lKC_6] = getKC(6)
// check if either side 6 candle's bb are inside kc
lower_squeeze_is_good = uBB_1 < uKC_1 and uBB_2 < uKC_2 and uBB_3 < uKC_3 and uBB_4 < uKC_4 and uBB_5 < uKC_5 and uBB_6 < uKC_6
upper_squeeze_is_good = lBB_1 > lKC_1 and lBB_2 > lKC_2 and lBB_3 > lKC_3 and lBB_4 > lKC_4 and lBB_5 > lKC_5 and lBB_6 > lKC_6
squeeze_is_good = bb_in_kc_switch ? (upper_squeeze_is_good or lower_squeeze_is_good) : true
// EMAs (8, 21, 34, 55, 89) should be aligned in sequence
ema_8 = ema(close,8)
ema_21 = ema(close,21)
ema_34 = ema(close,34)
ema_55 = ema(close,55)
ema_89 = ema(close,89)
ema_trend_check1 = ema_trend_switch and closed_above_bb and ema_8 > ema_21 and ema_21 > ema_34 and ema_34 > ema_55 and ema_55 > ema_89
ema_trend_check2 = ema_trend_switch and closed_below_bb and ema_8 < ema_21 and ema_21 < ema_34 and ema_34 < ema_55 and ema_55 < ema_89
ema_trend_check = ema_trend_switch ? (ema_trend_check1 or ema_trend_check2) : true
// ***********************************************************************************************************************
// entry conditions
long_entry = closed_above_bb and bb_in_squeeze and squeeze_is_good and ema_trend_check
short_entry = closed_below_bb and bb_in_squeeze and squeeze_is_good and ema_trend_check
candle_count := candle_count + 1
if long_entry or short_entry
candle_count := 0
if long_entry or short_entry
exit_price_8ema := na
if long_entry or short_entry
sl_price := mBB_0
// ***********************************************************************************************************************
// exit conditions
// long trade - a candle closes below 8ema and in next candle price crosses low of previous candle
// short trade - a candle closes above 8ema and in next candle price crosses high of previous candle
long_exit_8ema = strategy.position_size > 0 and crossunder(close,ema(close,8))
short_exit_8ema = strategy.position_size < 0 and crossover(close,ema(close,8))
if long_exit_8ema
exit_price_8ema := low
if short_exit_8ema
exit_price_8ema := high
// ***********************************************************************************************************************
// position sizing
price = if close[0] > 25000
25000
else
price = close[0]
qty = 25000/price
// ***********************************************************************************************************************
// entry
if long_entry
strategy.entry("BUY", strategy.long, qty, stop=entry_price, comment="BUY @ "+ tostring(entry_price))
if short_entry and candle_count < 11
strategy.entry("SELL", strategy.short, qty, stop=entry_price, comment="SELL @ "+ tostring(entry_price))
if candle_count > entry_distance
strategy.cancel("BUY",true)
strategy.cancel("SELL",true)
// ***********************************************************************************************************************
// exit
if strategy.position_size > 0 and long_exit_8ema
strategy.exit("EXIT using 8EMA", "BUY", stop=exit_price_8ema, comment="EXIT @ "+ tostring(exit_price_8ema))
if strategy.position_size < 0 and short_exit_8ema
strategy.exit("EXIT using 8EMA", "SELL", stop=exit_price_8ema, comment="EXIT @ "+ tostring(exit_price_8ema))
// ***********************************************************************************************************************
// plots
//
// plot BB
[mBBp,uBBp,lBBp] = getBB(0)
p_mBB = plot(show_bb_switch ? mBBp : na, color=color.teal)
p_uBB = plot(show_bb_switch ? uBBp : na, color=color.teal)
p_lBB = plot(show_bb_switch ? lBBp : na, color=color.teal)
fill(p_uBB,p_lBB,color=color.teal,transp=95)
// plot KC
[mKCp,uKCp,lKCp] = getKC(0)
p_uKC = plot(show_kc_switch ? uKCp : na, color=color.red)
p_lKC = plot(show_kc_switch ? lKCp : na, color=color.red)
// plot 8 ema
plot(show_8ema_switch?ema_8:na,color=color.blue)
// plot EMAs
plot(show_emas_switch ? ema_8 : na, color=color.green)
plot(show_emas_switch ? ema_21 : na, color=color.lime)
plot(show_emas_switch ? ema_34 : na, color=color.maroon)
plot(show_emas_switch ? ema_55 : na, color=color.orange)
plot(show_emas_switch ? ema_89 : na, color=color.purple)