T3 এবং ATR এর উপর ভিত্তি করে স্বয়ংক্রিয় ট্র্যাকিং ট্রেন্ড কৌশল

লেখক:চাওঝাং, তারিখঃ 2024-01-03 11:58:25
ট্যাগঃ

img

সারসংক্ষেপ

এই কৌশলটির মূল বিষয় হল ট্রেন্ডের দিকনির্দেশ এবং ট্রেন্ড ট্র্যাক করার জন্য T3 সূচক মসৃণ চলমান গড় এবং ATR সূচক গতিশীল স্টপ লস ব্যবহার করা। কৌশলটি ট্রেন্ড ট্র্যাকিং এবং ট্রেন্ড বিপরীত সুযোগগুলিকে একত্রিত করে, ট্রেন্ডিং বাজারে বৃহত্তর মুনাফা অর্জনের লক্ষ্যে।

কৌশলগত যুক্তি

কৌশলটি মূল্যের মসৃণ চলমান গড় গণনা করতে T3 সূচক ব্যবহার করে এবং বর্তমান চক্রের গড় সত্য পরিসীমা গণনা করতে ATR সূচক ব্যবহার করে। যখন দামগুলি ATR গতিশীল স্টপ লসকে ভেঙে দেয় তখন ট্রেডিং সংকেত উত্পন্ন হয়। বিশেষত, যখন দামগুলি ATR স্টপ লস লাইনের উপরে ভেঙে যায় তখন একটি ক্রয় সংকেত উত্পন্ন হয় এবং যখন দামগুলি ATR স্টপ লস লাইনের নীচে ভেঙে যায় তখন একটি বিক্রয় সংকেত উত্পন্ন হয়।

মিথ্যা সংকেতগুলি ফিল্টার করার জন্য, কৌশলটি অতিরিক্তভাবে প্রয়োজন যে সিগন্যালটি নিশ্চিত করার আগে দামগুলিও T3 চলমান গড়টি অতিক্রম করতে হবে। উপরন্তু, কৌশলটি ঝুঁকি ব্যবস্থাপনা বাস্তবায়নের জন্য ATR মানগুলির উপর ভিত্তি করে স্টপ লস এবং মুনাফা গ্রহণের গণনা করে।

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

ঐতিহ্যগত চলমান গড়ের তুলনায়, টি 3 সূচকটির উচ্চ সংবেদনশীলতা এবং কম বিলম্ব রয়েছে, যা মূল্যের প্রবণতার পরিবর্তনগুলি দ্রুত ধরতে পারে। উপরন্তু, টি 3 এর গাণিতিক সুবিধা রয়েছে যা আরও সঠিক, মসৃণ চলমান গড় সরবরাহ করতে পারে।

এটিআর মান বাজারের বর্তমান অস্থিরতা এবং ঝুঁকি স্তরকে প্রতিফলিত করে। এটিআর ডায়নামিক ট্র্যাকিং স্টপ এবং মুনাফা প্রবণতা বাজারে বৃহত্তর মুনাফা অর্জনের জন্য এবং অস্থির বাজারে ক্ষতি হ্রাস করার জন্য গতিশীলভাবে অবস্থান আকার সামঞ্জস্য করতে পারে।

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

কৌশলটি সূচক গণনার উপর নির্ভর করে এবং ঝুঁকিগুলি সালিশ করা হয়। উপরন্তু, টি 3 মসৃণ চলমান গড় এবং এটিআর গতিশীল স্টপগুলির পিছনে সমস্যা রয়েছে যা দ্রুত মূল্য বিপরীতের সুযোগগুলি মিস করতে পারে। পরামিতিগুলি যথাযথভাবে সামঞ্জস্য করা যেতে পারে বা অপ্টিমাইজেশনের জন্য অন্যান্য সূচকগুলির সাথে একত্রিত করা যেতে পারে।

