ইম্পোমেন্টাম ব্রেকআউট ট্রেডিং কৌশল

লেখক:চাওঝাং, তারিখঃ 2024-02-04 10:55:31
ট্যাগঃ

img

সারসংক্ষেপ

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

কৌশল নীতি

এই কৌশলটির মূল বিষয়গুলি হলঃ

  1. দামের প্রবণতার দিকনির্দেশনা বিচার করতে ইএমএ ব্যবহার করুন। ইএমএর উপরে দামের ক্রসিং একটি উত্থান সংকেত এবং এর নীচে ক্রসিং হ্রাস সংকেত।

  2. এটিআর বাজার অস্থিরতা নির্দেশ করে। এটিআর একটি সহগ দ্বারা গুণিত স্টপ লস পরিসীমা হিসাবে কাজ করে। এটি কার্যকরভাবে একক ক্ষতি নিয়ন্ত্রণ করতে পারে।

  3. আরএসআই ওভারকোপড/ওভারসোল্ড অবস্থা নির্দেশ করে। স্টপ লস মূল্য এবং ইএমএ ক্রসওভারের দ্বারা সংকেতযুক্ত ব্রেকআউট ট্রেডগুলি যখন আরএসআই ওভারকোপড/ওভারসোল্ড জোনে না থাকে তখনই ঘটতে হবে। এটি মিথ্যা ব্রেকআউট এড়ায়।

  4. পূর্ববর্তী সময়ের উচ্চ / নিম্ন পয়েন্টগুলি লাভের ভিত্তি হিসাবে ব্যবহার করুন। লাভের মূল্য ট্র্যাকিং আরও লাভের লক করতে পারে।

  5. কঠোর স্টপ লস/টেক মুনাফা নিয়ম। এটিআর-ভিত্তিক স্টপ লস ঝুঁকি নিয়ন্ত্রণ করে এবং লাভের ক্ষেত্রে লাভের লক নেয়।

এন্ট্রি সিগন্যালটি তখন সক্রিয় হয় যখন মূল্য EMA প্লাস ATR স্টপ লস পরিসরের বাইরে চলে যায়। বুলিশ সিগন্যালগুলির জন্য, দামটি উচ্চ পয়েন্টের উপরে অতিক্রম করতে হবে। হ্রাস সংকেতগুলির জন্য, দামটি নিম্ন পয়েন্টের নীচে ভাঙ্গতে হবে।

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

এই কৌশলটির সুবিধাঃ

  1. একাধিক সূচক মিথ্যা বিরতি এড়াতে এবং নির্ভুলতা উন্নত

  2. এটিআর স্টপ লস হ্রাসকে যুক্তিসঙ্গত পর্যায়ে রাখে

  3. গতিশীল লাভের ট্র্যাকিং লাভকে সর্বাধিক করে তোলে

  4. কঠোর নিয়ম ঝুঁকি নিয়ন্ত্রণ সহজতর করে

  5. বিভিন্ন বাজারের সাথে মানিয়ে নেওয়ার জন্য সূচক এবং পরামিতিগুলির জন্য ব্যাপক অপ্টিমাইজেশন স্পেস

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

এই কৌশলের ঝুঁকি:

  1. মুনাফা বাজার অস্থিরতার সাথে সম্পর্কিত। প্রবণতা অস্পষ্ট বা চক্র দীর্ঘ হলে লাভ সীমিত হতে পারে।

  2. স্টপ লস মূল্য আবার ভাঙার আগে whipsaw হতে পারে। এটি অনুপস্থিত প্রবণতা হতে পারে। স্টপ লস মূল্য একটু শিথিল করতে পারেন।

৩.প্রবণতাপূর্ণ বাজারগুলোতে ধাওয়া করার সম্ভাবনা রয়েছে।

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

অপ্টিমাইজেশান আইডিয়াঃ

  1. বিভিন্ন পণ্য এবং সময়সীমার জন্য এমএ, এটিআর পরামিতিগুলি সামঞ্জস্য করুন।

  2. আরও সূচক যোগ করুন যেমন ম্যাকড, কেডিজে ওভারকুপেড/ওভারসোল্ড।

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

  4. একাধিক টাইমফ্রেম সহ কম্বো সিস্টেম স্থাপন করুন। বিভিন্ন টাইমফ্রেম সূচক সংকেতের গুণমান উন্নত করতে পারে।

  5. সর্বোত্তম পারফরম্যান্স অর্জনের জন্য প্যারামিটার / সূচক অপ্টিমাইজেশনের জন্য মেশিন লার্নিং ব্যবহার করুন।

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

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


