ইম্পটেম রিভার্সাল ট্রেডিং কৌশল

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

সারসংক্ষেপ

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

ট্রেডিং লজিক

কৌশলটি বর্তমান প্রবণতা দিক নির্ধারণের জন্য তিনটি সূচক হিসাবে আরএসআই, স্টক এবং এমএসিডি ব্যবহার করে। নির্দিষ্ট যুক্তি হলঃ

  • আরএসআই (RSI) ৭ঃ ৫০ এর উপরে আরএসআই একটি আপট্রেন্ড নির্দেশ করে, যখন ৫০ এর নিচে একটি ডাউনট্রেন্ড নির্দেশ করে
  • Stoch ((%K, 14, 3, 3): %K এর ঊর্ধ্বে 50 হল আপট্রেন্ড, 50 এর নিচে ডাউনট্রেন্ড
  • এমএসিডি ((12, 26, 9): সিগন্যাল লাইনের উপরে এমএসিডি আপট্রেন্ড, নীচে ডাউনট্রেন্ড

যখন তিনটি সূচকই উত্থানমুখী হয়, তখন বার রঙটি সবুজ রঙে সেট করা হয়। যখন সব bearish হয়, তখন বার রঙটি লাল রঙে সেট করা হয়। যদি সূচকগুলির মধ্যে বিচ্যুতি থাকে, তবে বার রঙটি কালো রঙে সেট করা হয়।

ব্যবসায়ের নিয়ম হল:

  • যখন বর্তমান বারটি সবুজ এবং পূর্ববর্তী বারটি কালো বা লাল হয়, তখন লং যান। এন্ট্রি মূল্যটি বারটির সর্বোচ্চের 0.01 এর উপরে।
  • যখন বর্তমান বারটি লাল, এবং পূর্ববর্তী বারটি কালো বা সবুজ হয়, তখন শর্ট যান। এন্ট্রি মূল্য 0.01 বারটির নীচে।
  • যদি লং পজিশনের সময় বারটি লাল বা কালো হয়ে যায়, তাহলে লং ট্রেড বন্ধ করুন।
  • শর্ট পজিশনের সময় যদি বারটি সবুজ বা কালো হয়ে যায়, তাহলে শর্ট ট্রেড বন্ধ করুন।

কৌশলটি স্টপ লস এবং লাভ নেওয়ার জন্য এটিআর (এটিআর) ব্যবহার করে। স্টপ লসটি 1.5 গুণ এটিআর এবং লাভটি 3 গুণ এটিআর এ সেট করা হয়।

সুবিধা বিশ্লেষণ

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

  1. প্রবণতা নির্ধারণের জন্য একাধিক সূচক ব্যবহার করা মিথ্যা ব্রেকআউটকে কার্যকরভাবে ফিল্টার করতে পারে। যখন আরএসআই, স্টক এবং এমএসিডি একমত হয় তখন প্রবণতা বিপরীত হওয়ার উচ্চ সম্ভাবনা থাকে।

  2. এটিআর স্টপ লস এবং লাভের সেটিংগুলি যুক্তিসঙ্গত। এটিআর কার্যকরভাবে বাজারের অস্থিরতা ট্র্যাক করতে পারে। এটিআর এর বহুগুণ ব্যবহার করে, স্টপ এবং লক্ষ্যগুলি বাজারের অবস্থার উপর ভিত্তি করে গতিশীলভাবে সামঞ্জস্য করা যেতে পারে।

  3. সহজ এবং পরিষ্কার যুক্তি, সহজেই বোঝা যায় এবং স্বয়ংক্রিয় করা যায়। স্বয়ংক্রিয় ট্রেডিং কৌশল হিসেবে উপযুক্ত।

ঝুঁকি বিশ্লেষণ

এই কৌশলের ঝুঁকিগুলির মধ্যে রয়েছেঃ

  1. পৃথক সূচকগুলির ত্রুটিগুলি প্রবেশের সময়কে প্রভাবিত করতে পারে। ত্রুটিগুলি হ্রাস করতে প্যারামিটারগুলি সামঞ্জস্য করার বা আরও নিশ্চিতকরণ সূচক যুক্ত করার বিষয়টি বিবেচনা করতে পারে।

  2. এটিআর এর আকার স্টপ এবং লক্ষ্যমাত্রা উল্লেখযোগ্যভাবে প্রভাবিত করে। ভুল এটিআর গণনার ফলে স্টপগুলি খুব প্রশস্ত বা লক্ষ্যগুলি খুব সংকীর্ণ হতে পারে। এটিআর নিশ্চিত করতে অতিরিক্ত সূচক যুক্ত করতে পারে।

  3. প্রবণতা নির্ধারণের অভাব। বিপরীত ট্রেডিং উপর দৃষ্টি নিবদ্ধ করা, অপর্যাপ্ত প্রবণতা বিশ্লেষণ ব্যাপ্তি বাজারে whipsaws হতে পারে। প্রবণতা সূচক যোগ করতে পারেন।

  4. অতিরিক্ত ফিটিং ঝুঁকিঃ পরামিতি এবং নিয়মের দৃঢ়তা যাচাই করার জন্য পুঙ্খানুপুঙ্খ ব্যাকটেস্টিং প্রয়োজন।

উন্নতির দিকনির্দেশ

এই কৌশলটির সম্ভাব্য উন্নতিঃ

  1. রিভার্স পয়েন্ট নির্ধারণে নির্ভুলতা উন্নত করতে সূচকগুলি সামঞ্জস্য বা যোগ করা। উদাহরণস্বরূপ, অতিরিক্ত ক্রয় / অতিরিক্ত বিক্রয় স্তরগুলি পরীক্ষা করার জন্য বোলিংজার ব্যান্ড যুক্ত করা।

  2. অস্থিরতা আরও ভালভাবে ট্র্যাক করার জন্য ATR গণনা অপ্টিমাইজ করা। উদাহরণস্বরূপ ATR / মূল্য অনুপাত ব্যবহার করে।

  3. ট্রেন্ড ইন্ডিকেটর যোগ করা যা ব্যাপ্তি বাজারের সময় whipsaws এড়াতে পারে। উদাহরণস্বরূপ, চলমান গড়।

  4. অর্থ পরিচালনার অপ্টিমাইজেশান, যেমন ড্রাউনডাউনের ভিত্তিতে পজিশনের আকার সামঞ্জস্য করা।

  5. সময়সীমার মধ্যে স্থিতিশীলতা পরীক্ষা করার জন্য সময়ের অপ্টিমাইজেশান।

  6. নির্ভরযোগ্যতা যাচাই করার জন্য বিভিন্ন পণ্য এবং সময়সীমার উপর আরও ব্যাকটেস্টিং।

সংক্ষিপ্তসার

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


/*backtest
start: 2023-09-06 00:00:00
end: 2023-10-06 00:00:00
period: 2h
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/
// © jwitt98
//The PowerX strategy - based on the rules outlined in the book "The PowerX Strategy: How to Trade Stocks and Options in Only 15 Minutes a Day" by Markus Heitkoetter

//@version=5
strategy("PowerX", overlay=true)
strategy.initial_capital = 50000
longEntry = "Enter long"
shortEntry = "Enter short"
longExit = "Exit long"
shortExit = "Exit short"

//*********************************Begin inputs*********************************

//get time range inputs and set time range bool
timeRangeGroup = "Select the trading range"
startDate = input(timestamp("1 Jan 2021 00:00 +0000"), "Start date", "Select the start date for the trading range", "", timeRangeGroup)
endDate = input(timestamp("1 Jan 2050 00:00 +0000"), "End date", "Select the end date for the trading range", "", timeRangeGroup)
isInTimeRange = true

//get long/short inputs
positionsAllowedGroup = "Select the direction(s) of trades to allow"
isLongsAllowed = input.bool(true, "Allow long positions", "Check the box if you want to allow long positions", "", positionsAllowedGroup)
isShortsAllowed = input.bool(true, "Allow short positions", "Check the box if you want to allow short positions", "", positionsAllowedGroup)

//get the stop loss and profit target multiples.  Per the PowerX rules the ratio shoud be 1:2.  1.5 and 3 are defaults
adrMultuplesGroup="Select the multipliers for the stop loss and profit targets"
stopLossMultiple = input.float(1.5, "Stop loss multiple", 0.1, 10, 0.1, "The ADR is multiplied by the stop loss multiple to calculate the stop loss", group=adrMultuplesGroup)
profitTargetMultiple=input.float(3.0, "Profit target multiple", 0.1, 10, 0.1, "The ADR is multiplied by the profit target multiple to calculate the profit target", group=adrMultuplesGroup)

//get the option to use the money management stategy or not.  This is a fixed ratio type management system
moneyManagementGroup="Money management"
isUsingMoneyManagement=input.bool(false, "Use money management", "Check the box if you want to use a fixed ratio type money management system, such as the type described in PowerX", group=moneyManagementGroup)
initial_riskPercent=input.float(2.0, "Percent risk per trade", .1, 100, .1, "The percentage of capital you want to risk when starting out.  This will increase or decrease base on the money management rules.  Only applicable if money managent is used", group=moneyManagementGroup)/100
isRiskDowsideLimited=input.bool(false, "Keep risk at or above the set point", "Check the box if you don't want the risk to fall below the set \"risk per trade\" percentage, for example, when your equity is underwater. Only applicable if money management is used", "", moneyManagementGroup)
initial_riskPerTrade=initial_riskPercent * strategy.initial_capital 
riskFactor = 0.0
currentProfit = 0.0
currentRisk = 0.0

//*********************************End inputs*********************************

//*********************************Begin money management*********************************

if(isUsingMoneyManagement)
    currentProfit := strategy.equity - strategy.initial_capital
    if(currentProfit < 0)
        currentProfit:=math.abs(currentProfit)
        riskFactor := 0.5*(math.pow(1+8*currentProfit/(2*initial_riskPerTrade), 0.5)+1)
        currentRisk := 1/riskFactor * initial_riskPercent * strategy.initial_capital
        if(isRiskDowsideLimited)
            currentRisk := initial_riskPerTrade
    else
        riskFactor := 0.5*(math.pow(1+8*currentProfit/(2*initial_riskPerTrade), 0.5)+1)
        currentRisk := riskFactor * initial_riskPercent * strategy.initial_capital
        
plot(strategy.equity, "Strategy equity")
plot(currentRisk, "Current risk")
plot(riskFactor, "Risk Factor")

//*********************************End money management*********************************


//*********************************Begin indicators*********************************
//4 indicators are used in this strategy, RSI(7), Stochastics(14, 3, 3), MACD(12, 26, 9), and ADR(7)

rsiVal = ta.rsi(close, 7)//this checks out
plot(rsiVal, "RSI(7)", color.lime)

stochKVal = ta.sma(ta.sma(ta.stoch(close, high, low, 14),3),3)//this formula checks out
plot(stochKVal, "Stoch %K", color.lime)

[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
plot(histLine, "MACD Hist", color.lime)

adr = ta.sma(high, 7) - ta.sma(low, 7)
plot(adr, "Average daily range", color.orange)


//*********************************End indicators*********************************

//*********************************Define the bar colors*********************************

greenBar = rsiVal > 50 and stochKVal > 50 and histLine > 0
redBar = rsiVal < 50 and stochKVal < 50 and histLine < 0
blackBar = not greenBar and not redBar

color currentBarColor = switch
    greenBar => color.green
    redBar => color.red
    blackBar => color.gray //because black is too hard to see in dark mmode
    => color.yellow
    
barcolor(currentBarColor)

//*********************************End defining the bar colors*********************************

//*********************************Define the entry, stop loss and profit target*********************************

longStopLimit = high + .01
longProfitTarget = high + (profitTargetMultiple * adr)
longStopLoss = high - (stopLossMultiple * adr)

shortStopLimit = low - .01
shortProfitTarget = low - (profitTargetMultiple * adr)
shortStopLoss = low + (stopLossMultiple * adr)

qtyToTrade= math.floor(currentRisk / (stopLossMultiple * adr))//only if using money management
if(qtyToTrade * high > strategy.equity)
    qtyToTrade := math.floor(strategy.equity / high)

//*********************************End defining stop loss and profit targets*********************************

//*********************************Execute trades, set rules, stop loss and profit targets*********************************

if (greenBar and not greenBar[1] and isInTimeRange and isLongsAllowed)
    if(isUsingMoneyManagement)
        strategy.order(longEntry, strategy.long, qtyToTrade, limit=longStopLimit, stop=longStopLimit)
        //strategy.order(longEntry, strategy.long, qtyToTrade, stop=longStopLimit)
    else
        strategy.order(longEntry, strategy.long, limit=longStopLimit,stop=longStopLimit)
        //strategy.order(longEntry, strategy.long, stop=longStopLimit)
    strategy.exit("Long limit/stop", from_entry=longEntry, limit=longProfitTarget, stop=longStopLoss)
    

if(blackBar or redBar)
    strategy.cancel(longEntry)
    strategy.close(longEntry, longExit)
    

if (redBar and not redBar[1] and isInTimeRange and isShortsAllowed)
    if(isUsingMoneyManagement)
        strategy.order(shortEntry, strategy.short, qtyToTrade, limit=shortStopLimit, stop=shortStopLimit)
        //strategy.order(shortEntry, strategy.short, qtyToTrade, stop=shortStopLimit)
    else
        strategy.order(shortEntry, strategy.short, limit=shortStopLimit, stop=shortStopLimit)
        //strategy.order(shortEntry, strategy.short, stop=shortStopLimit)
    strategy.exit("Short limit/stop", from_entry=shortEntry, limit=shortProfitTarget, stop=shortStopLoss)

if(blackBar or greenBar)
    strategy.cancel(shortEntry)
    strategy.close(shortEntry, shortExit)
    

//*********************************End execute trades, set rules, stop loss and profit targets*********************************






















আরো