একাধিক টাইম ফ্রেমগুলিতে নিশ্চিতকরণের সাথে ব্রেকআউট কৌশল

লেখক:চাওঝাং, তারিখ: ২০২৩-১২-১৫ ১২ঃ১৬ঃ৫৫
ট্যাগঃ

img

সারসংক্ষেপ

এই কৌশলটি 4 ঘন্টা এবং দৈনিক সময়সীমার ব্রেকআউট সংকেতগুলিকে একত্রিত করে এবং ট্রেডিং সংকেতগুলি প্রকাশের আগে ক্যান্ডেলস্টিকের নিদর্শনগুলি যাচাই করে, এইভাবে আরও নির্ভরযোগ্য ব্রেকআউট ট্রেডিং কৌশল বাস্তবায়ন করে।

কৌশলগত যুক্তি

ডুয়াল কনফার্মেশন ব্রেকআউট কৌশলটি স্বল্পমেয়াদী সময়সীমা এবং দীর্ঘ সময়সীমার ব্রেকআউট সংকেতগুলিকে একত্রিত করে এবং দীর্ঘমেয়াদী এবং স্বল্পমেয়াদী প্রবণতার মধ্যে ধারাবাহিকতা বিবেচনা করে আরও দক্ষ ব্রেকআউট পয়েন্টগুলি সনাক্ত করে। বিশেষত, এই কৌশলটি 4 ঘন্টা এবং দৈনিক সময়সীমার উভয় ক্ষেত্রেই চলমান গড় গণনা করে। ক্রয় সংকেত উত্পন্ন হয় যখন স্বল্পমেয়াদী এমএ দীর্ঘমেয়াদী এমএ অতিক্রম করে এবং বিক্রয় সংকেতের বিপরীতভাবে। এছাড়াও, এই কৌশলটি খারাপ মূল্য কর্মের সময় অবস্থান খোলার এড়াতে ট্রেডিং সংকেতগুলি জারি করার আগে বর্তমান বারটির মোমবাতি প্যাটার্নটিও যাচাই করে।

ডাবল কনফার্মেশন এবং ক্যান্ডেলস্টাইল ফিল্টারিংয়ের পদ্ধতির মাধ্যমে দীর্ঘ তরলীকরণ বা সংক্ষিপ্ত ফাঁদগুলির ঝুঁকি কার্যকরভাবে এড়ানো যায়, যার ফলে ট্রেডিং সিগন্যালের গুণমান উন্নত হয়।

সুবিধা বিশ্লেষণ

  1. ডাবল টাইমফ্রেম ব্রেকআউট সংকেত মান উন্নত করে। স্বল্পমেয়াদী এবং দীর্ঘমেয়াদী সময়সীমার সংমিশ্রণ সংকেতগুলিকে স্বল্পমেয়াদী প্রবণতা অনুসরণ করতে সক্ষম করে যখন এখনও দীর্ঘমেয়াদী প্রবণতা উল্লেখ করে।

  2. ক্যান্ডেলস্টিক প্যাটার্ন যাচাইকরণ মিথ্যা সংকেত এড়ায়। সংকেতগুলির আগে ক্যান্ডেলস্টিক প্যাটার্নটি যাচাই করা কিছু জাল বা বিচ্যুত ব্রেকআউট ফিল্টার করতে পারে এবং ক্ষতি প্রতিরোধ করতে পারে।

  3. স্বয়ংক্রিয় অপ্টিমাইজেশান নমনীয়তা প্রদান করে। এই কৌশলটির ব্রেকআউট পরামিতি এবং চক্রের পরামিতিগুলি ব্যবহারকারীদের বিভিন্ন ট্রেডিং পণ্য এবং বাজারের অবস্থার অনুযায়ী সর্বোত্তম পরামিতি সংমিশ্রণ নির্বাচন করার জন্য কাস্টমাইজযোগ্য।

