ब्रेकआउट बोलिंगर बैंड ट्रेडिंग रणनीति

लेखक:चाओझांग, दिनांक: 2023-10-07 09:59:11
टैगः

अवलोकन

यह रणनीति बोलिंगर बैंड्स के ब्रेकआउट का व्यापार करती है, जब कीमत पूरी तरह से ऊपरी या निचले बैंड को पार करती है तो काउंटर ट्रेंड पोजीशन लेती है। इसका उद्देश्य असामान्य अस्थिरता के बाद औसत प्रतिगमन को पकड़ना है। यह त्वरित लाभ की तलाश करने वाले सक्रिय व्यापारियों के लिए उपयुक्त है।

सिद्धांत

रणनीति वर्तमान अस्थिरता सीमा को परिभाषित करने के लिए बोलिंगर बैंड का उपयोग करती है। जब कीमत ऊपरी बैंड के ऊपर या निचले बैंड के नीचे एक पूर्ण मोमबत्ती का गठन करती है, तो यह एक अत्यधिक अस्थिर स्थिति और औसत की ओर संभावित उलट दिखाती है।

विशेष रूप से, मध्य, ऊपरी और निचले बैंड की गणना 20 अवधि के समापन कीमतों का उपयोग करके की जाती है। एक लंबा संकेत तब उत्पन्न होता है जब कीमत उच्च खोलने के बाद निचले बैंड से नीचे बंद हो जाती है। एक छोटा संकेत तब ट्रिगर किया जाता है जब कीमत कम खोलने के बाद ऊपरी बैंड से ऊपर बंद हो जाती है। ब्रेकआउट बिंदु स्टॉप लॉस के रूप में कार्य करता है और मध्य बैंड प्रारंभिक लाभ लक्ष्य है।

लाभ

इसके मुख्य लाभ इस प्रकार हैंः

  1. बोलिंगर बैंड्स विसंगतियों की पहचान करने के लिए बाजार की अस्थिरता को प्रभावी ढंग से मापते हैं।

  2. ब्रेकआउट बिंदु जोखिम को नियंत्रित करने के लिए एक स्पष्ट स्टॉप लॉस स्तर है।

  3. मध्य बैंड औसत प्रतिगमन के लिए एक समझदार लक्ष्य प्रदान करता है।

  4. पूर्ण मोमबत्तियाँ संकेत की अधिक विश्वसनीयता के साथ झूठे ब्रेक को फ़िल्टर करती हैं।

  5. सरल पैरामीटर कार्यान्वयन और अनुकूलन को आसान बनाते हैं।

  6. शुद्ध तर्क कोड में संक्षिप्त रूप से व्यक्त किया गया है।

जोखिम

कुछ जोखिमों में शामिल हैंः

  1. खराब बीबी मापदंड रणनीति को अमान्य कर सकते हैं।

  2. ब्रेकआउट प्रवृत्ति की शुरुआत का संकेत दे सकता है, समय से पहले बाहर निकलने का जोखिम।

  3. मध्य बैंड लक्ष्य बहुत रूढ़िवादी हो सकते हैं, लाभ को सीमित करते हैं।

  4. चौड़े ब्रेक पूरी तरह से नहीं भर सकते हैं, जिससे फिसलने का कारण बनता है।

  5. वाइप्सॉव से विभिन्न बाजारों में अत्यधिक व्यर्थ व्यापार हो सकता है।

सुधार

कुछ सुधार विचार:

  1. सेटिंग्स या आवृत्ति को समायोजित करने के लिए प्रवृत्ति शक्ति को मापें।

  2. प्रवेश समय को ठीक करने के लिए अन्य संकेतक जोड़ें।

  3. अस्थिरता के आधार पर स्टॉप लॉस को समायोजित करें।

  4. सुचारू लाभ के लिए प्रारंभिक लक्ष्यों का अनुकूलन करें।

  5. मिश्रित लाभ के लिए पुनः प्रवेश तंत्र लागू करें।

  6. खराब ट्रेडों से बचने के लिए ब्रेकआउट वैधता का आकलन करें।

निष्कर्ष

यह रणनीति सक्रिय व्यापारियों के अनुकूल अल्पकालिक लाभ के लिए बीबी ब्रेकआउट का व्यापार करती है। पेशेवर स्पष्ट जोखिम नियंत्रण हैं जबकि विपक्ष शुरुआती निकास और लाभ कैपिंग हैं। ठीक ट्यूनिंग मापदंड, फ़िल्टर आदि जोड़ने से प्रदर्शन में सुधार हो सकता है।


