বিপরীতমুখী স্বল্পমেয়াদী ব্রেকআউট ট্রেডিং কৌশল

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

img

সারসংক্ষেপ

এই কৌশলটি স্বল্পমেয়াদী বিপরীত ট্রেডিং সুযোগগুলি ক্যাপচার করার লক্ষ্যে। এটি N ধারাবাহিক আপ-বারের পরে শর্ট পজিশন খুলবে এবং M ধারাবাহিক ডাউন-বারের পরে বন্ধ পজিশন খুলবে। এটি টাইম ফ্রেম ফিল্টার এবং স্টপ লস / লাভের বৈশিষ্ট্যগুলিও অন্তর্ভুক্ত করে।

যুক্তি

  1. ইনপুট প্যারামিটারঃ পরপরের উপরের বার সংখ্যা N, পরপরের নিচের বার সংখ্যা M
  2. সংজ্ঞা:
    • ups up-bars এর সংখ্যা গণনা করে, price>price [1] তারপর +1, অন্যথায় 0 এ পুনরায় সেট করুন
    • ডিএনএস ডাউন-বারের সংখ্যা গণনা করে, দাম<মূল্য [1] তারপর +1, অন্যথায় 0 এ পুনরায় সেট করুন
  3. প্রবেশঃ ups≥N হলে সংক্ষিপ্ত; dns≥M হলে ঘনিষ্ঠ অবস্থান
  4. প্রস্থানঃ স্থির স্টপ লস/টেক প্রফিট বা সময়সীমার শেষ

সুবিধা

  1. স্বল্পমেয়াদী ট্রেডিংয়ের জন্য উপযুক্ত বিপরীতমুখী ট্রেডিংয়ের সুযোগগুলি ক্যাপচার করুন
  2. বিভিন্ন ট্রেডিং পরিকল্পনার জন্য ফিটনেস নির্ধারণের নমনীয় সময়সীমা
  3. ঝুঁকি ব্যবস্থাপনা সহজ করার জন্য অন্তর্নির্মিত স্টপ লস/ট্যাক লাভ

ঝুঁকি

  1. স্বল্পমেয়াদী রিভার্স ব্যর্থ হতে পারে এবং আবারও ক্ষতির দিকে পরিচালিত হতে পারে
  2. যুক্তিসঙ্গত N, M পরামিতি প্রয়োজন, খুব বড় বা ছোট অনুকূল নয়
  3. ভুল স্টপ টাইম সময় হ্রাস থামাতে সক্ষম নাও হতে পারে

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

  1. ট্রেন্ড ট্রেডিং এড়াতে ট্রেন্ড ইন্ডিকেটরের সাথে সংযুক্ত করুন
  2. পরামিতিগুলির গতিশীল সমন্বয় N, M
  3. স্টপ লস মেকানিজম অপ্টিমাইজ করুন

সিদ্ধান্ত

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


/*backtest
start: 2023-11-13 00:00:00
end: 2023-11-20 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4

// Strategy
strategy("Up/Down Short Strategy", overlay=true, initial_capital = 10000, default_qty_value = 10000, default_qty_type = strategy.cash)

// There will be no short entries, only exits from long.
strategy.risk.allow_entry_in(strategy.direction.short)

consecutiveBarsUp = input(1, title='Consecutive Bars Up')
consecutiveBarsDown = input(1, title='Consecutive Bars Down')

price = close

ups = 0.0
ups := price > price[1] ? nz(ups[1]) + 1 : 0

dns = 0.0
dns := price < price[1] ? nz(dns[1]) + 1 : 0

// Strategy Backtesting
startDate  = input(timestamp("2021-01-01T00:00:00"), type = input.time, title='Backtesting Start Date')
finishDate = input(timestamp("2021-12-31T00:00:00"), type = input.time, title='Backtesting End Date')

time_cond  = true

//Time Restriction Settings
startendtime = input("", title='Time Frame To Enter Trades')
enableclose = input(false, title='Enable Close Trade At End Of Time Frame')
timetobuy = (time(timeframe.period, startendtime))
timetoclose = na(time(timeframe.period, startendtime))

// Stop Loss & Take Profit Tick Based
enablesltp = input(false, title='Enable Take Profit & Stop Loss')
stopTick = input(5.0, title='Stop Loss Ticks', type=input.float) / 100
takeTick = input(10.0, title='Take Profit Ticks', type=input.float) / 100

longStop = strategy.position_avg_price - stopTick
shortStop = strategy.position_avg_price + stopTick
shortTake = strategy.position_avg_price - takeTick
longTake = strategy.position_avg_price + takeTick

plot(strategy.position_size > 0 and enablesltp ? longStop : na, style=plot.style_linebr, color=color.red, linewidth=1, title="Long Fixed SL")
plot(strategy.position_size < 0 and enablesltp ? shortStop : na, style=plot.style_linebr, color=color.red, linewidth=1, title="Short Fixed SL")
plot(strategy.position_size > 0 and enablesltp ? longTake : na, style=plot.style_linebr, color=color.green, linewidth=1, title="Long Take Profit")
plot(strategy.position_size < 0 and enablesltp ? shortTake : na, style=plot.style_linebr, color=color.green, linewidth=1, title="Short Take Profit")

// Alert messages
message_enterlong  = input("", title="Long Entry message")
message_entershort = input("", title="Short Entry message")
message_closelong = input("", title="Close Long message")
message_closeshort = input("", title="Close Short message")
message_takeprofit = input("", title="Take Profit message")
message_stoploss = input("", title="Stop Loss message")

// Strategy Execution
if (ups >= consecutiveBarsUp) and time_cond and timetobuy
    strategy.entry("Long", strategy.long, stop = high + syminfo.mintick, alert_message = message_enterlong)
    
if (dns >= consecutiveBarsDown) and time_cond and timetobuy
    strategy.entry("Short", strategy.short, stop = low + syminfo.mintick, alert_message = message_entershort)
    
if strategy.position_size > 0 and timetoclose and enableclose
    strategy.close_all(alert_message = message_closelong)
if strategy.position_size < 0 and timetoclose and enableclose
    strategy.close_all(alert_message = message_closeshort)
    
if strategy.position_size > 0 and enablesltp and time_cond
    strategy.exit(id="Close Long", stop=longStop, limit=longTake, alert_message = message_takeprofit)
if strategy.position_size < 0 and enablesltp and time_cond
    strategy.exit(id="Close Short", stop=shortStop, limit=shortTake, alert_message = message_stoploss)






আরো