RSI Bollinger Bands TP/SL কৌশল

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

img

I. কৌশলগত ওভারভিউ

এই কৌশলটির নাম RSI Bollinger Bands TP/SL কৌশল। এটি প্রবণতা এবং ট্রেডিং সংকেত সনাক্ত করতে RSI সূচক এবং Bollinger Bands এর সমন্বয় করে। যখন RSI সূচক ওভারকোপড বা ওভারসোল্ড সংকেত দেখায় এবং দাম বোলিঞ্জার ব্যান্ডের মধ্য দিয়ে স্পর্শ করে বা ভেঙে যায়, তখন লং বা শর্ট পজিশন খোলা হবে। তদতিরিক্ত, ঝুঁকি নিয়ন্ত্রণের জন্য লাভ এবং স্টপ লস পয়েন্টগুলিও সেট করা হয়।

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

1. বিপরীতমুখী জন্য RSI সূচক

আরএসআই সূচকটি স্টকটি ওভারকুপেড বা ওভারসোল্ড কিনা তা বিচার করে। ওভারকুপেড লাইনের উপরে একটি আরএসআই রিডিং ওভারকুপেড শর্তগুলি নির্দেশ করে, যখন ওভারসোল্ড লাইনের নীচে একটি রিডিং ওভারসোল্ড শর্তগুলি নির্দেশ করে। এই কৌশলটিতে ওভারকুপেড লাইনটি 50 এ সেট করা হয় এবং ওভারসোল্ড লাইনটি 50 এ সেট করা হয়।

২. ট্রেন্ডের জন্য বোলিংজার ব্যান্ড

বোলিংজার ব্যান্ডগুলি একটি সাধারণ চলমান গড়ের উপরে এবং নীচে স্ট্যান্ডার্ড ডিভিয়েশন লাইনগুলি প্লট করে। উপরের ব্যান্ডটি প্রতিরোধ হিসাবে কাজ করে এবং নীচের ব্যান্ডটি সমর্থন হিসাবে কাজ করে। নীচের ব্যান্ডের একটি আপ-ক্রসিং একটি কিনুন সংকেত, যখন উপরের ব্যান্ডের একটি ডাউন-ক্রসিং একটি বিক্রয় সংকেত।

৩. আরএসআই এবং বোলিংজার ব্যান্ডের সমন্বয়

যখন আরএসআই সূচকটি একটি নীচের বিপরীত সংকেত দেখায় এবং দাম বোলিঞ্জার ব্যান্ডের নিম্ন ব্যান্ডটি ভেঙে যায়, তখন এটিকে একটি আপসোর্স বিপরীত হিসাবে বিবেচনা করা হয়, সুতরাং দীর্ঘ যেতে হয়। যখন আরএসআই সূচকটি একটি উপরের বিপরীত সংকেত দেখায় এবং দামটি উপরের ব্যান্ডটি ভেঙে যায়, তখন এটিকে একটি নেমে যাওয়া বিপরীত হিসাবে বিবেচনা করা হয়, সুতরাং শর্ট যেতে হয়।

III. সুবিধা

১. ডাবল ইন্ডিকেটরগুলির সাথে উন্নত নির্ভুলতা

RSI এবং Bollinger Bands উভয়ই প্রবণতা এবং বিপরীততা নির্ধারণ করতে ব্যবহৃত হয়। সংমিশ্রণটি সংকেত স্বীকৃতির নির্ভুলতা উন্নত করে এবং মিথ্যা ব্রেকআউট এড়ায়।

২. টিপি/এসএল ব্যবহার করে ঝুঁকি নিয়ন্ত্রণ

কৌশলটি লাভের জন্য লাভ (টিপি) এবং স্টপ লস (এসএল) পয়েন্ট সেট করে এবং ক্ষতি হ্রাসকে সর্বাধিক করে তোলে।

৩. কাস্টমাইজযোগ্য নির্দেশাবলী

ব্যবহারকারীরা বাজারের অবস্থার উপর ভিত্তি করে শুধুমাত্র দীর্ঘ, শুধুমাত্র সংক্ষিপ্ত বা উভয় দিকই যেতে পারেন, যা ঝুঁকি নিয়ন্ত্রণের জন্য নমনীয়তা দেয়।

