
এই কৌশলটি একটি পরিমাণগত ট্রেডিং সিস্টেম যা বাজারের ধারাবাহিক আন্দোলনের বৈশিষ্ট্যগুলির উপর ভিত্তি করে এবং দামের ধারাবাহিক উত্থান বা পতনের ফ্রিকোয়েন্সি বিশ্লেষণ করে বাজারের বিপরীতমুখী সুযোগগুলি ক্যাপচার করে। কৌশলটির মূল অংশটি হ’ল ধারাবাহিক উত্থান বা পতনের ঘাটতি নির্ধারণ করে, যখন ঘাটতি পৌঁছে যায় তখন বিপরীতমুখী অপারেশন করা হয়, যখন পজিশন হোল্ডিং সময় এবং কে-লাইনের আকারের মতো বহুমুখী সূচকগুলির সাথে একত্রিত হয়ে ট্রেডিং সিদ্ধান্ত নেওয়া হয়। এই কৌশলটি বাজারের বিপরীতমুখী বৈশিষ্ট্যগুলিকে পুরোপুরি কাজে লাগায়, যখন দামের ওভারবয় বা ওভারসেলের বৈশিষ্ট্য দেখা দেয় তখন বিপরীতমুখী অপারেশন করা হয়।
কৌশলটির মূল যুক্তিতে নিম্নলিখিত মূল উপাদানগুলি অন্তর্ভুক্ত রয়েছে:
এই কৌশলটি একটি পরিমাণগত ট্রেডিং সিস্টেম যা বাজারের বিপরীতমুখী বৈশিষ্ট্যগুলির উপর ভিত্তি করে, দামের ধারাবাহিক গতিবিধি বিশ্লেষণ করে বাজারের বিপরীতমুখী সুযোগগুলি ক্যাপচার করে। কৌশলটি যুক্তিসঙ্গতভাবে ডিজাইন করা হয়েছে, ঝুঁকি নিয়ন্ত্রণযোগ্য, তবে বাজারের পরিবেশের সাথে প্যারামিটারগুলি সামঞ্জস্য করা প্রয়োজন। ক্রমাগত অপ্টিমাইজেশন এবং পরিমার্জনের মাধ্যমে, কৌশলটি বাস্তব ব্যবসায়ের ক্ষেত্রে স্থিতিশীল উপার্জনের প্রত্যাশিত। বাস্তবতার আগে পর্যাপ্ত historicalতিহাসিক ডেটা ব্যাকআপ করার পরামর্শ দেওয়া হয় এবং কৌশলটির কার্যকারিতাটি অ্যানালগ ডিস্কে যাচাই করা হয়।
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-27 08:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Streak-Based Trading Strategy", overlay=true)
// User Inputs
trade_direction = input.string(title="Trade Direction", defval="Long", options=["Long", "Short"]) // Option to choose Long or Short
streak_threshold = input.int(title="Streak Threshold", defval=8, minval=1) // Input for number of streaks before trade
hold_duration = input.int(title="Hold Duration (in periods)", defval=7, minval=1) // Input for holding the position
doji_threshold = input.float(0.01, title="Doji Threshold (%)", minval=0.001) / 100 // Doji sensitivity
// Calculate win or loss streak
is_doji = math.abs(close - open) / (high - low) < doji_threshold
win = close > close[1] and not is_doji
loss = close < close[1] and not is_doji
// Initialize variables for streak counting
var int win_streak = 0
var int loss_streak = 0
var bool in_position = false
var int hold_counter = 0
// Track streaks (only when not in a position)
if not in_position
if win
win_streak += 1
loss_streak := 0
else if loss
loss_streak += 1
win_streak := 0
else
win_streak := 0
loss_streak := 0
// Logic for closing the position after the holding duration
if in_position
hold_counter -= 1
if hold_counter <= 0
strategy.close_all() // Close all positions
in_position := false // Reset position flag
win_streak := 0 // Reset streaks after position is closed
loss_streak := 0
// Trade condition (only when no position is open and streak is reached)
if not in_position
if trade_direction == "Long" and loss_streak >= streak_threshold
strategy.entry("Long", strategy.long) // Open a long position
in_position := true
hold_counter := hold_duration // Set holding period
if trade_direction == "Short" and win_streak >= streak_threshold
strategy.entry("Short", strategy.short) // Open a short position
in_position := true
hold_counter := hold_duration // Set holding period
// Plotting streaks for visualization
plot(win_streak, color=color.green, title="Winning Streak", style=plot.style_histogram, linewidth=2)
plot(loss_streak, color=color.red, title="Losing Streak", style=plot.style_histogram, linewidth=2)