সুপারট্রেন্ড গ্লোভিং কৌশল

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

img

সারসংক্ষেপ

সুপারট্রেন্ড এনগলফিং কৌশলটি একটি প্রবণতা অনুসরণকারী কৌশল যা গড় সত্য পরিসীমা (এটিআর), সুপারট্রেন্ড সূচক এবং গলফিং প্যাটার্নগুলিকে একত্রিত করে প্রবণতার দিকনির্দেশনা সনাক্ত করতে এবং গলফিং প্যাটার্নগুলি প্রবণতা নিশ্চিত করার সময় ভাল ঝুঁকি-প্রতিফলন অনুপাত প্রবেশের সুযোগগুলি খুঁজে পেতে।

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

কৌশলটি প্রথমে ATR এবং সুপারট্রেন্ড সূচক ব্যবহার করে বর্তমান বাজারের প্রবণতার দিকনির্দেশ নির্ধারণ করে। বিশেষত, যখন দাম উপরের ব্যান্ডের নীচে থাকে তখন একটি ডাউনট্রেন্ড সংজ্ঞায়িত করা হয় এবং যখন দাম নিম্ন ব্যান্ডের উপরে থাকে তখন একটি আপট্রেন্ড সংজ্ঞায়িত করা হয়।

একই সাথে, কৌশলটি কে-লাইন একটি গ্রাসকারী প্যাটার্ন গঠন করে কিনা তাও বিচার করে। কোড লজিক অনুসারে, একটি আপট্রেন্ডে, যদি পূর্ববর্তী বারের বন্ধের মূল্য বর্তমান বারের উদ্বোধনী মূল্যের চেয়ে বেশি হয়, যখন বর্তমান বারের বন্ধের মূল্য খোলার মূল্যের চেয়ে কম হয়, তবে একটি উত্থান গ্রাসকারী শুরু হবে। একটি ডাউনট্রেন্ডে, যদি পূর্ববর্তী বারের বন্ধের মূল্য বর্তমান বারের উদ্বোধনী মূল্যের চেয়ে কম হয়, যখন বর্তমান বারের বন্ধের মূল্য খোলার মূল্যের চেয়ে বেশি হয়, তবে একটি হ্রাস গ্রাসকারী শুরু হবে।

যখন গ্লোফিং প্যাটার্ন ট্রেন্ডের দিকের সাথে সামঞ্জস্যপূর্ণ হয়, তখন একটি ট্রেডিং সিগন্যাল তৈরি করা হবে। উপরন্তু, কৌশলটি স্টপ লস গণনা করবে এবং গ্লোফিং প্যাটার্নের উপর ভিত্তি করে লাভের স্তর গ্রহণ করবে। বাজারে প্রবেশের পরে, যদি দাম স্টপ লস বা লাভের স্তরকে স্পর্শ করে তবে বর্তমান অবস্থানটি প্রস্থান করা হবে।

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

এই কৌশলটি ট্রেন্ড অনুসরণ এবং প্যাটার্ন স্বীকৃতির সুবিধাগুলিকে ট্রেন্ডিং মার্কেটে বিপরীত সংকেতগুলি সনাক্ত করতে একত্রিত করে, এইভাবে বাঁক পয়েন্টগুলিতে বৃহত্তর পদক্ষেপগুলি ধরতে পারে। এছাড়াও, স্টপ লস প্রক্রিয়াটি ক্ষতির ঝুঁকি কার্যকরভাবে নিয়ন্ত্রণ করতে পারে।

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

এই কৌশলটির সবচেয়ে বড় ঝুঁকি হ'ল গ্লোবিং প্যাটার্নগুলি ভুয়া বিরতি হতে পারে, যার ফলে ভুল সংকেত উত্পন্ন হয়। এছাড়াও, স্টপ লস এবং লাভ গ্রহণের সেটিংসও খুব স্বতঃস্ফূর্ত হতে পারে, সুষম লাভ এবং ক্ষতি অর্জনে ব্যর্থ হয়। প্যারামিটার সংমিশ্রণগুলি অনুকূল করতে এবং স্টপ লস এবং লাভের স্তরগুলি যথাযথভাবে সামঞ্জস্য করার পরামর্শ দেওয়া হয়।

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

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

সংক্ষিপ্তসার

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