IV. ঝুঁকি

১. সংবেদনশীল বোলিংজার ব্যান্ডের পরামিতি

স্ট্যান্ডার্ড ডিভিয়েশন আকার ব্যান্ড প্রস্থ এবং ট্রেডিং সংকেত প্রভাবিত করে। ভুল সেটিংস অত্যধিক মিথ্যা সংকেত উৎপন্ন করতে পারে।

২. টিপি/এসএল এর ঝুঁকি

ভি-আকৃতির বিপরীতগুলি অপ্রয়োজনীয় ক্ষতির কারণ হতে পারে কারণ টিপি / এসএল সেটিংস খুব আক্রমণাত্মক।

3. সংবেদনশীল আরএসআই পরামিতি

ভুল RSI প্যারামিটার সেটিংগুলি বিপরীত সংকেতগুলির নির্ভুলতা হ্রাস করে।

V. অপ্টিমাইজেশান নির্দেশাবলী

১. আরএসআই প্যারামিটার অপ্টিমাইজ করুন

সর্বোত্তম প্যারামিটার সমন্বয় খুঁজে পেতে আরও আরএসআই দৈর্ঘ্যের মান পরীক্ষা করা যেতে পারে।

২. বোলিংজার ব্যান্ডের পরামিতিগুলি অপ্টিমাইজ করুন

সর্বোত্তম প্যারামিটার সমন্বয় খুঁজে পেতে আরও দৈর্ঘ্য এবং স্ট্যান্ডার্ড বিচ্যুতি পরীক্ষা করা যেতে পারে।

৩. বিভিন্ন টিপি/এসএল অনুপাত পরীক্ষা করুন

ব্যাকটেস্টিং সর্বোত্তম টিপি/এসএল অনুপাত খুঁজে পেতে সাহায্য করতে পারে।

VI. উপসংহার

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