/*backtest
start: 2023-09-06 00:00:00
end: 2023-10-06 00:00:00
period: 3h
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="Full Candle Outside BB [v1.0][Bishnu103]",shorttitle="OUTSIDE BB",overlay=true,calc_on_every_tick=true,backtest_fill_limits_assumption=2)

// ***********************************************************************************************************************
// input variables
buy_session         = input(title="Buy Session", type=input.session, defval="0915-1430")
exit_inraday        = input(title="Exit Intraday?", type=input.bool, defval=true)
entry_distance      = input(title="Entry distance from alert", minval=1, maxval=10, defval=3)
show_bb_switch      = input(title="Show BB", type=input.bool, defval=true)
//
bbLength            = input(title="BB Length", minval=1, defval=20)
bbStdDev            = input(title="BB StdDev", minval=1, defval=2)

// ***********************************************************************************************************************
// global variables
long_entry          = false
short_entry         = false
long_exit           = false
short_exit          = false

// variable values available across candles
var entry_price     = 0.0  
var sl_price        = 0.0
var exit_price      = 0.0
var candle_count    = 0

// ***********************************************************************************************************************
// function to return bollinger band values based on candle poition passed 
getBB(pos) => [mBB, uBB, lBB] = bb(close[pos], bbLength, bbStdDev)

// function returns true if current time is within intraday byuing session set in input
BarInSession(sess) => time(timeframe.period, sess) != 0

// ***********************************************************************************************************************
// strategy
//
// get current bb value
[mBB_0,uBB_0,lBB_0] = getBB(0)

// check if full candle outside upper BB
outside_uBB = low > uBB_0 and close <= open
outside_lBB = high < lBB_0 and close >= open

// ***********************************************************************************************************************
// entry conditions 
long_entry   := outside_lBB
short_entry  := outside_uBB

// keep candle count since the alert generated so that order can be cancelled after N number of candle calling it out as invalid alert
candle_count := candle_count + 1
if long_entry or short_entry
    candle_count    := 0

// ***********************************************************************************************************************
// risk management
//
// decide entry and sl price
if long_entry
    entry_price := high
    
if short_entry
    entry_price := low
    
if long_entry
    sl_price    := low
    
if short_entry
    sl_price    := high

// first exit is when price hits middle BB, gets updated for each candle based on it's middle BB value
exit_price  := mBB_0

// ***********************************************************************************************************************
// position sizing
price = if close[0] > 25000
    25000
else
    price = close[0]

qty = 25000/price

// ***********************************************************************************************************************
// entry
//if long_entry and strategy.position_size == 0
//    strategy.entry("BUY", strategy.long, qty, stop=entry_price, comment="BUY @ "+ tostring(entry_price)) 
if long_entry and strategy.position_size == 0
    strategy.order("BUY", strategy.long, qty, stop=entry_price, comment="BUY @ "+ tostring(entry_price))

//if short_entry and strategy.position_size == 0
//    strategy.entry("SELL", strategy.short, qty, stop=entry_price, comment="SELL @ "+ tostring(entry_price))
if short_entry and strategy.position_size == 0
    strategy.order("SELL", strategy.short, qty, stop=entry_price, comment="SELL @ "+ tostring(entry_price))

// cancel an order if N number of candles are completed after alert candle
strategy.cancel_all(candle_count > entry_distance)

// if current time is outside byuing session then do not enter intraday trade
strategy.cancel_all(timeframe.isintraday and not BarInSession(buy_session))

// ***********************************************************************************************************************
// exit
if strategy.position_size > 0
    strategy.cancel("EXIT at MBB", true)
    strategy.cancel("EXIT at SL", true)
    strategy.order("EXIT at MBB", strategy.short, abs(strategy.position_size), limit=exit_price, comment="EXIT TG @ "+ tostring(exit_price))
    strategy.order("EXIT at SL", strategy.short, abs(strategy.position_size), stop=sl_price, comment="EXIT SL @ "+ tostring(sl_price))

if strategy.position_size < 0
    strategy.cancel("EXIT at MBB", true)
    strategy.cancel("EXIT at SL", true)
    strategy.order("EXIT at MBB", strategy.long, abs(strategy.position_size), limit=exit_price, comment="EXIT TG @ "+ tostring(exit_price))
    strategy.order("EXIT at SL", strategy.long, abs(strategy.position_size), stop=sl_price, comment="EXIT SL @ "+ tostring(sl_price))

// if intraday trade, close the trade at open of 15:15 candle //!!!!!!!!!!!!!!!!!!!!! TO BE CORRECTED !!!!!!!!!!!!!!!!!!!!!!!
if timeframe.isintraday and exit_inraday and hour == 15 and minute == 00
    strategy.close("BUY",  when=strategy.position_size > 0, qty=strategy.position_size, comment="EXIT @ "+ tostring(close))
    strategy.close("SELL", when=strategy.position_size < 0, qty=strategy.position_size, comment="EXIT @ "+ tostring(close))

// ***********************************************************************************************************************
// 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)

अधिक