/*backtest
start: 2023-11-07 00:00:00
end: 2023-12-07 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/
// © Armanhammer

//@version=5
strategy("Engulfing with Trend", overlay=true)

Periods = input.int(title="ATR Period", defval=10)
src = input(hl2, title="Source")
Multiplier = input.float(title="ATR Multiplier", step=0.1, defval=3.0)
changeATR= input.bool(title="Change ATR Calculation Method ?", defval=true)
showsignals = input.bool(title="Show Buy/Sell Signals ?", defval=true)
highlighting = input.bool(title="Highlighter On/Off ?", defval=true)

atr2 = ta.sma(src, Periods)
atr= changeATR ? ta.atr(Periods) : atr2

up=src-(Multiplier*atr)
up1 = nz(up[1],up)
up := close[1] > up1 ? math.max(up,up1) : up
dn=src+(Multiplier*atr)
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? math.min(dn, dn1) : dn

var trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend

upPlot = plot(trend == 1 ? up : na, title="Up Trend", style=plot.style_linebr, linewidth=2, color=color.green)
buySignal = trend == 1 and trend[1] == -1
plotshape(buySignal and showsignals ? up : na, title="Buy", style=shape.labelup, location=location.absolute, color=color.new(color.green, 0), text="Buy")
//plotshape(buySignal ? up : na, title="UpTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0)
//plotshape(buySignal and showsignals ? up : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)
dnPlot = plot(trend == 1 ? na : dn, title="Down Trend", style=plot.style_linebr, linewidth=2, color=color.red)
sellSignal = trend == -1 and trend[1] == 1
plotshape(sellSignal and showsignals ? dn : na, title="Sell", style=shape.labeldown, location=location.absolute, color=color.new(color.red, 0), text="Sell")
//plotshape(sellSignal ? dn : na, title="DownTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red, transp=0)
//plotshape(sellSignal and showsignals ? dn : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)
mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0)
longFillColor = highlighting and trend == 1 ? color.new(color.green, 0) : na
shortFillColor = highlighting and trend == -1 ? color.new(color.red, 0) : na
fill(upPlot, dnPlot, color=longFillColor)
fill(dnPlot, upPlot, color=shortFillColor)
alertcondition(buySignal, title="SuperTrend Buy", message="SuperTrend Buy!")
alertcondition(sellSignal, title="SuperTrend Sell", message="SuperTrend Sell!")
changeCond = trend != trend[1]
alertcondition(changeCond, title="SuperTrend Direction Change", message="SuperTrend has changed direction!")

// Define Downtrend and Uptrend conditions
downtrend = trend == -1
uptrend = trend == 1


// Engulfing
boringThreshold = input.float(25, title="Boring Candle Threshold (%)", minval=1, maxval=100)
engulfingThreshold = input.float(50, title="Engulfing Candle Threshold (%)", minval=1, maxval=100)
stopLevel = input.int(200, title="Stop Level (Pips)", minval=1)

// Boring Candle (Inside Bar) and Engulfing Candlestick Conditions
isBoringCandle = math.abs(open[1] - close[1]) * 100 / math.abs(high[1] - low[1]) <= boringThreshold
isEngulfingCandle = math.abs(open - close) * 100 / math.abs(high - low) <= engulfingThreshold

// Bullish and Bearish Engulfing Conditions
bullEngulfing = uptrend and close[1] < open[1] and close > open[1] and not isBoringCandle and not isEngulfingCandle
bearEngulfing = downtrend and close[1] > open[1] and close < open[1] and not isBoringCandle and not isEngulfingCandle

// Stop Loss, Take Profit, and Entry Price Calculation
bullStop = close + (stopLevel * syminfo.mintick)
bearStop = close - (stopLevel * syminfo.mintick)
bullSL = low 
bearSL = high
bullTP = bullStop + (bullStop - low)
bearTP = bearStop - (high - bearStop)

// Entry Conditions
enterLong = bullEngulfing and uptrend
enterShort = bearEngulfing and downtrend

// Exit Conditions
exitLong = ta.crossover(close, bullTP) or ta.crossover(close, bullSL)
exitShort = ta.crossover(close, bearTP) or ta.crossover(close, bearSL)

// Check if exit conditions are met by the next candle
exitLongNextCandle = exitLong and (ta.crossover(close[1], bullTP[1]) or ta.crossover(close[1], bullSL[1]))
exitShortNextCandle = exitShort and (ta.crossover(close[1], bearTP[1]) or ta.crossover(close[1], bearSL[1]))

// Strategy Execution
if enterLong
    strategy.entry("Buy", strategy.long)

if enterShort
    strategy.entry("Sell", strategy.short)

// Exit Conditions for Long (Buy) Positions
if bullEngulfing and not na(bullTP) and not na(bullSL)
    strategy.exit("Exit Long", from_entry="Buy", stop=bullSL, limit=bullTP)

// Exit Conditions for Short (Sell) Positions
if bearEngulfing and not na(bearTP) and not na(bearSL)
    strategy.exit("Exit Short", from_entry="Sell", stop=bearSL, limit=bearTP)


// Plot Shapes and Labels
plotshape(series=bullEngulfing, style=shape.triangleup, location=location.abovebar, color=color.green)
plotshape(series=bearEngulfing, style=shape.triangledown, location=location.abovebar, color=color.red)

// Determine OP, SL, and TP
plot(series=bullEngulfing ? bullStop : na, title="Bullish Engulfing stop", color=color.red, linewidth=3, style=plot.style_linebr)
plot(series=bearEngulfing ? bearStop : na, title="Bearish Engulfing stop", color=color.red, linewidth=3, style=plot.style_linebr)
plot(series=bullEngulfing ? bullSL : na, title="Bullish Engulfing SL", color=color.red, linewidth=3, style=plot.style_linebr)
plot(series=bearEngulfing ? bearSL : na, title="Bearish Engulfing SL", color=color.red, linewidth=3, style=plot.style_linebr)
plot(series=bullEngulfing ? bullTP : na, title="Bullish Engulfing TP", color=color.green, linewidth=3, style=plot.style_linebr)
plot(series=bearEngulfing ? bearTP : na, title="Bearish Engulfing TP", color=color.green, linewidth=3, style=plot.style_linebr)

// Create labels if the condition for bullEngulfing or bearEngulfing is met
//if bullEngulfing
   // label.new(x=bar_index, y=bullSL, text="SL: " + str.tostring(bullSL), color=color.red, textcolor=color.white, style=label.style_labelup, size=size.tiny)

//if bearEngulfing
   // label.new(x=bar_index, y=bearSL, text="SL: " + str.tostring(bearSL), color=color.red, textcolor=color.white, style=label.style_labeldown, size=size.tiny)

//if bullEngulfing
  //  label.new(x=bar_index, y=bullTP, text="TP: " + str.tostring(bullTP), color=color.green, textcolor=color.white, style=label.style_labeldown, size=size.tiny)

//if bearEngulfing
  //  label.new(x=bar_index, y=bearTP, text="TP: " + str.tostring(bearTP), color=color.green, textcolor=color.white, style=label.style_labelup, size=size.tiny)


আরো