
এই কৌশলটি একটি ট্রেন্ড অনুসরণ করে ট্রেডিং সিস্টেম যা রিলেটিভ স্ট্রেংথ ইনডেক্স (RSI) এবং সিম্পল মুভিং এভারেজ (SMA) কে একত্রিত করে। এই কৌশলটি বাজারের প্রবণতার দিক নির্ণয় করতে চলমান গড় ব্যবহার করে, যখন গতি নিশ্চিত করতে RSI সূচক ব্যবহার করে, যাতে ট্রেন্ড এবং গতিবেগ অনুরণিত হলে ট্রেড করা যায়। কৌশলটি একটি সম্পূর্ণ স্টপ-প্রফিট এবং স্টপ-লস মেকানিজম দিয়ে ডিজাইন করা হয়েছে, যা কার্যকরভাবে ঝুঁকি নিয়ন্ত্রণ করতে পারে।
কৌশলটির মূল যুক্তি দুটি প্রযুক্তিগত সূচকের সম্মিলিত ব্যবহারের উপর ভিত্তি করে:
ট্রেডিং সিগন্যাল জেনারেশন লজিক:
ঝুঁকি নিয়ন্ত্রণ শতাংশ স্টপ লস এবং টেক প্রফিট পদ্ধতি গ্রহণ করে, যা যথাক্রমে প্রবেশ মূল্যের একটি নির্দিষ্ট শতাংশ হিসাবে সেট করা হয়।
এই কৌশলটি স্পষ্ট যুক্তি এবং নিয়ন্ত্রণযোগ্য ঝুঁকি সহ একটি ট্রেডিং সিস্টেম তৈরি করতে প্রবণতা এবং গতির সূচককে একত্রিত করে। যদিও কিছু অন্তর্নিহিত ঝুঁকি আছে, যুক্তিসঙ্গত প্যারামিটার সেটিংস এবং ঝুঁকি নিয়ন্ত্রণের মাধ্যমে, কৌশলটি ভাল ব্যবহারিকতা দেখায়। ফলো-আপ অপ্টিমাইজেশান দিকটি মূলত গতিশীল পরামিতি সমন্বয়, বাজারের পরিবেশ সনাক্তকরণ এবং সংকেত মানের উন্নতির উপর দৃষ্টি নিবদ্ধ করে, যা কৌশলটির স্থিতিশীলতা এবং লাভজনকতাকে আরও উন্নত করবে বলে আশা করা হচ্ছে।
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-04 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © raiford87
//@version=6
strategy("RSI + MA Trend Strategy (v6)",
shorttitle="RSI_MA_Trend_v6",
overlay=true,
initial_capital=50000,
default_qty_type=strategy.fixed,
default_qty_value=1)
// ─────────────────────────────────────────────────────────────────────────────────────
// 1. USER INPUTS
// ─────────────────────────────────────────────────────────────────────────────────────
maLength = input.int(50, "Moving Average Length")
rsiLength = input.int(14, "RSI Length")
rsiBuyLevel = input.int(55, "RSI > X for Buy", minval=1, maxval=99)
rsiSellLevel = input.int(45, "RSI < X for Sell", minval=1, maxval=99)
stopLossPerc = input.float(1.0, "Stop Loss %", minval=0.1)
takeProfitPerc = input.float(2.0, "Take Profit %", minval=0.1)
// ─────────────────────────────────────────────────────────────────────────────────────
// 2. INDICATOR CALCULATIONS
// ─────────────────────────────────────────────────────────────────────────────────────
maValue = ta.sma(close, maLength)
rsiVal = ta.rsi(close, rsiLength)
// Trend conditions
bullTrend = close > maValue
bearTrend = close < maValue
// RSI conditions
rsiBull = rsiVal > rsiBuyLevel
rsiBear = rsiVal < rsiSellLevel
// ─────────────────────────────────────────────────────────────────────────────────────
// 3. ENTRY CONDITIONS
// ─────────────────────────────────────────────────────────────────────────────────────
longCondition = bullTrend and rsiBull
shortCondition = bearTrend and rsiBear
if longCondition
strategy.entry("RSI MA Long", strategy.long)
if shortCondition
strategy.entry("RSI MA Short", strategy.short)
// ─────────────────────────────────────────────────────────────────────────────────────
// 4. STOP LOSS & TAKE PROFIT
// ─────────────────────────────────────────────────────────────────────────────────────
stopLossLevel = stopLossPerc * 0.01
takeProfitLevel = takeProfitPerc * 0.01
if strategy.position_size > 0
stopPriceLong = strategy.position_avg_price * (1 - stopLossLevel)
tpPriceLong = strategy.position_avg_price * (1 + takeProfitLevel)
strategy.exit("Exit Long", from_entry="RSI MA Long", stop=stopPriceLong, limit=tpPriceLong)
if strategy.position_size < 0
stopPriceShort = strategy.position_avg_price * (1 + stopLossLevel)
tpPriceShort = strategy.position_avg_price * (1 - takeProfitLevel)
strategy.exit("Exit Short", from_entry="RSI MA Short", stop=stopPriceShort, limit=tpPriceShort)
// ─────────────────────────────────────────────────────────────────────────────────────
// 5. PLOT SIGNALS & LEVELS
// ─────────────────────────────────────────────────────────────────────────────────────
plot(maValue, color=color.yellow, linewidth=2, title="Moving Average")
plotchar(longCondition, title="Long Signal", char='▲', location=location.belowbar, color=color.green, size=size.tiny)
plotchar(shortCondition, title="Short Signal", char='▼', location=location.abovebar, color=color.red, size=size.tiny)
// Plot Stop & TP lines
posIsLong = strategy.position_size > 0
posIsShort = strategy.position_size < 0
plotStopLong = posIsLong ? strategy.position_avg_price * (1 - stopLossLevel) : na
plotTpLong = posIsLong ? strategy.position_avg_price * (1 + takeProfitLevel): na
plotStopShort= posIsShort? strategy.position_avg_price * (1 + stopLossLevel) : na
plotTpShort = posIsShort? strategy.position_avg_price * (1 - takeProfitLevel): na
plot(plotStopLong, color=color.red, linewidth=2, style=plot.style_line, title="Stop Loss Long")
plot(plotTpLong, color=color.green, linewidth=2, style=plot.style_line, title="Take Profit Long")
plot(plotStopShort, color=color.red, linewidth=2, style=plot.style_line, title="Stop Loss Short")
plot(plotTpShort, color=color.green, linewidth=2, style=plot.style_line, title="Take Profit Short")