
এই কৌশলটি একটি প্রবণতা ট্র্যাকিং সিস্টেম যা বহু-চক্রীয় চলমান গড় এবং লেনদেনের পরিমাণ বিশ্লেষণের সাথে মিলিত হয়। কৌশলটি সামগ্রিক প্রবণতা নিশ্চিত করার জন্য দৈনিক চক্রের EMA9, WMA20 এবং WMA200 এর তিনটি গড় লাইন ব্যবহার করে এবং OBV (অন ব্যালেন্স ভলিউম) সূচক এবং তার EMA এর সাথে লেনদেনের পরিমাণ নিশ্চিত করার জন্য আরও স্থিতিশীল প্রবণতা ট্র্যাকিং লেনদেনের জন্য।
কৌশলটি দুটি মূল শর্তের উপর ভিত্তি করে কাজ করেঃ
এই কৌশলটি বহু-চক্রের প্রবণতা বিশ্লেষণ এবং লেনদেনের পরিমাণ নিশ্চিতকরণের সাথে একত্রিত করে একটি অপেক্ষাকৃত সম্পূর্ণ প্রবণতা ট্র্যাকিং সিস্টেম তৈরি করে। কৌশলগত যুক্তি পরিষ্কার, ঝুঁকি নিয়ন্ত্রণ যুক্তিসঙ্গত, তবে এখনও অপ্টিমাইজেশনের জন্য জায়গা রয়েছে। ব্যবসায়ীদের পরামর্শ দেওয়া হয় যে তারা বাস্তব বাজারে সাবধানতার সাথে পরীক্ষা করুন এবং নির্দিষ্ট বাজারের বৈশিষ্ট্য অনুসারে প্যারামিটারগুলি সামঞ্জস্য করুন।
/*backtest
start: 2024-09-01 00:00:00
end: 2025-02-18 08:00:00
period: 5d
basePeriod: 5d
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("Strategy: Daily MAs + OBV", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=10, commission_type=strategy.commission.percent, commission_value=0.1)
//=== Daily Moving Averages Calculation =========================
// Get daily timeframe values using request.security.
dailyEMA9 = request.security(syminfo.tickerid, "D", ta.ema(close, 9))
dailyWMA20 = request.security(syminfo.tickerid, "D", ta.wma(close, 20))
dailyWMA200 = request.security(syminfo.tickerid, "D", ta.wma(close, 200))
// Check if each moving average is trending upward (current > previous).
ema9_up = dailyEMA9 > nz(dailyEMA9[1])
wma20_up = dailyWMA20 > nz(dailyWMA20[1])
wma200_up = dailyWMA200 > nz(dailyWMA200[1])
trend_condition = ema9_up and wma20_up and wma200_up
//=== OBV and its 13-period EMA Calculation ================================
// Calculate OBV manually using a cumulative sum.
obv_val = ta.cum(close > close[1] ? volume : (close < close[1] ? -volume : 0))
// 13-period EMA of the OBV.
ema13_obv = ta.ema(obv_val, 13)
// Condition: 13-period EMA of OBV must be above the OBV value.
obv_condition = ema13_obv > obv_val
//=== Entry Condition ===================================================
// Both trend and OBV conditions must be met.
buy_condition = trend_condition and obv_condition
//=== Entry and Exit Orders =============================================
// Enter a long position when the buy condition is met and no position is open.
if buy_condition and strategy.position_size <= 0
strategy.entry("Long", strategy.long)
// Exit the position when the condition is no longer met.
if not buy_condition and strategy.position_size > 0
strategy.close("Long")
//=== Explicit Entry and Exit Markers ====================================
// Determine the exact bar where entry and exit occur.
entry_signal = (strategy.position_size > 0 and (strategy.position_size[1] <= 0))
exit_signal = (strategy.position_size == 0 and (strategy.position_size[1] > 0))
plotshape(entry_signal, title="Entry Signal", location=location.belowbar, style=shape.labelup, text="BUY", color=color.new(color.green, 0), size=size.normal)
plotshape(exit_signal, title="Exit Signal", location=location.abovebar, style=shape.labeldown, text="SELL", color=color.new(color.red, 0), size=size.normal)
//=== Plots for Visualization ===============================================
// Plot daily moving averages.
plot(dailyEMA9, color=color.blue, title="Daily EMA 9")
plot(dailyWMA20, color=color.orange, title="Daily WMA 20")
plot(dailyWMA200, color=color.red, title="Daily WMA 200")
// Plot OBV and its 13-period EMA using color.new() to specify transparency.
plot(obv_val, color=color.new(color.gray, 30), title="OBV")
plot(ema13_obv, color=color.new(color.green, 0), title="13-Period EMA OBV")