৫ মিনিটের ইএমএ ক্রসওভার কৌশল অনুসরণ করে প্রবণতা

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

img

সারসংক্ষেপ

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

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

  1. দ্রুত এবং ধীর EMA লাইন ব্যবহার করুন, যখন দ্রুত EMA ধীর EMA এর উপরে অতিক্রম করে তখন দীর্ঘ যান, যখন নীচে অতিক্রম করে তখন ছোট যান
  2. EMA ম্যাক্রো ফিল্টার প্রয়োগ করুন, শুধুমাত্র EMA এর উপরে লং এবং EMA এর নিচে শর্ট নিন যাতে মিথ্যা সংকেত এড়ানো যায়
  3. আদর্শ এন্ট্রি মূল্য পূরণ নিশ্চিত করার জন্য সীমা আদেশ সঙ্গে ট্রেড প্রবেশ করুন
  4. মুনাফা লক করতে এবং ক্ষতি কমাতে প্রবেশের পরে গতিশীল ট্রেলিং স্টপ লস প্রয়োগ করুন

বিশেষ করেঃ

  1. নির্বাচিত সময়ের উপর ভিত্তি করে দ্রুত এবং ধীর EMA গণনা করুন
  2. শুধুমাত্র লং/শর্ট পজিশন নিন যখন মূল্য EMA এর উপরে/নীচে থাকে যদি ফিল্টার সক্ষম থাকে
  3. যখন দ্রুত EMA ধীর EMA এর উপরে অতিক্রম করে তখন লম্বা যান, নেমে ক্রসওভারে শর্ট যান
  4. লং অর্ডারের জন্য লিমিট ক্রয় অর্ডার এবং শর্ট অর্ডারের জন্য লিমিট বিক্রয় অর্ডার স্থাপন করুন
  5. প্রবেশের পর সর্বোচ্চ উচ্চতা/নিম্নতম নিম্নতার ভিত্তিতে ট্রেলিং স্টপ লস শুরু করুন

এই কৌশলটির মূল ট্রেডিং লজিকে উপরে বর্ণনা করা হয়েছে।

সুবিধা

  1. ইএমএ ফিল্টারগুলি সামগ্রিক প্রবণতা নির্ধারণ করে, প্রধান প্রবণতার বিরুদ্ধে ট্রেডিং রোধ করে
  2. সীমাবদ্ধতার সাথে দ্রুত / ধীর EMA শীর্ষ / নীচে তাড়া করতে বাধা দেয়
  3. ডায়নামিক ট্রেলিং স্টপ কার্যকরভাবে মুনাফা লক
  4. ২% স্টপ লস সহ ভাল ঝুঁকি নিয়ন্ত্রণ
  5. ছোট ড্র-আউট, প্রবণতা অনুসরণ করতে ভাল
  6. সহজ এবং সহজেই বোঝা লজিক, অপ্টিমাইজযোগ্য

ঝুঁকি

  1. হুইপস এবং মিথ্যা পলাতক হওয়ার ঝুঁকি, ফাঁদে পড়ার সম্ভাবনা
  2. ভুল EMA সময়কাল মিস ট্রেন্ডের কারণ হতে পারে
  3. স্টপ লস খুব বড়, স্বাভাবিক অস্থিরতা অতিক্রম করতে পারে
  4. ট্রেলিং স্টপ খুব আক্রমণাত্মক, অকাল ছাড়তে পারে
  5. অপ্টিমাম স্টপ লস/ট্যাক প্রফিট রেসিও, বড় মুভ মিস

সমাধান:

  1. সেরা সময়কাল খুঁজে পেতে EMA পরামিতিগুলি অপ্টিমাইজ করুন
  2. অত্যধিক স্টপগুলি রোধ করার জন্য স্টপগুলি মাঝারিভাবে প্রসারিত করুন
  3. সাবধানে ট্রেইলিং শুরু পয়েন্ট এবং ট্রেইল শতাংশ নির্ধারণ
  4. সর্বোত্তম খুঁজে পেতে বিভিন্ন স্টপ / গ্রহণ অনুপাত পরীক্ষা করুন

