
এটি একটি ট্রেডিং কৌশল যা ডাবল ম্যাকড সূচক এবং মূল্য আচরণ বিশ্লেষণের সাথে মিলিত। কৌশলটি 15 মিনিটের সময়কালে ডাবল ম্যাকড ডায়াগ্রামের রঙের পরিবর্তনগুলি পর্যবেক্ষণ করে বাজারের প্রবণতা নির্ধারণ করে, যখন 5 মিনিটের সময়কালে শক্তিশালী প্রবণতা সন্ধান করে এবং 1 মিনিটের সময়কালে বিরতির সংকেত নিশ্চিত করে। কৌশলটি এটিআর-ভিত্তিক গতিশীল স্টপ লস এবং ট্র্যাকিং স্টপ মেশিন ব্যবহার করে, ঝুঁকি কার্যকরভাবে পরিচালনা করার সময় লাভের সুযোগকে সর্বাধিক করে তোলে।
কৌশলটি বাজারের প্রবণতা নিশ্চিত করার জন্য দুটি ভিন্ন প্যারামিটারযুক্ত MACD সূচকের দুটি সেট ব্যবহার করে (৩৪/১৪৪/৯ এবং ১০০/২০০/৫০) । যখন দুটি MACD ডাইরেক্টরি একই রঙের প্রবণতা দেখায়, তখন সিস্টেমটি ৫ মিনিটের চার্টে শক্তিশালী ব্রেক মোডের সন্ধান করে, যা শ্যাডো লাইনের চেয়ে ১.৫ গুণ বড়। শক্তিশালী ব্রেক পাওয়া গেলে, সিস্টেমটি ১ মিনিটের চার্টে পর্যবেক্ষণ করে যে কোনও ব্রেক আছে কিনা। যখন একটি উচ্চ প্রবণতা একটি উচ্চ ব্রেক বা একটি নিম্ন প্রবণতা একটি নিম্ন ব্রেক হয়, সিস্টেমটি পজিশন বন্ধ করে দেয়। এটিআর সূচক সেটিংয়ের উপর ভিত্তি করে, এটিআর এর ১.৫ গুণ ব্যবহার করে গতিশীলতা ট্র্যাকিং স্টপ ব্রেক হিসাবে।
এটি প্রযুক্তিগত বিশ্লেষণ এবং ঝুঁকি ব্যবস্থাপনার একটি সমন্বিত কৌশলগত ব্যবস্থা। এটি মাল্টি-চক্র বিশ্লেষণ এবং কঠোর সংকেত ফিল্টারিংয়ের মাধ্যমে লেনদেনের গুণমান নিশ্চিত করে এবং গতিশীল স্টপ লস এবং ট্র্যাকিং স্টপ মেকানিজম ব্যবহার করে কার্যকরভাবে ঝুঁকি পরিচালনা করে। কৌশলটি শক্তিশালী অভিযোজনযোগ্য, তবে বাজারের পরিবেশের উপর নির্ভর করে ক্রমাগত অপ্টিমাইজেশনের প্রয়োজন। রিয়েল-টাইম অ্যাপ্লিকেশনের ক্ষেত্রে, প্রথমে পর্যাপ্ত প্রতিক্রিয়া এবং প্যারামিটার অপ্টিমাইজেশনের পরামর্শ দেওয়া হয় এবং বাজারের বৈশিষ্ট্যগুলির সাথে সংযুক্ত লক্ষ্যযুক্ত সমন্বয় করা হয়।
/*backtest
start: 2024-01-01 00:00:00
end: 2024-11-24 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// @version=5
strategy("Price Action + Double MACD Strategy with ATR Trailing", overlay=true)
// Inputs for MACD
fastLength1 = input.int(34, title="First MACD Fast Length")
slowLength1 = input.int(144, title="First MACD Slow Length")
signalLength1 = input.int(9, title="First MACD Signal Length")
fastLength2 = input.int(100, title="Second MACD Fast Length")
slowLength2 = input.int(200, title="Second MACD Slow Length")
signalLength2 = input.int(50, title="Second MACD Signal Length")
// Input for ATR Trailing
atrMultiplier = input.float(1.5, title="ATR Multiplier for Trailing")
// Inputs for Stop Loss
atrStopMultiplier = input.float(1.0, title="ATR Multiplier for Stop Loss")
// MACD Calculations
[macdLine1, signalLine1, macdHist1] = ta.macd(close, fastLength1, slowLength1, signalLength1)
[macdLine2, signalLine2, macdHist2] = ta.macd(close, fastLength2, slowLength2, signalLength2)
// Get 15M MACD histogram colors
macdHist1Color = request.security(syminfo.tickerid, "15", (macdHist1 >= 0 ? (macdHist1[1] < macdHist1 ? #26A69A : #B2DFDB) : (macdHist1[1] < macdHist1 ? #FFCDD2 : #FF5252)))
macdHist2Color = request.security(syminfo.tickerid, "15", (macdHist2 >= 0 ? (macdHist2[1] < macdHist2 ? #26A69A : #B2DFDB) : (macdHist2[1] < macdHist2 ? #FFCDD2 : #FF5252)))
// Check MACD color conditions
isMacdUptrend = macdHist1Color == #26A69A and macdHist2Color == #26A69A
isMacdDowntrend = macdHist1Color == #FF5252 and macdHist2Color == #FF5252
// Function to detect strong 5M candles
isStrongCandle(open, close, high, low) =>
body = math.abs(close - open)
tail = math.abs(high - low) - body
body > tail * 1.5 // Ensure body is larger than the tail
// Variables to track state
var float fiveMinuteHigh = na
var float fiveMinuteLow = na
var bool tradeExecuted = false
var bool breakoutDetected = false
var float entryPrice = na
var float stopLossPrice = na
var float longTakeProfit = na
var float shortTakeProfit = na
// Check for new 15M candle and reset flags
if ta.change(time("15"))
tradeExecuted := false // Reset trade execution flag
breakoutDetected := false // Reset breakout detection
if isStrongCandle(open[1], close[1], high[1], low[1])
fiveMinuteHigh := high[1]
fiveMinuteLow := low[1]
else
fiveMinuteHigh := na
fiveMinuteLow := na
// Get 1-minute close prices
close1m = request.security(syminfo.tickerid, "5", close)
// Ensure valid breakout direction and avoid double breakouts
if not na(fiveMinuteHigh) and not breakoutDetected
for i = 1 to 3
if close1m[i] > fiveMinuteHigh and not tradeExecuted // 1M breakout check with close
breakoutDetected := true
if isMacdUptrend
// Open Long trade
entryPrice := close
stopLossPrice := close - (atrStopMultiplier * ta.atr(14)) // ATR-based stop loss
longTakeProfit := close + (atrMultiplier * ta.atr(14)) // Initialize take profit
strategy.entry("Long", strategy.long)
tradeExecuted := true
break // Exit the loop after detecting a breakout
else if close1m[i] < fiveMinuteLow and not tradeExecuted // 1M breakout check with close
breakoutDetected := true
if isMacdDowntrend
// Open Short trade
entryPrice := close
stopLossPrice := close + (atrStopMultiplier * ta.atr(14)) // ATR-based stop loss
shortTakeProfit := close - (atrMultiplier * ta.atr(14)) // Initialize take profit
strategy.entry("Short", strategy.short)
tradeExecuted := true
break // Exit the loop after detecting a breakout
// Update trailing take-profit dynamically
if tradeExecuted and strategy.position_size > 0 // Long trade
longTakeProfit := math.max(longTakeProfit, close + (atrMultiplier * ta.atr(14)))
strategy.exit("Long TP/SL", "Long", stop=stopLossPrice, limit=longTakeProfit)
else if tradeExecuted and strategy.position_size < 0 // Short trade
shortTakeProfit := math.min(shortTakeProfit, close - (atrMultiplier * ta.atr(14)))
strategy.exit("Short TP/SL", "Short", stop=stopLossPrice, limit=shortTakeProfit)
// Reset trade state when position is closed
if strategy.position_size == 0
tradeExecuted := false
entryPrice := na
longTakeProfit := na
shortTakeProfit := na