পজিটিভ চ্যানেল ইএমএ ট্রেলিং স্টপ কৌশল

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

img

সারসংক্ষেপ

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

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

কৌশলটি মূলত বিভিন্ন চক্রের সাথে তিনটি ইএমএ বক্ররেখা ব্যবহার করে ষাঁড় এবং ভালুকের অবস্থা নির্ধারণ করে। নির্দিষ্ট বিচার নিয়মগুলি হলঃ

  • EMA5>EMA20>EMA40 হল একটি ষাঁড়ের চক্র
  • EMA20>EMA5>EMA40 একটি ষাঁড়ের চক্র
  • EMA20>EMA40>EMA5 একটি ষাঁড়ের চক্র
  • EMA40>EMA20>EMA5 একটি ভালুক চক্র
  • EMA40>EMA5>EMA20 একটি ভালুক চক্র
  • EMA5>EMA40>EMA20 একটি ভালুক চক্র

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

সুবিধা

এই কৌশলটির প্রধান সুবিধাগুলো হল:

  1. ইএমএ ব্যবহার করে ষাঁড় এবং ভালুকের চক্র বিচার করা বাজারের প্রবণতার টার্নিং পয়েন্টগুলি কার্যকরভাবে ধরতে পারে
  2. এটিআর চ্যানেলের উপর ভিত্তি করে এন্ট্রি পয়েন্ট তৈরি করা বাজার সংহতকরণের সময় ভুলভাবে প্রবেশ এড়ায়
  3. এটিআর ডায়নামিক ট্র্যাকিং স্টপ লস লাভ লকিং সর্বাধিকীকরণ এবং কার্যকরভাবে ঝুঁকি নিয়ন্ত্রণ করতে পারে

ঝুঁকি এবং অপ্টিমাইজেশন

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

  1. সর্বোত্তম প্যারামিটার ম্যাচ খুঁজে পেতে EMA চক্র পরামিতি সমন্বয় অপ্টিমাইজ
  2. স্টপ লস খুব কাছাকাছি বা খুব দূরে থেকে রোধ করতে ATR মাল্টিপল আকার অপ্টিমাইজ করুন
  3. ঝামেলাপূর্ণ বাজারের সময় ভুল এন্ট্রি এড়াতে অন্যান্য ফিল্টারিং সূচক যোগ করুন

সিদ্ধান্ত

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