অপ্টিমাইজেশান সুযোগ

  1. সেরা সমন্বয় খুঁজে পেতে EMA সময়কাল অপ্টিমাইজ করুন
  2. বিভিন্ন EMA প্রকারের চেষ্টা করুন যেমন ওজনযুক্ত চলমান গড়
  3. উন্নত পারফরম্যান্সের জন্য MACD এর মতো অন্যান্য সূচক পরীক্ষা করুন
  4. উচ্চতর সময়সীমার উপর ইএমএ ফিল্টারিংয়ের প্রচেষ্টা
  5. সীমা অর্ডার এন্ট্রি মূল্য পরিসীমা অপ্টিমাইজ করুন
  6. স্টপ লস এবং লাভের পয়েন্ট/প্রোফাইলের অনুপাত অপ্টিমাইজ করুন
  7. আরো উন্নত ট্রেলিং পদ্ধতির সাথে পরীক্ষা
  8. পরিস্থিতিগত সচেতনতা জন্য প্রবণতা শক্তি সূচক যোগ করুন
  9. আরও ভুল সংকেত এড়াতে আরো ফিল্টার বিবেচনা করুন

সিদ্ধান্ত

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


/*backtest
start: 2022-11-09 00:00:00
end: 2023-11-15 00:00:00
period: 1d
basePeriod: 1h
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/
// © jordanfray

//@version=5
strategy(title="5 Minute EMA Strategy", overlay=true, max_bars_back=500, default_qty_type=strategy.percent_of_equity, default_qty_value=100,initial_capital=100000, commission_type=strategy.commission.percent, commission_value=0.05, backtest_fill_limits_assumption=2)

// Indenting Classs
indent_1 = " "
indent_2 = "  "
indent_3 = "   "
indent_4 = "    "

// Group Titles
group_one_title = "EMA Settings"
group_two_title = "Entry Settings"
group_three_title = "Trade Filters"

// Input Tips

ocean_blue = color.new(#0C6090,0)
sky_blue = color.new(#00A5FF,0)
green = color.new(#2DBD85,0)
red = color.new(#E02A4A,0)
light_blue = color.new(#00A5FF,85)
light_green = color.new(#2DBD85,85)
light_red = color.new(#E02A4A,85)
light_yellow = color.new(#FFF900,85)
white = color.new(#ffffff,0)
light_gray = color.new(#000000,70)
transparent = color.new(#000000,100)

// Strategy Settings - EMA
fast_EMA_length = input.int(defval=20, minval=1, title="Fast Length", group=group_one_title)
fast_EMA_type = input.string(defval="EMA", options = ["EMA", "SMA", "RMA", "WMA"], title=indent_4+"Type", group=group_one_title)
fast_EMA_source = input.source(defval=close, title=indent_4+"Source", group=group_one_title)
fast_EMA = switch fast_EMA_type
    "EMA" => ta.ema(fast_EMA_source, fast_EMA_length)
    "SMA" => ta.sma(fast_EMA_source, fast_EMA_length)
    "RMA" => ta.rma(fast_EMA_source, fast_EMA_length)
    "WMA" => ta.wma(fast_EMA_source, fast_EMA_length)
    => na
plot(fast_EMA, title="Fast EMA", linewidth=1, color=green, editable=true)

slow_EMA_length = input.int(defval=100, minval=1, title="Slow Length", group=group_one_title)
slow_EMA_type = input.string(defval="EMA", options = ["EMA", "SMA", "RMA", "WMA"], title=indent_4+"Type", group=group_one_title)
slow_EMA_source = input.source(defval=close, title=indent_4+"Source", group=group_one_title)
slow_EMA = switch slow_EMA_type
    "EMA" => ta.ema(slow_EMA_source, slow_EMA_length)
    "SMA" => ta.sma(slow_EMA_source, slow_EMA_length)
    "RMA" => ta.rma(slow_EMA_source, slow_EMA_length)
    "WMA" => ta.wma(slow_EMA_source, slow_EMA_length)
    => na
plot(slow_EMA, title="Slow EMA", linewidth=1, color=sky_blue, editable=true)


// EMA Macro Filter
enable_EMA_filter = input.bool(defval=false, title="Use EMA Filter", group=group_three_title)
EMA_filter_timeframe = input.timeframe(defval="", title=indent_4+"Timeframe", group=group_three_title)
EMA_filter_length = input.int(defval=300, minval=1, step=10, title=indent_4+"Length", group=group_three_title)
EMA_filter_source = input.source(defval=hl2, title=indent_4+"Source", group=group_three_title)
ema_filter = ta.ema(EMA_filter_source, EMA_filter_length)
ema_filter_smoothed = request.security(syminfo.tickerid, EMA_filter_timeframe, ema_filter[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_on)
plot(enable_EMA_filter ? ema_filter_smoothed: na, title="EMA Macro Filter", linewidth=2, color=white, editable=true)


// Entry Settings
stop_loss_val = input.float(defval=2.0, title="Stop Loss (%)", step=0.1, group=group_two_title)/100
take_profit_val = input.float(defval=2.0, title="Take Profit (%)", step=0.1, group=group_two_title)/100
long_entry_limit_lookback = input.int(defval=3, title="Long Entry Limit Lookback", minval=1, step=1, group=group_two_title)
short_entry_limit_lookback = input.int(defval=3, title="Short Entry Limit Lookback", minval=1, step=1, group=group_two_title)
limit_order_long_price = ta.lowest(low, long_entry_limit_lookback)
limit_order_short_price = ta.highest(high, short_entry_limit_lookback)
start_trailing_after = input.float(defval=1, title="Start Trailing After (%)", step=0.1, group=group_two_title)/100
trail_behind = input.float(defval=1, title="Trail Behind (%)", step=0.1, group=group_two_title)/100
long_start_trailing_val = strategy.position_avg_price + (strategy.position_avg_price * start_trailing_after)
short_start_trailing_val = strategy.position_avg_price - (strategy.position_avg_price * start_trailing_after)
long_trail_behind_val = close - (strategy.position_avg_price * (trail_behind/100))
short_trail_behind_val = close + (strategy.position_avg_price * (trail_behind/100))
currently_in_a_long_postion = strategy.position_size > 0
currently_in_a_short_postion = strategy.position_size < 0
long_profit_target = strategy.position_avg_price * (1 + take_profit_val)
long_stop_loss = strategy.position_avg_price * (1.0 - stop_loss_val)
short_profit_target = strategy.position_avg_price * (1 - take_profit_val)
short_stop_loss = strategy.position_avg_price * (1 + stop_loss_val)

bars_since_entry = bar_index - strategy.opentrades.entry_bar_index(strategy.opentrades - 1)
plot(bars_since_entry, editable=false, title="Bars Since Entry", color=green)

long_run_up = currently_in_a_long_postion and bars_since_entry > 0 ? ta.highest(high, bars_since_entry) : high
long_trailing_stop = currently_in_a_long_postion and bars_since_entry > 0 and long_run_up > long_start_trailing_val ? long_run_up - (long_run_up * trail_behind) : long_stop_loss
long_run_up_line = plot(long_run_up, style=plot.style_stepline, editable=false, color=currently_in_a_long_postion ? green : transparent)
long_trailing_stop_line = plot(long_trailing_stop, style=plot.style_stepline, editable=false, color=currently_in_a_long_postion ? long_trailing_stop > strategy.position_avg_price ? green : red : transparent)

short_run_up = currently_in_a_short_postion and bars_since_entry > 0 ? ta.lowest(low, bars_since_entry) : low
short_trailing_stop = currently_in_a_short_postion and bars_since_entry > 0 and short_run_up < short_start_trailing_val ? short_run_up + (short_run_up * trail_behind) : short_stop_loss
// short_run_up_line = plot(short_run_up, style=plot.style_stepline, editable=false, color=currently_in_a_short_postion ? green : transparent)
short_trailing_stop_line = plot(short_trailing_stop, style=plot.style_stepline, editable=false, color=currently_in_a_short_postion ? short_trailing_stop < strategy.position_avg_price ? green : red : transparent)


// Trade Conditions
fast_EMA_cross_down_slow_EMA = ta.crossunder(fast_EMA,slow_EMA)
fast_EMA_cross_up_slow_EMA = ta.crossover(fast_EMA,slow_EMA)
plotshape(fast_EMA_cross_down_slow_EMA ? close : na, title="Short Entry Symbol", color=red, style=shape.triangledown, location=location.belowbar)
plotshape(fast_EMA_cross_up_slow_EMA ? close : na, title="Long Entry Symbol", color=green, style=shape.triangleup, location=location.abovebar)
fast_EMA_is_above_slow_EMA = fast_EMA > slow_EMA
fast_EMA_is_below_slow_EMA = fast_EMA < slow_EMA
ema_macro_filter_longs_only = fast_EMA > ema_filter_smoothed and slow_EMA > ema_filter_smoothed
ema_macro_filter_shorts_only = fast_EMA < ema_filter_smoothed and slow_EMA < ema_filter_smoothed

long_position_take_profit = ta.cross(close, long_trailing_stop) or close > long_profit_target
short_position_take_profit = ta.cross(close, short_trailing_stop) or close > short_profit_target

long_conditions_met = enable_EMA_filter ? ema_macro_filter_longs_only and fast_EMA_cross_up_slow_EMA and fast_EMA_is_above_slow_EMA and not currently_in_a_short_postion : fast_EMA_cross_up_slow_EMA and not currently_in_a_short_postion
short_conditions_met = enable_EMA_filter ? ema_macro_filter_shorts_only and fast_EMA_cross_down_slow_EMA and fast_EMA_is_below_slow_EMA and not currently_in_a_long_postion : fast_EMA_cross_down_slow_EMA and fast_EMA_is_below_slow_EMA and not currently_in_a_long_postion

// Long Entry
strategy.entry(id="Long", direction=strategy.long, limit=limit_order_long_price, when=long_conditions_met)
strategy.cancel(id="Cancel Long", when=ta.crossover(fast_EMA,slow_EMA))
strategy.exit(id="Close Long", from_entry="Long", stop=long_trailing_stop, limit=long_profit_target, when=long_position_take_profit)

// Short Entry 
strategy.entry(id="Short", direction=strategy.short, limit=limit_order_short_price, when=short_conditions_met)
strategy.cancel(id="Cancel Short", when=ta.crossunder(fast_EMA,slow_EMA))
strategy.exit(id="Close Short", from_entry="Short", stop=short_trailing_stop, limit=short_profit_target, when=short_position_take_profit)

entry = plot(strategy.position_avg_price, editable=false, title="Entry", style=plot.style_stepline, color=currently_in_a_long_postion or currently_in_a_short_postion ? color.blue : transparent, linewidth=1)
fill(entry,long_trailing_stop_line, editable=false, color=currently_in_a_long_postion ? long_trailing_stop > strategy.position_avg_price ? light_green : light_red : transparent)
fill(entry,short_trailing_stop_line, editable=false, color=currently_in_a_short_postion ? short_trailing_stop < strategy.position_avg_price ? light_green : light_red : transparent)
//ltp = plot(currently_in_a_long_postion ? long_profit_target : na, style=plot.style_stepline, title="Take Profit", color=currently_in_a_long_postion ? green : transparent, linewidth=1)
//lsl = plot(currently_in_a_long_postion ? long_stop_loss : na, style=plot.style_stepline, title="Take Profit", color=currently_in_a_long_postion ? red : transparent, linewidth=1)
//fill(entry,ltp, color= currently_in_a_long_postion ? light_green : light_red)
//fill(entry,lsl, color= currently_in_a_long_postion ? light_red : light_green)

//stp = plot(currently_in_a_short_postion ? short_profit_target : na, style=plot.style_stepline, title="Take Profit", color=currently_in_a_short_postion ? green : transparent, linewidth=1)
//ssl = plot(currently_in_a_short_postion ? short_stop_loss : na, style=plot.style_stepline, title="Take Profit", color=currently_in_a_short_postion ? red : transparent, linewidth=1)
//fill(entry,stp, color= currently_in_a_short_postion ? light_green : light_red)
//fill(entry,ssl, color= currently_in_a_short_postion ? light_red : light_green)


আরো