YinYang RSI ভলিউম ট্রেডিং কৌশল

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

img

সারসংক্ষেপ

এই কৌশলটি একটি প্রবণতা অনুসরণকারী কৌশল যা প্রবণতার দিক নির্ধারণ এবং প্রবণতা অনুসরণ করার জন্য আপেক্ষিক শক্তি সূচক (আরএসআই) এবং ভলিউমের সংমিশ্রণ ব্যবহার করে। মূল পয়েন্টগুলির মধ্যে রয়েছেঃ

  1. মিডলাইন গণনা করতে ভলিউম ওয়েটেড মুভিং এভারেজ ব্যবহার করা এবং ট্রেন্ড মিডপয়েন্ট নির্ধারণের জন্য ভলিউম তথ্য অন্তর্ভুক্ত করা
  2. মিডলাইন ভিত্তিক ক্রয় অঞ্চল এবং বিক্রয় অঞ্চল স্থাপন
  3. ক্রয় অঞ্চল এবং বিক্রয় অঞ্চল পরিসীমা সামঞ্জস্য করার জন্য RSI তথ্য ব্যবহার করে
  4. ক্রয়/বিক্রয় অঞ্চলে প্রবেশের পর স্টপ লস এবং লাভ নেওয়ার সেটিং
  5. পুনরায় প্রবেশের যন্ত্র আছে

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

এই কৌশল নিম্নলিখিত সূচক এবং পরামিতি ব্যবহার করেঃ

  • মিডলাইনঃ প্রবণতার মধ্যপন্থী নির্ধারণের জন্য নির্দিষ্ট সময়কালে সর্বোচ্চ এবং সর্বনিম্ন মূল্যের ভলিউম ওজনযুক্ত চলমান গড়
  • RSI: নির্দিষ্ট সময়ের মধ্যে গণনা করা Relative Strength Index, 0-1 পরিসরে রূপান্তরিত
  • ক্রয় অঞ্চলঃ মধ্যরেখা যোগ করা হয়েছে আরএসআই সংশোধিত পরিমাণ একটি নির্দিষ্ট অনুপাত, লং এন্ট্রি যখন মূল্য প্রবেশ করে
  • বিক্রয় অঞ্চলঃ মধ্যরেখা বিয়োগ করা হয়েছে আরএসআই সংশোধিত পরিমাণ নির্দিষ্ট অনুপাত, যখন মূল্য প্রবেশ করে তখন সংক্ষিপ্ত প্রবেশ
  • মুনাফা গ্রহণের লাইন: মিডলাইন
  • স্টপ লস লাইনঃ ক্রয় অঞ্চলের নীচে/বিক্রয় অঞ্চলের উপরে নির্দিষ্ট শতাংশ

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

সুবিধা

এই কৌশলটির সুবিধাগুলির মধ্যে রয়েছেঃ

  1. প্রবণতা চিহ্নিত করতে RSI এবং ভলিউম উভয় ব্যবহার করে, নির্ভুলতা উন্নত
  2. আরএসআই প্যারামিটারাইজড সমন্বয় প্রকৃত প্রবণতার সাথে কেনা/বিক্রয় অঞ্চলকে আরও ভালভাবে মানিয়ে নেয়
  3. ভলিউম তথ্য মূল্যের ক্রিয়াকলাপকে উচ্চতর ওজন দেয়, মধ্যরেখা আরও সঠিক করে তোলে
  4. ঝুঁকি নিয়ন্ত্রণের জন্য স্টপ লস প্রক্রিয়া থাকা
  5. পুনরায় প্রবেশের অনুমতি দেয়, ভুয়া ব্রেকআউটের ঝুঁকি হ্রাস করে

ঝুঁকি

এছাড়াও কিছু ঝুঁকি আছেঃ

  1. ভুল RSI এবং ভলিউম পরামিতি ক্রয়/বিক্রয় অঞ্চলের নির্ভুলতা প্রভাবিত করতে পারে
  2. মিডলাইন সঠিকভাবে প্রবণতা নির্ধারণ করতে ব্যর্থ হতে পারে, যা মিথ্যা ব্রেকআউট সৃষ্টি করে
  3. স্টপ লস খুব বড় হতে পারে
  4. পুনরায় প্রবেশের ফলে অত্যধিক লেনদেন হতে পারে

সমাধান:

  1. বাজারের অবস্থার সাথে সামঞ্জস্য রেখে RSI এবং ভলিউম চক্র সামঞ্জস্য করুন
  2. ক্রয়/বিক্রয় সংকেত যাচাই করার জন্য অন্যান্য সূচক ব্যবহার করুন
  3. হ্রাস সীমাবদ্ধ করার জন্য স্টপ লসকে কঠোর করুন
  4. অতিরিক্ত লেনদেন রোধ করার জন্য প্রতিদিনের লেনদেনের সীমা নির্ধারণ করুন