/*backtest
start: 2023-12-10 00:00:00
end: 2023-12-12 04:00:00
period: 1m
basePeriod: 1m
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/
// © kgynofomo

//@version=5
strategy(title="[Salavi] | Andy Advance Pro Strategy [ETH|M15]",overlay = true, pyramiding = 1,initial_capital = 10000, default_qty_type = strategy.cash,default_qty_value = 10000)

ema_short = ta.ema(close,5)
ema_middle = ta.ema(close,20)
ema_long = ta.ema(close,40)

cycle_1 = ema_short>ema_middle and ema_middle>ema_long
cycle_2 = ema_middle>ema_short and ema_short>ema_long
cycle_3 = ema_middle>ema_long and ema_long>ema_short
cycle_4 = ema_long>ema_middle and ema_middle>ema_short
cycle_5 = ema_long>ema_short and ema_short>ema_middle
cycle_6 = ema_short>ema_long and ema_long>ema_middle

bull_cycle = cycle_1 or cycle_2 or cycle_3
bear_cycle = cycle_4 or cycle_5 or cycle_6
// label.new("cycle_1")
// bgcolor(color=cycle_1?color.rgb(82, 255, 148, 60):na)
// bgcolor(color=cycle_2?color.rgb(82, 255, 148, 70):na)
// bgcolor(color=cycle_3?color.rgb(82, 255, 148, 80):na)
// bgcolor(color=cycle_4?color.rgb(255, 82, 82, 80):na)
// bgcolor(color=cycle_5?color.rgb(255, 82, 82, 70):na)
// bgcolor(color=cycle_6?color.rgb(255, 82, 82, 60):na)

// Inputs
a = input(2, title='Key Vaule. \'This changes the sensitivity\'')
c = input(7, title='ATR Period')
h = false

xATR = ta.atr(c)
nLoss = a * xATR

src = h ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=barmerge.lookahead_off) : close

xATRTrailingStop = 0.0
iff_1 = src > nz(xATRTrailingStop[1], 0) ? src - nLoss : src + nLoss
iff_2 = src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), src + nLoss) : iff_1
xATRTrailingStop := src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), src - nLoss) : iff_2

pos = 0
iff_3 = src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0) ? -1 : nz(pos[1], 0)
pos := src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0) ? 1 : iff_3

xcolor = pos == -1 ? color.red : pos == 1 ? color.green : color.blue

ema = ta.ema(src, 1)
above = ta.crossover(ema, xATRTrailingStop)
below = ta.crossover(xATRTrailingStop, ema)

buy = src > xATRTrailingStop and above
sell = src < xATRTrailingStop and below

barbuy = src > xATRTrailingStop
barsell = src < xATRTrailingStop




atr = ta.atr(14)
atr_length = input.int(25)
atr_rsi = ta.rsi(atr,atr_length)
atr_valid = atr_rsi>50

long_condition =  buy and bull_cycle and atr_valid
short_condition =  sell and bear_cycle and atr_valid

Exit_long_condition = short_condition
Exit_short_condition = long_condition

if long_condition
    strategy.entry("Andy Buy",strategy.long, limit=close,comment="Andy Buy Here")

if Exit_long_condition
    strategy.close("Andy Buy",comment="Andy Buy Out")
    // strategy.entry("Andy fandan Short",strategy.short, limit=close,comment="Andy 翻單 short Here")
    // strategy.close("Andy fandan Buy",comment="Andy short Out")


if short_condition
    strategy.entry("Andy Short",strategy.short, limit=close,comment="Andy short Here")


// strategy.exit("STR","Long",stop=longstoploss)
if Exit_short_condition
    strategy.close("Andy Short",comment="Andy short Out")
    // strategy.entry("Andy fandan Buy",strategy.long, limit=close,comment="Andy 翻單 Buy Here")
    // strategy.close("Andy fandan Short",comment="Andy Buy Out")




inLongTrade = strategy.position_size > 0
inLongTradecolor = #58D68D
notInTrade = strategy.position_size == 0
inShortTrade = strategy.position_size < 0

// bgcolor(color = inLongTrade?color.rgb(76, 175, 79, 70):inShortTrade?color.rgb(255, 82, 82, 70):na)
plotshape(close!=0,location = location.bottom,color = inLongTrade?color.rgb(76, 175, 79, 70):inShortTrade?color.rgb(255, 82, 82, 70):na)


plotshape(long_condition, title='Buy', text='Andy Buy', style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), textcolor=color.new(color.white, 0), size=size.tiny)
plotshape(short_condition, title='Sell', text='Andy Sell', style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.white, 0), size=size.tiny)


// //atr > close *0.01* parameter

// // MONTHLY TABLE PERFORMANCE - Developed by @QuantNomad
// // *************************************************************************************************************************************************************************************************************************************************************************
// show_performance = input.bool(true, 'Show Monthly Performance ?', group='Performance - credits: @QuantNomad')
// prec = input(2, 'Return Precision', group='Performance - credits: @QuantNomad')

// if show_performance
//     new_month = month(time) != month(time[1])
//     new_year  = year(time)  != year(time[1])
    
//     eq = strategy.equity
    
//     bar_pnl = eq / eq[1] - 1
    
//     cur_month_pnl = 0.0
//     cur_year_pnl  = 0.0
    
//     // Current Monthly P&L
//     cur_month_pnl := new_month ? 0.0 : 
//                      (1 + cur_month_pnl[1]) * (1 + bar_pnl) - 1 
    
//     // Current Yearly P&L
//     cur_year_pnl := new_year ? 0.0 : 
//                      (1 + cur_year_pnl[1]) * (1 + bar_pnl) - 1  
    
//     // Arrays to store Yearly and Monthly P&Ls
//     var month_pnl  = array.new_float(0)
//     var month_time = array.new_int(0)
    
//     var year_pnl  = array.new_float(0)
//     var year_time = array.new_int(0)
    
//     last_computed = false
    
//     if (not na(cur_month_pnl[1]) and (new_month or barstate.islastconfirmedhistory))
//         if (last_computed[1])
//             array.pop(month_pnl)
//             array.pop(month_time)
            
//         array.push(month_pnl , cur_month_pnl[1])
//         array.push(month_time, time[1])
    
//     if (not na(cur_year_pnl[1]) and (new_year or barstate.islastconfirmedhistory))
//         if (last_computed[1])
//             array.pop(year_pnl)
//             array.pop(year_time)
            
//         array.push(year_pnl , cur_year_pnl[1])
//         array.push(year_time, time[1])
    
//     last_computed := barstate.islastconfirmedhistory ? true : nz(last_computed[1])
    
//     // Monthly P&L Table    
//     var monthly_table = table(na)
    
//     if (barstate.islastconfirmedhistory)
//         monthly_table := table.new(position.bottom_center, columns = 14, rows = array.size(year_pnl) + 1, border_width = 1)
    
//         table.cell(monthly_table, 0,  0, "",     bgcolor = #cccccc)
//         table.cell(monthly_table, 1,  0, "Jan",  bgcolor = #cccccc)
//         table.cell(monthly_table, 2,  0, "Feb",  bgcolor = #cccccc)
//         table.cell(monthly_table, 3,  0, "Mar",  bgcolor = #cccccc)
//         table.cell(monthly_table, 4,  0, "Apr",  bgcolor = #cccccc)
//         table.cell(monthly_table, 5,  0, "May",  bgcolor = #cccccc)
//         table.cell(monthly_table, 6,  0, "Jun",  bgcolor = #cccccc)
//         table.cell(monthly_table, 7,  0, "Jul",  bgcolor = #cccccc)
//         table.cell(monthly_table, 8,  0, "Aug",  bgcolor = #cccccc)
//         table.cell(monthly_table, 9,  0, "Sep",  bgcolor = #cccccc)
//         table.cell(monthly_table, 10, 0, "Oct",  bgcolor = #cccccc)
//         table.cell(monthly_table, 11, 0, "Nov",  bgcolor = #cccccc)
//         table.cell(monthly_table, 12, 0, "Dec",  bgcolor = #cccccc)
//         table.cell(monthly_table, 13, 0, "Year", bgcolor = #999999)
    
    
//         for yi = 0 to array.size(year_pnl) - 1
//             table.cell(monthly_table, 0,  yi + 1, str.tostring(year(array.get(year_time, yi))), bgcolor = #cccccc)
            
//             y_color = array.get(year_pnl, yi) > 0 ? color.new(color.teal, transp = 40) : color.new(color.gray, transp = 40)
//             table.cell(monthly_table, 13, yi + 1, str.tostring(math.round(array.get(year_pnl, yi) * 100, prec)), bgcolor = y_color, text_color=color.new(color.white, 0))
            
//         for mi = 0 to array.size(month_time) - 1
//             m_row   = year(array.get(month_time, mi))  - year(array.get(year_time, 0)) + 1
//             m_col   = month(array.get(month_time, mi)) 
//             m_color = array.get(month_pnl, mi) > 0 ? color.new(color.teal, transp = 40) : color.new(color.gray, transp = 40)
            
//             table.cell(monthly_table, m_col, m_row, str.tostring(math.round(array.get(month_pnl, mi) * 100, prec)), bgcolor = m_color, text_color=color.new(color.white, 0))



আরো