ঝুঁকি বিশ্লেষণ

  1. ডুয়াল ব্রেকআউট কৌশলটি চরম মূল্য স্পাইকগুলির বিরুদ্ধে তুলনামূলকভাবে দুর্বল প্রবণতা অনুসরণ করার ক্ষমতা রাখে। যখন সংক্ষিপ্ত এবং দীর্ঘ সময়সীমার উভয় ক্ষেত্রেই একযোগে মারাত্মক মূল্য পদক্ষেপ ঘটে, তখন এই কৌশলটি অনুকূল প্রবেশের পয়েন্টটি মিস করতে পারে।

  2. মোমবাতি যাচাইকরণ প্রক্রিয়া কিছু সুযোগ মিস করতে পারে। চরম বাজারের পরিস্থিতিতে, মোমবাতি প্রায়শই বিকৃতি প্রদর্শন করে এবং যাচাইকরণ প্রক্রিয়া কৌশলটিকে আরও রক্ষণশীল করে তোলে, যার ফলে কিছু সুযোগ হারাতে পারে।

  3. ভুল প্যারামিটার সেটিংগুলিও মিথ্যা সংকেত তৈরি করতে পারে। ব্যবহারকারীদের নির্দিষ্ট পণ্যের উপর ভিত্তি করে দ্বৈত ব্রেকআউট এবং ক্যান্ডেলস্টিক উপাদানগুলির জন্য উপযুক্ত প্যারামিটারগুলি নির্বাচন করতে হবে, অন্যথায় কৌশলটির কার্যকারিতা হ্রাস পাবে।

এই ঝুঁকিগুলি মোকাবেলা করার জন্য, উন্নত ও অপ্টিমাইজেশনের জন্য প্যারামিটার টিউনিং, স্টপ লস / লাভ সেটিংয়ের মতো পদ্ধতি গ্রহণ করা যেতে পারে।

অপ্টিমাইজেশান নির্দেশাবলী

  1. উদাহরণস্বরূপ, বিবি সংকুচিত হওয়ার সময় প্রকাশিত ব্রেকআউট সংকেতগুলি উচ্চতর মানের হয়।

  2. স্টপ লস/লাভ মডিউল যোগ করুন। সঠিক কনফিগারেশন লাভ লক করতে সাহায্য করে এবং সক্রিয়ভাবে ক্ষতি কাটা।

  3. ডুয়াল ব্রেকআউট প্যারামিটারগুলি অপ্টিমাইজ করুন। প্যারামিটারগুলি পণ্যের বৈশিষ্ট্য যেমন ইনট্রা-ডে এবং দৈনিক অস্থিরতার উপর নির্ভর করে সামঞ্জস্য করা যেতে পারে।

  4. কে লাইন যাচাইকরণ পরামিতিগুলি অপ্টিমাইজ করুন। কে লাইন যাচাইকরণের জন্য চক্র এবং পরামিতিগুলির বিভিন্ন সংমিশ্রণ আরও স্থিতিশীল ফলাফল দিতে পারে।

সিদ্ধান্ত

দ্বৈত নিশ্চিতকরণ ব্রেকআউট কৌশলটি দ্বৈত সময়সীমা এবং কে লাইন যাচাইকরণ প্রক্রিয়াগুলিকে একত্রিত করে মূলধন দক্ষতা এবং সংকেত মানের মধ্যে একটি দক্ষ ভারসাম্য স্থাপন করে, এটি একটি প্রস্তাবিত স্বল্পমেয়াদী ব্রেকআউট কৌশল করে তোলে। ব্যবহারকারীরা আরও ভাল ফলাফলের জন্য তাদের নিজস্ব প্রয়োজন অনুযায়ী প্রাসঙ্গিক পরামিতিগুলি সামঞ্জস্য করতে পারে।