/*backtest
start: 2023-11-20 00:00:00
end: 2023-12-20 00:00:00
period: 1h
basePeriod: 15m
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/
// © BigCoinHunter

//@version=5
strategy(title="RSI_Boll-TP/SL", overlay=true, 
     pyramiding=0, default_qty_type=strategy.percent_of_equity, 
     default_qty_value=100, initial_capital=1000, 
     currency=currency.USD, commission_value=0.05, 
     commission_type=strategy.commission.percent, 
     process_orders_on_close=true)

//----------- get the user inputs --------------

//---------- RSI -------------
price = input(close, title="Source")

RSIlength = input.int(defval=6,title="RSI Length") 
RSIoverSold = input.int(defval=50, title="RSI OverSold", minval=1)
RSIoverBought = input.int(defval=50, title="RSI OverBought", minval=1)

//------- Bollinger Bands -----------
BBlength = input.int(defval=200, title="Bollinger Period Length", minval=1)
BBmult = input.float(defval=2.0, minval=0.001, maxval=50, step=0.1, title="Bollinger Bands Standard Deviation")
BBbasis = ta.sma(price, BBlength)
BBdev = BBmult * ta.stdev(price, BBlength)
BBupper = BBbasis + BBdev
BBlower = BBbasis - BBdev
source = close
buyEntry = ta.crossover(source, BBlower)
sellEntry = ta.crossunder(source, BBupper)
plot(BBbasis, color=color.aqua, title="Bollinger Bands SMA Basis Line")
p1 = plot(BBupper, color=color.silver, title="Bollinger Bands Upper Line")
p2 = plot(BBlower, color=color.silver, title="Bollinger Bands Lower Line")
fill(plot1=p1, plot2=p2, title="Bollinger BackGround", color=color.new(color.aqua,90), fillgaps=false, editable=true)

//---------- input TP/SL ---------------
tp = input.float(title="Take Profit:", defval=0.0, minval=0.0, maxval=100.0, step=0.1) * 0.01
sl = input.float(title="Stop Loss:  ", defval=0.0, minval=0.0, maxval=100.0, step=0.1) * 0.01

longEntry = input.bool(defval=true, title= 'Long Entry', inline="11")
shortEntry = input.bool(defval=true, title='Short Entry', inline="11")

//---------- backtest range setup ------------
fromDay   = input.int(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input.int(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear  = input.int(defval = 2021, title = "From Year", minval = 2010)
toDay     = input.int(defval = 30, title = "To Day", minval = 1, maxval = 31)
toMonth   = input.int(defval = 12, title = "To Month", minval = 1, maxval = 12)
toYear    = input.int(defval = 2042, title = "To Year", minval = 2010)

//------------ time interval setup -----------
start     = timestamp(fromYear, fromMonth, fromDay, 00, 00)  // backtest start window
finish    = timestamp(toYear, toMonth, toDay, 23, 59)        // backtest finish window
window()  => time >= start and time <= finish ? true : false // create function "within window of time"

//------- define the global variables ------
var bool long = true
var bool stoppedOutLong = false
var bool stoppedOutShort = false
//--------- Colors ---------------

TrendColor = RSIoverBought and (price[1] > BBupper and price < BBupper) and BBbasis < BBbasis[1] ? color.red : RSIoverSold and (price[1] < BBlower and price > BBlower) and BBbasis > BBbasis[1] ? color.green : na
//bgcolor(switch2?(color.new(TrendColor,50)):na)


//--------- calculate the input/output points -----------
longProfitPrice  = strategy.position_avg_price * (1 + tp)     // tp -> take profit percentage
longStopPrice = strategy.position_avg_price * (1 - sl)        // sl -> stop loss percentage

shortProfitPrice  = strategy.position_avg_price * (1 - tp)
shortStopPrice = strategy.position_avg_price * (1 + sl)


//---------- RSI + Bollinger Bands Strategy -------------
vrsi = ta.rsi(price, RSIlength)

rsiCrossOver = ta.crossover(vrsi, RSIoverSold)
rsiCrossUnder = ta.crossunder(vrsi, RSIoverBought)

BBCrossOver = ta.crossover(source, BBlower)
BBCrossUnder = ta.crossunder(source, BBupper)

if (not na(vrsi))

    if rsiCrossOver and BBCrossOver
        long := true
        
    if rsiCrossUnder and BBCrossUnder
        long := false

//------------------- determine buy and sell points ---------------------
buySignall = window() and long  and (not stoppedOutLong)
sellSignall = window() and (not long)  and (not stoppedOutShort)

//---------- execute the strategy -----------------
if(longEntry and shortEntry)
    if long 
        strategy.entry("LONG", strategy.long, when = buySignall, comment = "ENTER LONG")
        stoppedOutLong := true
        stoppedOutShort := false
    else 
        strategy.entry("SHORT", strategy.short, when = sellSignall, comment = "ENTER SHORT")
        stoppedOutLong  := false
        stoppedOutShort := true

else if(longEntry)
    strategy.entry("LONG", strategy.long,  when = buySignall)
    strategy.close("LONG", when = sellSignall)
    if long 
        stoppedOutLong := true
    else
        stoppedOutLong  := false

else if(shortEntry)
    strategy.entry("SHORT", strategy.short, when = sellSignall)
    strategy.close("SHORT", when = buySignall)
    if not long
        stoppedOutShort := true
    else
        stoppedOutShort := false
    

//----------------- take profit and stop loss -----------------
if(tp>0.0 and sl>0.0)
    if ( strategy.position_size > 0 )
        strategy.exit(id="LONG", limit=longProfitPrice, stop=longStopPrice, comment="Long TP/SL Trigger")

    else if ( strategy.position_size < 0 )
        strategy.exit(id="SHORT", limit=shortProfitPrice, stop=shortStopPrice, comment="Short TP/SL Trigger")

else if(tp>0.0)
    if ( strategy.position_size > 0 )
        strategy.exit(id="LONG", limit=longProfitPrice, comment="Long TP Trigger")

    else if ( strategy.position_size < 0 )
        strategy.exit(id="SHORT", limit=shortProfitPrice, comment="Short TP Trigger")
        
else if(sl>0.0)
    if ( strategy.position_size > 0 )
        strategy.exit(id="LONG",  stop=longStopPrice, comment="Long SL Trigger")

    else if ( strategy.position_size < 0 )
        strategy.exit(id="SHORT",  stop=shortStopPrice, comment="Short SL Trigger")



















আরো