/*backtest
start: 2024-01-27 00:00:00
end: 2024-02-03 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy(title="UT Bot Strategy", overlay = true)
//CREDITS to HPotter for the orginal code. The guy trying to sell this as his own is a scammer lol. 
// Inputs
emaLengh = input(2, title = "emaLengh")
a = input(3.0,     title = "Key Vaule. 'This changes the sensitivity'")
c = input(10,    title = "ATR Period")
h = input(false, title = "Signals from Heikin Ashi Candles")
emaLengh2 = input(9, title = "emaLengh show")




rate = input(0.00025,    title = "波动率min")
rateMax = input(0.00045,    title = "波动率max")
adx_length =   input(20,    title = "adx_length")
adx_min =   input(14,    title = "adx_min")

sma_length =   input(11,    title = "sma_length")
rsi_len = input(9, title = "rsi_len")

src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = false) : close

// boll 通道----------------------------------------------------
length = input(20, minval=1)
mult = input(2.0, minval=0.001, maxval=50, title="StdDev")
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev
bbr = (src - lower)/(upper - lower)
// plot(upper, color = color.rgb(46, 59, 240), title="upper")
// plot(lower, color = color.rgb(46, 59, 240), title="lower")


// plot(bbr, "Bollinger Bands %B", color=#26A69A)
// band1 = hline(1, "Overbought", color=#787B86, linestyle=hline.style_dashed)
// hline(0.5, "Middle Band", color=color.new(#787B86, 50))
// band0 = hline(0, "Oversold", color=#787B86, linestyle=hline.style_dashed)
// fill(band1, band0, color=color.rgb(38, 166, 154, 90), title="Background")
// boll 通道----------------------------------------------------

// 线性回归 --------------------------------------------------------------
zlsma_length = input(title="zlsma-Length", type=input.integer, defval=50)
zlsma_offset = input(title="zlsma-Offset", type=input.integer, defval=0)
lsma = linreg(src, zlsma_length, zlsma_offset)
lsma2 = linreg(lsma, zlsma_length, zlsma_offset)
eq= lsma-lsma2
zlsma = lsma+eq
// plot(zlsma , color = color.rgb(243, 243, 14), title="zlsma",linewidth=3)
// 线性回归 --------------------------------------------------------------



// --------------------------------
rsi = rsi(src, 6)

// xHH = sma(high, sma_length)
// xLL = sma(low, sma_length)
// movevalue = (xHH - xLL) / 2
// xHHM = xHH + movevalue
// xLLM = xLL - movevalue

// plot(xHHM, color = color.rgb(208, 120, 219), title="xHHM")
// plot(xLLM, color = color.rgb(208, 120, 219), title="xLLM")


xATR  = atr(c)
nLoss = a * xATR



xATRTrailingStop = 0.0
xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src - nLoss),
   iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src + nLoss), 
   iff(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss)))


 
pos = 0   
pos :=	iff(src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0), 1,
   iff(src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0))) 
   
xcolor = pos == -1 ? color.red: pos == 1 ? color.green : color.blue 

ema   = ema(src,emaLengh)
// sma   = sma(src,emaLengh)
emaFast   = ema(src,100)
emaSlow   = ema(src,576)
emaShow   = ema(src, emaLengh2)
// sma       =  sma(src, 8)

// [superTrend, dir] = supertrend(3, 200) 
// 判断连续涨

[diplus, diminus, adx] = dmi(adx_length, adx_length)


above = crossover(ema, xATRTrailingStop)
below = crossover(xATRTrailingStop, ema)
// above = ema == xATRTrailingStop
// below = xATRTrailingStop== ema

// smaabove = crossover(src, sma)
// smabelow = crossover(sma, src)
// smaabove = src > sma
// smabelow = sma > src
close_rate (n)=>
    abs(close[n]-open[n])/min(close[n],open[n])

rate_val = close_rate(0)
rate_val1 = close_rate(1)

buy  = src > xATRTrailingStop and above  and src > zlsma  and adx >adx_min
// and  src>emaShow
// and rate_val < rate_val1*2 and rate_val >=rate_val1
// and rate_val1<rateMax
// and close[1]>open[1] 
sell = src < xATRTrailingStop and below  and src < zlsma and adx >adx_min
// and  src<emaShow
// and rate_val < rate_val1*2  and rate_val >=rate_val1
//  and rate_val1<rateMax
// and open[1]>close[1]  and rate_val1 > rate  

// buy  = src > xATRTrailingStop 
// sell = src < xATRTrailingStop 
// plot(rate_val1 , color = color.red, title="rate_val1")



barbuy  = src > xATRTrailingStop 
barsell = src < xATRTrailingStop

atrRsi = rsi(xATRTrailingStop,rsi_len)

// plot(emaFast , color = color.rgb(243, 206, 127), title="emaFast")
// plot(ema , color = color.rgb(47, 227, 27), title="ut-ema")



// plot(emaShow , color = color.rgb(47, 227, 27), title="ema9")

plot(xATRTrailingStop, color = color.rgb(233, 233, 232), title="xATRTrailingStop")

plotshape(buy,  title = "Buy",  text = 'Buy',  style = shape.labelup,   location = location.belowbar, color= color.green, textcolor = color.white, size = size.tiny)
plotshape(sell, title = "Sell", text = 'Sell', style = shape.labeldown, location = location.abovebar, color= color.red,   textcolor = color.white, size = size.tiny)


// plotshape(buy,  title = "Sell",  text = 'Sell',  style = shape.labelup,   location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny)
// plotshape(sell, title = "buy", text = 'buy', style = shape.labeldown, location = location.abovebar, color= color.red,   textcolor = color.white, transp = 0, size = size.tiny)

// barcolor(barbuy  ? color.green : na)
// barcolor(barsell ? color.red   : na)

// strategy.entry("short",   false, when = buy)
// strategy.entry("long ", true, when = sell)


strategy.entry("long",   true, when = buy and strategy.position_size == 0)
strategy.entry("short", false, when = sell and strategy.position_size == 0)


//动态止盈start------------------------------------------------------------------------------------------
profit = input( 0.015,     title = "最小收益率")
close_profit_rate = input( 10,     title = "平仓收益回撤比")
loss = input(0.004,    title = "回撤率")

// 收益回撤比例
profit_price_scale =profit/close_profit_rate

var float profit_price = 0


// 计算小收益价格

get_profit_price(long) =>
    float res = 0
    if long == true
        res := strategy.position_avg_price * (1+profit)
    if long == false
        res := strategy.position_avg_price * (1-profit)
    res

// 止盈平仓条件
close_profit_position(long)=>
    bool result=false
    if long == true and profit_price>0 and profit_price*(1-profit_price_scale) >=close and  get_profit_price(true) <= close 
        result:=true
    if long == false and profit_price>0 and profit_price*(1+profit_price_scale) <=close and  get_profit_price(false) >= close 
        result:=true
    result

// 更新动态止盈价格
update_profit_price(price)=>
    float res = price
   // 无仓位时 动态止盈价格为0
    if strategy.position_size == 0 
        res := 0
   // long - 价格大于最小收益时保存
    if strategy.position_size > 0 and get_profit_price(true) <= close and (res==0 or res < close)
        res := close
   // short - 价格小于最小收益时保存
    if strategy.position_size < 0 and get_profit_price(true) >= close and (res==0 or res > close)
        res := close
    res
   
///////



profit_price := update_profit_price(profit_price)
long_close_profit_position = close_profit_position(true)
short_close_profit_position = close_profit_position(false)

// plot(profit_price, color = color.green, title="profit_price")
//动态止盈end------------------------------------------------------------------------------------------




strategy.close("long",comment="long-止盈",when = strategy.position_size > 0 and long_close_profit_position)

strategy.close("long",comment="long-止损",when = strategy.position_size >0 and strategy.position_avg_price * (1-loss) >= close)

strategy.close("short",comment="short-止盈",when = strategy.position_size <0 and short_close_profit_position)

strategy.close("short",comment="short-止损",when = strategy.position_size <0 and strategy.position_avg_price * (1+loss) <= close)

  






আরো