/*backtest
start: 2023-11-14 00:00:00
end: 2023-12-14 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
strategy("breakout ", overlay=true)
tim=input('1440')
sim=input('370')

out1 = request.security(syminfo.tickerid, tim, open)
out2 = request.security(syminfo.tickerid, sim, close)
plot(out1,color=red)
plot(out2,color=green)

length = input(20, title="BB Length")
mult = input(2.0,title="BB MultFactor")
lengthKC=input(20, title="KC Length")
multKC = input(1.5, title="KC MultFactor")

useTrueRange = input(true, title="Use TrueRange (KC)", type=bool)

// Calculate BB
source = close
basis = sma(source, length)
dev = multKC * stdev(source, length)
upperBB = basis + dev
lowerBB = basis - dev

// Calculate KC
ma = sma(source, lengthKC)
range1 = useTrueRange ? tr : (high - low)
rangema = sma(range1, lengthKC)
upperKC = ma + rangema * multKC
lowerKC = ma - rangema * multKC

sqzOn  = (lowerBB > lowerKC) and (upperBB < upperKC)
sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC)
noSqz  = (sqzOn == false) and (sqzOff == false)

val = linreg(source  -  avg(avg(highest(high, lengthKC), lowest(low, lengthKC)),sma(close,lengthKC)),lengthKC,0)

bcolor = iff( val > 0,iff( val > nz(val[1]), lime, green),iff( val < nz(val[1]), red, maroon))
scolor = noSqz ? blue : sqzOn ? black : gray 
//plot(val, color=bcolor, style=histogram, linewidth=4)
//plot(0, color=scolor, style=cross, linewidth=2)

// this section based on Almost Zero Lag EMA [LazyBear]
// Fast MA - type, length
matype   = input(defval="HullMA", title="Fast MA Type: SMA, EMA, WMA, VWMA, SMMA, DEMA, TEMA, HullMA, TMA, ZEMA ( case sensitive )")
malength = input(defval=20, title="Moving Average Length", minval=1)
src      = input(close,title="Moving average Source")

// Returns MA input selection variant, default to SMA if blank or typo.
variant(type, src, len) =>
    v1 = sma(src, len)                                                  // Simple
    v2 = ema(src, len)                                                  // Exponential
    v3 = wma(src, len)                                                  // Weighted
    v4 = vwma(src, len)                                                 // Volume Weighted
    v5 = na(v5[1]) ? sma(src, len) : (v5[1] * (len - 1) + src) / len    // Smoothed
    v6 = 2 * v2 - ema(v2, len)                                          // Double Exponential
    v7 = 3 * (v2 - ema(v2, len)) + ema(ema(v2, len), len)               // Triple Exponential
    v8 = wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))   // Hull
    ema1 = ema(src, len)
    ema2 = ema(ema1, len)
    v10 = ema1+(ema1-ema2)                                              // Zero Lag Exponential
    v11 = sma(sma(src,len),len)                                         // Trianglular
    // return variant, defaults to SMA if input invalid.
    type=="EMA"?v2 : type=="WMA"?v3 : type=="VWMA"?v4 : type=="SMMA"?v5 : type=="DEMA"?v6 : type=="TEMA"?v7 : type=="HullMA"?v8 : type=="ZEMA"?v10 : type=="TMA"?v11 : v1

// Calculate selected MA and get direction of trend from it.
zlema= variant(matype,src,malength)
col =  zlema > zlema[1] ? green : red
up = zlema > zlema[1] ? 1 : 0
down = zlema < zlema[1] ? 1 : 0
//plot(zlema,color=col, style=line, linewidth=4, transp=0)


// Find all Fractals.
// This section based on [RS]Fractal Levels  by RicardoSantos
hidefractals = input(false)
hidelevels = input(false)
topfractal = high[2] > high[1] and high[2] > high and high[2] > high[3] and high[2] > high[4]
botfractal = low[2] < low[1] and low[2] < low and low[2] < low[3] and low[2] < low[4]

//plotshape(hidefractals ? na : topfractal, color=green, transp=0, style=shape.triangleup, location=location.abovebar, offset=-2, size=size.tiny)
//plotshape(hidefractals ? na : botfractal, color=red, transp=0, style=shape.triangledown, location=location.belowbar, offset=-2, size=size.tiny)

topfractals = topfractal ? high[2] : topfractals[1]
botfractals = botfractal ? low[2] : botfractals[1]

topfcolor = topfractals != topfractals[1] ? na : green
botfcolor = botfractals != botfractals[1] ? na : red

//plot(hidelevels ? na : topfractals, color=topfcolor, transp=0, linewidth=2)
//plot(hidelevels ? na : botfractals, color=botfcolor, transp=0, linewidth=2)

//
// This section based on Candlestick Patterns With EMA by rmwaddelljr
//
ufb  = input(false, title="Use Fractal S/R Cross Patterns")
udc  = input(true, title="Use Dark Cloud Cover Patterns" )
upl  = input(true, title="Use Piecing Line Patterns" )
ube  = input(true, title="Use Engulfing Candle Patterns" )
ubh  = input(true, title="Use Harami Candle Patterns" )
upb  = input(true,  title="Use Defined PinBar Patterns")
pctP = input(66, minval=1, maxval=99, title="Directional PBars, % of Range of Candle the Long Wick Has To Be")
// This section based on CM_Price-Action-Bars by ChrisMoody
// Change the pin bar calculation, so can be used for market direction.
urpb= input(false, title="Use CM Price Action Reversal Pin Bars")
usb = input(false, title="Use CM Price Action Shaved Bars")
uob = input(false, title="Use CM Price Action Outside Bars")
uib = input(false, title="Use CM Price Action Inside Bars")
pctRP = input(72, minval=1, maxval=99, title="CM Reversal PBars, % of Range of Candle the Long Wick Has To Be")
pctS = input(5, minval=1, maxval=99, title="CM Shaved Bars, % of Range it Has To Close On The Lows or Highs")
pblb =input(6,minval=1,title="CM Reversal Pin Bar Lookback Length")
//
stnd = input(true, title="Alert Only Patterns Following Trend")
//
// Get MACD for Alert Filtering
umacd  = input(true,title="Alert Only Patterns Confirmed by MACD")
fastMA = input(title="MACD Fast MA Length",  defval = 12, minval = 2)
slowMA = input(title="MACD Slow MA Length",  defval = 26, minval = 7)
signal = input(title="MACD Signal Length",defval=9,minval=1)

//
sgb = input(false, title="Check Box To Turn Bars Gray")
salc = input(true, title="Show Alert condition Dot")
//
[currMacd,_,_] = macd(close[0], fastMA, slowMA, signal)
[prevMacd,_,_] = macd(close[1], fastMA, slowMA, signal)
plotColor = currMacd > 0 ? currMacd > prevMacd ? green : red : currMacd < prevMacd ? red : green

// Show alert on this bar?
sbarUp = (not umacd or plotColor == green) and (not stnd or up)
sbarDn = (not umacd or plotColor == red) and (not stnd or down)

//PBar Percentages
pctCp = pctP * .01

//Shaved Bars Percentages
pctCs = pctS * .01
pctSPO = pctCs
//ma50 = sma(close,50)

range = high - low

///Reversal PinBars
pctCRp = pctRP * .01
pctCRPO = 1 - pctCRp
//
//pBarRUp= upb and open<close and open > high - (range * pctCRPO) and close > high - (range * pctCRPO) and low <= lowest(pblb) ? 1 : 0
//pBarRDn = upb and open>close and open < high - (range *  pctCRp) and close < high-(range * pctCRp) and high >= highest(pblb) ? 1 : 0
pBarRUp = urpb and  open > high - (range * pctCRPO) and close > high - (range * pctCRPO) and low <= lowest(pblb) ? 1 : 0
pBarRDn = urpb and  open < high - (range *  pctCRp) and close < high-(range * pctCRp) and high >= highest(pblb) ? 1 : 0

//Shaved Bars filter to the MA50 line
sBarUp   = usb and (close >= (high - (range * pctCs))) // and close>ma50 
sBarDown = usb and (close <= (low + (range * pctCs)))  // and close<ma50

//Inside Bars
insideBarUp = uib and (high < high[1] and low > low[1])
insideBarDn = uib and (high < high[1] and low > low[1])
outsideBarUp= uob and (high > high[1] and low < low[1])
outsideBarDn= uob and (high > high[1] and low < low[1])

// PinBars representing possible change in trend direction
barcolor(pBarRUp ? green : na)
barcolor(pBarRDn ? red : na)

//Shaved Bars
barcolor(sBarDown ? fuchsia : na)
barcolor(sBarUp   ? aqua : na)

//Inside and Outside Bars
barcolor((insideBarUp or insideBarDn)? yellow : na )
barcolor((outsideBarUp or outsideBarDn) ? orange : na )


//Long shadow PinBars supporting market direction
///PinBars Long Upper Shadow represent selling pressure
pBarDn = upb and open < high - (range * pctCp) and close < high - (range * pctCp)
//plotshape(pBarDn and (not pBarRUp and not pBarRDn), title= "Bearish Pin Bar",  color=red, style=shape.arrowdown, text="Bearish\nPinBar")
///PinBars with Long Lower Shadow represent buying pressure
pBarUp = upb and open > low + (range * pctCp) and close > low + (range * pctCp)
//plotshape(pBarUp and (not pBarRUp and not pBarRDn),  title= "Bullish Pin Bar", location=location.belowbar, color=green, style=shape.arrowup, text="Bullish\nPinBar")

dcc = udc and (close[1]>open[1] and abs(close[1]-open[1])/range[1]>=0.7 and close<open and abs(close-open)/range>=0.7 and open>=close[1] and close>open[1] and close<((open[1]+close[1])/2))
//plotshape(dcc, title="Dark Cloud Cover",text='DarkCloud\nCover',color=red, style=shape.arrowdown,location=location.abovebar)
ts = timestamp(2021,8,1,8,18)
pln= upl and (close[1]<open[1] and abs(open[1]-close[1])/range[1]>=0.7 and close>open and abs(close-open)/range>=0.7 and open<=close[1] and close<open[1] and close>((open[1]+close[1])/2))
//plotshape(pln, title="Piercieng Line",text="Piercing\nLine",color=green, style=shape.arrowup,location=location.belowbar)

beh = ubh and (close[1] > open[1] and open > close and open <= close[1] and low >= open[1] and open - close < close[1] - open[1] and (high < high[1] and low > low[1]))
//plotshape(beh and not dcc, title= "Bearish Harami",  color=red, style=shape.arrowdown, text="Bear\nHarami")

blh = ubh and (open[1] > close[1] and close > open and close <= open[1] and high <= open[1] and close - open < open[1] - close[1] and (high < high[1] and low > low[1]))
//plotshape(blh and not pln,  title= "Bullish Harami", location=location.belowbar, color=green, style=shape.arrowup, text="Bull\nHarami")

bee = ube and (close[1] > open[1] and close < open and close<=low[1] and open>= close[1])
//plotshape(bee,  title= "Bearish Engulfing", color=red, style=shape.arrowdown, text="Bearish\nEngulf")

ble = ube and (close[1] < open[1] and close > open and close >= high[1] and open<=close[1])
//plotshape(ble, title= "Bullish Engulfing", location=location.belowbar, color=green, style=shape.arrowup, text="Bullish\nEngulf")

blfr = ufb and crossover(close,topfractals)
//plotshape(blfr and not ble and not blh and not sBarUp, title= "Bullish Fractal Cross", location=location.belowbar, color=green, style=shape.arrowup, text="Fractal\nCross")
befr = ufb and crossunder(close,botfractals) 
//plotshape(befr and not bee and not beh and not sBarDown,  title= "Bearish Fractal Cross", color=red, style=shape.arrowdown, text="Fractal\nCross")
//
//
bcolorDn = sbarDn and not(pBarRDn or pBarRUp or sBarDown or insideBarDn or outsideBarDn) and (beh or bee or dcc or befr or pBarDn)
bcolorUp = sbarUp and not(pBarRDn or pBarRUp or sBarUp or insideBarUp or outsideBarUp) and (blh or ble or pln or blfr or pBarUp)
barcolor(bcolorDn ? maroon : na)
barcolor(bcolorUp ? lime : na)
//
barcolor(sgb and close ? gray : na)

bullcnd = pBarUp or pln or blh or ble or blfr
bearcnd = pBarDn or dcc or beh or bee or befr
if(true )
    longCondition = crossover(out2,out1)
    if(longCondition or close > out1 and bullcnd and strategy.position_size == 0)
        strategy.entry("long", strategy.long)
    
    //if (pBarRUp) // and bullcnd) //and strategy.position_size == 0)
    //    strategy.entry("long", strategy.long)
        
    shortCondition = crossunder(out2,out1)
    if (shortCondition or close < out1 and bearcnd and strategy.position_size == 0)
        strategy.entry("short", strategy.short)

//
barAlertDn = (sbarDn and (befr or bee or beh or pBarDn  or dcc)) or (sbarDn and (insideBarDn or outsideBarDn or sBarDown)) or pBarRDn
barAlertUp = (sbarUp and (blfr or ble or blh or pBarUp  or pln)) or (sbarUp and (insideBarUp or outsideBarUp or sBarUp))  or pBarRUp
barAlert = barAlertDn or barAlertUp
alertcondition(barAlert,title="CDLTRD Alert", message="CDLTRD Bar Alert")
// show only when alert condition is met and bar closed.
//plotshape(salc and barAlert[1],title= "Alert Indicator Closed", location=location.bottom, color=barAlertDn[1]?red:green, transp=0, style=shape.circle,offset=-1)
//EOF


        
    //if (pBarRDn) //and bearcnd//and strategy.position_size == 0)
     //   strategy.entry("short", strategy.short)

//strategy.close("long", when = exit)        
//strategy.close("short", when = exit2)
    
    
//exit3 = sqzOn and sqzOn[1] and sqzOn[2] and sqzOn[3] and sqzOn[4] and sqzOn[5] and sqzOn[6]
//strategy.close("long", when = exit3)
//strategy.close("short", when = exit3)
    
    
//else
  //  alertcondition(condition = time > t, message = "Time exceeded")


আরো