
এটি একটি এটিআর ডায়নামিক অ্যাডজাস্টমেন্ট ভিত্তিক ট্রেন্ড ট্র্যাকিং কৌশল যা প্রবেশ এবং প্রস্থান নির্ধারণের জন্য চলমান গড় এবং এটিআর সূচককে একত্রিত করে। এই কৌশলটির মূল বৈশিষ্ট্য হল এটিআর ডায়নামিক অ্যাডজাস্টমেন্টের মাধ্যমে চলমান গড়ের উপরে-নিচে ট্র্যাকিং করা, যখন দামটি ট্র্যাকে উঠে যায় তখন বেশি প্রবেশ করা, এবং এটিআর গুণিতকরণের উপর ভিত্তি করে স্টপ লস এবং স্টপ পয়েন্ট সেট করা। একই সাথে, কৌশলটিতে একটি উদ্ভাবনী পুনরায় প্রবেশের ব্যবস্থা রয়েছে যা যখন দামটি প্রবেশের স্থানে ফিরে আসে তখন পুনরায় পজিশনের অনুমতি দেয়।
এই কৌশলটি নিম্নলিখিত মূল উপাদানগুলির উপর ভিত্তি করে কাজ করেঃ
এটি একটি যুক্তিসঙ্গত, যুক্তিসঙ্গতভাবে ডিজাইন করা ট্রেন্ড ট্র্যাকিং কৌশল যা এটিআর গতিশীল সামঞ্জস্যের মাধ্যমে ভাল বাজারের অভিযোজনযোগ্যতা সরবরাহ করে। কৌশলটির পুনরায় প্রবেশের প্রক্রিয়াটি একটি উদ্ভাবনী বিন্দু যা ভাল বাজারের পরিস্থিতিতে অতিরিক্ত মুনাফা অর্জনের সুযোগ সরবরাহ করতে পারে। যদিও কিছু ঝুঁকি রয়েছে যা মনোযোগের প্রয়োজন, তবে প্রস্তাবিত অপ্টিমাইজেশনের দিকনির্দেশের মাধ্যমে কৌশলটির স্থিতিশীলতা এবং লাভজনকতা আরও বাড়ানো যেতে পারে।
/*backtest
start: 2024-02-19 00:00:00
end: 2025-02-16 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("KON SET By Sai", overlay=true, max_lines_count=40)
// INPUTS
length = input.int(10, "Trend Length")
target_multiplier = input.int(0, "Set Targets") // Target adjustment
max_bars = 30 // Number of bars to display the lines after signal
// VARIABLES
var bool inTrade = false
var float entryPrice = na
var float stopLoss = na
var float targetPrice = na
var int barCount = na // Counter to track how many bars have passed since signal
// ATR for stop-loss and target calculation
atr_value = ta.sma(ta.atr(200), 200) * 0.8
// Moving averages for trend detection
sma_high = ta.sma(high, length) + atr_value
sma_low = ta.sma(low, length) - atr_value
// Signal conditions for trend changes
signal_up = ta.crossover(close, sma_high)
signal_down = ta.crossunder(close, sma_low)
// Entry conditions
if not inTrade and signal_up
entryPrice := close
stopLoss := close - atr_value * 2
targetPrice := close + atr_value * (5 + target_multiplier)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop=stopLoss, limit=targetPrice)
inTrade := true
barCount := 0 // Reset bar count when signal occurs
// Exit conditions
if inTrade and (close <= stopLoss or close >= targetPrice)
inTrade := false
entryPrice := na
stopLoss := na
targetPrice := na
barCount := na // Reset bar count on exit
// Re-entry logic
if not inTrade and close == entryPrice
entryPrice := close
stopLoss := close - atr_value * 2
targetPrice := close + atr_value * (5 + target_multiplier)
strategy.entry("Re-Long", strategy.long)
strategy.exit("Re-Exit Long", "Re-Long", stop=stopLoss, limit=targetPrice)
inTrade := true
barCount := 0 // Reset bar count when re-entry happens
// Count bars since the signal appeared (max 30 bars)
if inTrade and barCount < max_bars
barCount := barCount + 1
// Plotting lines for entry, stop-loss, and targets (Only during active trade and within max_bars)
entry_line = plot(inTrade and barCount <= max_bars ? entryPrice : na, title="Entry Price", color=color.new(color.green, 0), linewidth=1, style=plot.style_cross)
sl_line = plot(inTrade and barCount <= max_bars ? stopLoss : na, title="Stop Loss", color=color.new(color.red, 0), linewidth=1, style=plot.style_cross)
target_line = plot(inTrade and barCount <= max_bars ? targetPrice : na, title="Target Price", color=color.new(color.blue, 0), linewidth=1, style=plot.style_cross)
// Background color between entry and target/stop-loss (Only when inTrade and within max_bars)
fill(entry_line, target_line, color=color.new(color.green, 90), title="Target Zone")
fill(entry_line, sl_line, color=color.new(color.red, 90), title="Stop-Loss Zone")
// Label updates (reduce overlap and clutter)
if bar_index % 50 == 0 and inTrade and barCount <= max_bars // Adjust label frequency for performance
label.new(bar_index + 1, entryPrice, text="Entry: " + str.tostring(entryPrice, "#.##"), style=label.style_label_left, color=color.green, textcolor=color.white, size=size.small)
label.new(bar_index + 1, stopLoss, text="Stop Loss: " + str.tostring(stopLoss, "#.##"), style=label.style_label_left, color=color.red, textcolor=color.white, size=size.small)
label.new(bar_index + 1, targetPrice, text="Target: " + str.tostring(targetPrice, "#.##"), style=label.style_label_left, color=color.blue, textcolor=color.white, size=size.small)