যখন প্রবণতা ওঠানামা এবং বিপরীত হয়, স্টপ লসগুলি আরও বড় ক্ষতির দিকে পরিচালিত করতে পারে। স্টপ লস ব্যাপ্তিগুলির যুক্তিসঙ্গত প্রসার বা হ্যান্ডেল নম্বর হিসাবে অন্যান্য পরামিতি ব্যবহার করে অনুসন্ধান করা যেতে পারে।

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

  • সংবেদনশীলতা বাড়াতে T3 সূচক প্যারামিটার সামঞ্জস্য করুন।

  • সর্বোত্তম মান খুঁজে পেতে বিভিন্ন ATR চক্র পরামিতি পরীক্ষা করুন।

  • সেরা প্যারামিটার নির্ধারণের জন্য বিভিন্ন ঝুঁকি পুরস্কার অনুপাত চেষ্টা করুন।

  • মুদ্রা প্রবাহ সূচকের মতো অন্যান্য সূচক ফিল্টার সংকেত যোগ করুন।

  • স্বয়ংক্রিয়ভাবে প্যারামিটার সমন্বয় অপ্টিমাইজ করার জন্য মেশিন লার্নিং পদ্ধতি ব্যবহার করুন।

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

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


/*backtest
start: 2023-12-26 00:00:00
end: 2024-01-02 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy(title='NinjaView Example 1 (UTBA "QuantNomad" Strategy)', overlay=true)
T3 = input(100)//600
// Input for Long Settings
// Input for Long Settings


xPrice3 = close
xe1 = ta.ema(xPrice3, T3)
xe2 = ta.ema(xe1, T3)
xe3 = ta.ema(xe2, T3)
xe4 = ta.ema(xe3, T3)
xe5 = ta.ema(xe4, T3)
xe6 = ta.ema(xe5, T3)

b3 = 0.7
c1 = -b3*b3*b3
c2 = 3*b3*b3+3*b3*b3*b3
c3 = -6*b3*b3-3*b3-3*b3*b3*b3
c4 = 1+3*b3+b3*b3*b3+3*b3*b3
nT3Average = c1 * xe6 + c2 * xe5 + c3 * xe4 + c4 * xe3

//plot(nT3Average, color=color.white, title="T3")

// Buy Signal - Price is below T3 Average
buySignal3 = xPrice3 < nT3Average
sellSignal3 = xPrice3 > nT3Average
// Inputs
a = input(1, title='Key Value. "This changes the sensitivity"')
c = input(50, title='ATR Period')
h = input(true, title='Signals from Heikin Ashi Candles')
riskRewardRatio = input(1, title='Risk Reward Ratio')

xATR = ta.atr(c)
nLoss = a * xATR

src = h ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=barmerge.lookahead_off) : close

xATRTrailingStop = 0.0
iff_1 = src > nz(xATRTrailingStop[1], 0) ? src - nLoss : src + nLoss
iff_2 = src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), src + nLoss) : iff_1
xATRTrailingStop := src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), src - nLoss) : iff_2

pos = 0
iff_3 = src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0) ? -1 : nz(pos[1], 0)
pos := src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0) ? 1 : iff_3

xcolor = pos == -1 ? color.red : pos == 1 ? color.green : color.blue

ema = ta.ema(src, 1)
above = ta.crossover(ema, xATRTrailingStop)
below = ta.crossunder(ema, xATRTrailingStop)

buy = src > xATRTrailingStop and above
sell = src < xATRTrailingStop and below

barbuy = src > xATRTrailingStop
barsell = src < xATRTrailingStop

plotshape(buy, title='Buy', text='Buy', style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), textcolor=color.new(color.white, 0), size=size.tiny)
plotshape(sell, title='Sell', text='Sell', style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.white, 0), size=size.tiny)

barcolor(barbuy ? color.new(color.green, 90) : na)
barcolor(barsell ? color.new(color.red, 90) : na)

var float entryPrice = na
var float takeProfitLong = na
var float stopLossLong = na
var float takeProfitShort = na
var float stopLossShort = na

if buy and buySignal3
    entryPrice := src
    takeProfitLong := entryPrice + nLoss * riskRewardRatio
    stopLossLong := entryPrice - nLoss
    takeProfitShort := na
    stopLossShort := na

if sell and sellSignal3
    entryPrice := src
    takeProfitShort := entryPrice - nLoss * riskRewardRatio
    stopLossShort := entryPrice + nLoss
    takeProfitLong := na
    stopLossLong := na

// Strategy order conditions
acct = "Sim101"
ticker = "ES 12-23"
qty = 1

OCOMarketLong = '{ "alert": "OCO Market Long", "account": "' + str.tostring(acct) + '", "ticker": "' + str.tostring(ticker) + '", "qty": "' + str.tostring(qty) + '", "take_profit_price": "' + str.tostring(takeProfitLong) + '", "stop_price": "' + str.tostring(stopLossLong) + '", "tif": "DAY" }'
OCOMarketShort = '{ "alert": "OCO Market Short", "account": "' + str.tostring(acct) + '", "ticker": "' + str.tostring(ticker) + '", "qty": "' + str.tostring(qty) + '", "take_profit_price": "' + str.tostring(takeProfitShort) + '", "stop_price": "' + str.tostring(stopLossShort) + '", "tif": "DAY" }'
CloseAll = '{ "alert": "Close All", "account": "' + str.tostring(acct) + '", "ticker": "' + str.tostring(ticker) + '" }'

strategy.entry("Long", strategy.long, when=buy and buySignal3, alert_message=OCOMarketLong)
strategy.entry("Short", strategy.short, when=sell and sellSignal3, alert_message=OCOMarketShort)

// Setting the take profit and stop loss for long trades
strategy.exit("Take Profit/Stop Loss", "Long", stop=stopLossLong, limit=takeProfitLong,alert_message=CloseAll)

// Setting the take profit and stop loss for short trades
strategy.exit("Take Profit/Stop Loss", "Short", stop=stopLossShort, limit=takeProfitShort,alert_message=CloseAll)

// Plot trade setup boxes
bgcolor(buy ? color.new(color.green, 90) : na, transp=0, offset=-1)
bgcolor(sell ? color.new(color.red, 90) : na, transp=0, offset=-1)

// longCondition = buy and not na(entryPrice)
// shortCondition = sell and not na(entryPrice)

// var line longTakeProfitLine = na
// var line longStopLossLine = na
// var line shortTakeProfitLine = na
// var line shortStopLossLine = na

// if longCondition
//     longTakeProfitLine := line.new(bar_index, takeProfitLong, bar_index + 1, takeProfitLong, color=color.green, width=2)
//     longStopLossLine := line.new(bar_index, stopLossLong, bar_index + 1, stopLossLong, color=color.red, width=2)
//     label.new(bar_index + 1, takeProfitLong, str.tostring(takeProfitLong, "#.#####"), color=color.green, style=label.style_none, textcolor=color.green, size=size.tiny)
//     label.new(bar_index + 1, stopLossLong, str.tostring(stopLossLong, "#.#####"), color=color.red, style=label.style_none, textcolor=color.red, size=size.tiny)

// if shortCondition
//     shortTakeProfitLine := line.new(bar_index, takeProfitShort, bar_index + 1, takeProfitShort, color=color.green, width=2)
//     shortStopLossLine := line.new(bar_index, stopLossShort, bar_index + 1, stopLossShort, color=color.red, width=2)
//     label.new(bar_index + 1, takeProfitShort, str.tostring(takeProfitShort, "#.#####"), color=color.green, style=label.style_none, textcolor=color.green, size=size.tiny)
//     label.new(bar_index + 1, stopLossShort, str.tostring(stopLossShort, "#.#####"), color=color.red, style=label.style_none, textcolor=color.red, size=size.tiny)

alertcondition(buy, 'UT Long', 'UT Long')
alertcondition(sell, 'UT Short', 'UT Short')


আরো