
এই কৌশলটি নির্দিষ্ট শর্ত পূরণ করার সময় ট্রেডিংয়ের জন্য ব্যবহৃত হয় যেমন Smooth Moving Average (SMA), Relative Strength Index (RSI), Real Range (TR) এবং Transaction Volume Moving Average (Volume MA) । এই কৌশলটির মূল ধারণা হল দামগুলি SMA200 এর নীচে এবং নিম্নমুখী প্রবণতা, কম ট্রেডিং ভলিউম এবং কম অস্থিরতার সাথে ক্রয় করা এবং স্টপ লস এবং স্টপ বন্ধ করা। একই সাথে, এই কৌশলটির একটি অস্বাভাবিক প্রস্থান ব্যবস্থা রয়েছে, যখন RSI 70 এর বেশি বা একটি পূর্বনির্ধারিত স্টপ লস পৌঁছে যায় তখন ট্রেডিং থেকে বেরিয়ে আসা।
এই কৌশলটি একাধিক প্রযুক্তিগত সূচকগুলির সমন্বিত ব্যবহারের মাধ্যমে ট্রেডিংয়ের জন্য নির্দিষ্ট পরিস্থিতিতে ট্রেডিংয়ের জন্য প্রবণতা ফিল্টারিং এবং লেনদেনের পরিমাণ, ওঠানামার শর্তগুলি সংযুক্ত করে। একই সাথে, সুস্পষ্ট স্টপ লস স্টপ এবং অস্বাভাবিক প্রস্থান ব্যবস্থা স্থাপন করে, যা কার্যকরভাবে ঝুঁকি নিয়ন্ত্রণ করতে পারে। তবে এই কৌশলটির কিছু সীমাবদ্ধতা রয়েছে, যেমন প্যারামিটার নির্বাচন, বাজার অস্বাভাবিকতা ইত্যাদির মতো কারণগুলি কৌশলটির কার্যকারিতা প্রভাবিত করতে পারে। ভবিষ্যতে আরও সূচক, প্যারামিটার সেটিং অপ্টিমাইজেশন এবং ঝুঁকি পরিচালনার পদ্ধতি যুক্ত করে এই কৌশলটি আরও উন্নত করা যেতে পারে।
/*backtest
start: 2024-05-01 00:00:00
end: 2024-05-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Strategia Stop Loss & Take Profit z Filtrem Trendu i Wyjątkiem", shorttitle="Smooth MA SL & TP with Exception", overlay=true)
// Parametry
tp_multiplier = input.float(1.5, title="Mnożnik Take Profit")
sl_percent = input.float(5, title="Procent Stop Loss")
wait_bars = input.int(3, title="Liczba Oczekiwanych Świec")
sma_period = input.int(200, title="Okres SMA")
rsi_period = input.int(14, title="Okres RSI")
vol_ma_period = input.int(20, title="Okres Średniej Wolumenu")
tr_ma_period = input.int(20, title="Okres Średniej Rzeczywistego Zakresu")
// Obliczenie Gładkiej Średniej Kroczącej
sma = ta.sma(close, sma_period)
// Obliczenie RSI
rsi = ta.rsi(close, rsi_period)
// Filtr Trendu
uptrend = close > sma
downtrend = close < sma
// Warunek konsolidacji: Niski wolumen i niska zmienność
niski_wolumen = volume < ta.sma(volume, vol_ma_period)
niska_zmienosc = ta.tr(true) < ta.sma(ta.tr(true), tr_ma_period)
// Warunek Wejścia (Long): Cena poniżej SMA 200 i filtr trendu w strefie czerwonej
warunek_wejscia = close < sma and niski_wolumen and niska_zmienosc and not uptrend
// Warunek Wyjścia ze strategii
warunek_wyjscia = downtrend and close > sma and ta.crossover(close, sma)
// Ustalanie Stop Loss i Take Profit
var float stop_loss = na
var float take_profit = na
var int indeks_wejscia = na
if (warunek_wejscia)
stop_loss := close * (1 - sl_percent / 100)
take_profit := close * (1 + tp_multiplier)
indeks_wejscia := bar_index
// Handel
if (warunek_wejscia)
strategy.entry("Long", strategy.long)
// Warunek Wyjścia: RSI w strefie wykupienia lub Stop Loss/Take Profit
if (strategy.opentrades != 0)
if (rsi > 70)
strategy.exit("Take Profit/Stop Loss", "Long", limit=take_profit)
else if (bar_index - indeks_wejscia == wait_bars)
strategy.exit("Take Profit/Stop Loss", "Long", stop=stop_loss, limit=take_profit)
// Wyjątek: Warunek Wyjścia z Longów na podstawie zmiany trendu
if (warunek_wyjscia)
strategy.close("Long")
// Rysowanie RSI
rsi_plot = plot(rsi, title="RSI", color=color.blue)
// Rysowanie Gładkiej Średniej Kroczącej
sma_plot = plot(sma, color=color.gray, title="Smooth MA", linewidth=2)
// Rysowanie Filtru Trendu
fill(sma_plot, rsi_plot, color=downtrend ? color.new(color.red, 90) : na)