অপ্টিমাইজেশন

এই কৌশলটি নিম্নলিখিতগুলির মাধ্যমে অপ্টিমাইজ করা যেতে পারেঃ

  1. সিগন্যাল যাচাই করার জন্য অন্যান্য সূচক চেষ্টা করা যেমন মোমবাতি, অস্থিরতা সূচক ইত্যাদি
  2. পজিশনের আকার নির্ধারণের যন্ত্রপাতি যোগ করা যেমন পিরামিড বিজয়ী
  3. ক্রয়/বিক্রয় অঞ্চল সঠিকতা উন্নত করতে মেশিন লার্নিং অ্যালগরিদম ব্যবহার
  4. স্টপ লস এবং লাভের জন্য সর্বোত্তম পরামিতি মূল্যায়ন করা
  5. পরামিতি বিভিন্ন পণ্যের জন্য পৃথক পরীক্ষা এবং অপ্টিমাইজেশান প্রয়োজন

সিদ্ধান্ত

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


/*backtest
start: 2023-11-21 00:00:00
end: 2023-12-21 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/
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@    ,@@@@@@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@      @@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@        @@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         @@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@        .@@@@@@@@@@@@@@@            @@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@          *@@@@@@@@@@@@@@             @@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         @@@@@@@@@@@@@@@               @@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@     @@@@@@@@@@@@@@@@                 @@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                  @@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.                    @@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                      @@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.                         @
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                             @
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,                                       @
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                                                @
// @@@@@@@@@@@@@@@@@@@@@@@@@@@                                                    @
// @@@@@@@@@@@@@@@@@@@@@@@@@                                                     @@
// @@@@@@@@@@@@@@@@@@@@@@@                                                       @@
// @@@@@@@@@@@@@@@@@@@@@@                                                       @@@
// @@@@@@@@@@@@@@@@@@@@@*                @@@@@                                 @@@@
// @@@@@@@@@@@@@@@@@@@@@               @@@@@@@@@                              @@@@@
// @@@@@@@@@@@@@@@@@@@@@              @@@@@@@@@@@                           @@@@@@@
// @@@@@@@@@@@@@@@@@@@@@               @@@@@@@@%                           @@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@                                                @@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@                                            @@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@                                        %@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@                                   @@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@                           @@@@@@@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// © YinYangAlgorithms

//@version=5
strategy("YinYang RSI Volume Trend Strategy", shorttitle="YinYang RSVT Strategy", overlay=true )
// ~~~~~~~~~~~ INPUTS ~~~~~~~~~~~ //
len = input.int(80, "Trend Length:", tooltip="How far back should we span this indicator?\nThis length effects all lengths of the indicator")
purchaseSrc = input.source(close, "Purchase Source (Long and Short):", tooltip="What source needs to exit the purchase zone for a purchase to happen?")
exitSrc = input.source(close, "Exit Source (Long and Short):", tooltip="What source needs to hit a exit condition to stop the trade (Take profit, Stop Loss or hitting the other sides Purchase Zone)?")
useTakeProfit = input.bool(true, "Use Take Profit", tooltip="Should we take profit IF we cross the basis line and then cross it AGAIN?")
useStopLoss = input.bool(true, "Use Stop Loss", tooltip="Stop loss will ensure you don't lose too much if its a bad call")
stopLossMult = input.float(0.1, "Stoploss Multiplier %:", tooltip="How far from the purchase lines should the stop loss be")
resetCondition = input.string("Entry", "Reset Purchase Availability After:", options=["Entry", "Stop Loss", "None"],
 tooltip="If we reset after a condition is hit, this means we can purchase again when the purchase condition is met. \n" +
 "Otherwise, we will only purchase after an opposite signal has appeared.\n" +
 "Entry: means when the close enters the purchase zone (buy or sell).\n" +
 "Stop Loss: means when the close hits the stop loss location (even when were out of a trade)\n" +
 "This allows us to get more trades and also if our stop loss initally was hit but it WAS a good time to purchase, we don't lose that chance.")

// ~~~~~~~~~~~ VARIABLES ~~~~~~~~~~~ //
var bool longStart = na
var bool longAvailable = na
var bool longTakeProfitAvailable = na
var bool longStopLoss = na
var bool shortStart = na
var bool shortAvailable = na
var bool shortTakeProfitAvailable = na
var bool shortStopLoss = na

resetAfterStopLoss = resetCondition == "Stop Loss"
resetAfterEntry = resetCondition == "Entry"

// ~~~~~~~~~~~ CALCULATIONS ~~~~~~~~~~~ //
// Mid Line
midHigh = ta.vwma(ta.highest(high, len), len)
midLow = ta.vwma(ta.lowest(low, len), len)
mid = math.avg(midHigh, midLow)
midSmoothed = ta.ema(mid, len)

//Volume Filtered
avgVol = ta.vwma(volume, len)
volDiff = volume / avgVol
midVolSmoothed = ta.vwma(midSmoothed * volDiff, 3)

//RSI Filtered
midDifference = ta.sma(midHigh - midLow, len)
midRSI = ta.rsi(midVolSmoothed, len) * 0.01
midAdd = midRSI * midDifference

//Calculate Zones
purchaseZoneHigh = midSmoothed + midAdd
purchaseZoneLow = midSmoothed - midAdd
purchaseZoneBasis = math.avg(purchaseZoneHigh, purchaseZoneLow)

//Create Stop Loss Locations
stopLossHigh = purchaseZoneHigh * (1 + (stopLossMult * 0.01))
stopLossLow = purchaseZoneLow * (1 - (stopLossMult * 0.01))

// ~~~~~~~~~~~ PURCHASE CALCULATIONS ~~~~~~~~~~~ //
//Long
longEntry = ta.crossunder(purchaseSrc, purchaseZoneLow)
longStart := ta.crossover(purchaseSrc, purchaseZoneLow) and longAvailable
longAvailable := ta.crossunder(purchaseSrc, purchaseZoneHigh) or (resetAfterStopLoss and longStopLoss) or (resetAfterEntry and longEntry) ? true : longStart ? false : longAvailable[1]
longEnd = ta.crossover(exitSrc, purchaseZoneHigh)
longStopLoss := ta.crossunder(exitSrc, stopLossLow)
longTakeProfitAvailable := ta.crossover(exitSrc, purchaseZoneBasis) ? true : longEnd ? false : longTakeProfitAvailable[1]
longTakeProfit = ta.crossunder(exitSrc, purchaseZoneBasis) and longTakeProfitAvailable

//Short
shortEntry = ta.crossover(purchaseSrc, purchaseZoneHigh)
shortStart := ta.crossunder(purchaseSrc, purchaseZoneHigh) and shortAvailable
shortAvailable := ta.crossover(purchaseSrc, purchaseZoneLow) or (resetAfterStopLoss and shortStopLoss) or (resetAfterEntry and shortEntry)? true : shortStart ? false : shortAvailable[1]
shortEnd = ta.crossunder(exitSrc, purchaseZoneLow)
shortStopLoss := ta.crossover(exitSrc, stopLossHigh)
shortTakeProfitAvailable := ta.crossunder(exitSrc, purchaseZoneBasis) ? true : shortEnd ? false : shortTakeProfitAvailable[1]
shortTakeProfit = ta.crossover(exitSrc, purchaseZoneBasis) and shortTakeProfitAvailable

// ~~~~~~~~~~~ PLOTS ~~~~~~~~~~~ //
shortLine = plot(purchaseZoneHigh, color=color.green)
shortStopLossLine = plot(stopLossHigh, color=color.green) //color=color.rgb(0, 97, 3)
fill(shortLine, shortStopLossLine, color = color.new(color.green, 90))
plot(purchaseZoneBasis, color=color.white)
longLine = plot(purchaseZoneLow, color=color.red)
longStopLossLine = plot(stopLossLow, color=color.red) //color=color.rgb(105, 0, 0)
fill(longLine, longStopLossLine, color=color.new(color.red, 90))

// ~~~~~~~~~~~ STRATEGY ~~~~~~~~~~~ //
if (longStart)
    strategy.entry("buy", strategy.long)
else if (longEnd or (useStopLoss and longStopLoss) or (useTakeProfit and longTakeProfit))
    strategy.close("buy")

if (shortStart)
    strategy.entry("sell", strategy.short)
else if (shortEnd or (useStopLoss and shortStopLoss) or (useTakeProfit and shortTakeProfit))
    strategy.close("sell")

// ~~~~~~~~~~~ ALERTS ~~~~~~~~~~~ //
if longStart or (longEnd or (useStopLoss and longStopLoss) or (useTakeProfit and longTakeProfit)) or shortStart or (shortEnd or (useStopLoss and shortStopLoss) or (useTakeProfit and shortTakeProfit))
    alert("{{strategy.order.action}} | {{ticker}} | {{close}}", alert.freq_once_per_bar)

আরো