
এই কৌশলটি একটি প্রবণতা ট্র্যাকিং ট্রেডিং সিস্টেম যা মাল্টি-টাইম ফ্রেম এলোমেলো সূচক ((Stochastic) এবং সূচকীয় চলমান গড় ((EMA) এর সাথে মিলিত। এটি উচ্চ টাইম ফ্রেম এলোমেলো সূচক দ্বারা ওভার-বিক্রয় ওভার-বিক্রয় শর্তগুলি বিচার করে, একই সাথে EMA কে প্রবণতা ফিল্টার হিসাবে ব্যবহার করে এবং ডায়নামিক পজিশন ম্যানেজমেন্ট এবং স্টপ লস ট্র্যাকিং বৈশিষ্ট্যগুলিকে সংহত করে, একটি সম্পূর্ণ ট্রেডিং কৌশল সিস্টেম।
এই কৌশলটি নিম্নলিখিত মূল উপাদানগুলির উপর ভিত্তি করে তৈরি করা হয়েছেঃ
এই কৌশলটি একাধিক টাইমফ্রেম বিশ্লেষণ এবং একাধিক সংকেত নিশ্চিতকরণ প্রক্রিয়া ব্যবহার করে, একটি ভাল ঝুঁকি ব্যবস্থাপনা ব্যবস্থার সাথে মিলিত হয়ে একটি মোটামুটি সম্পূর্ণ ট্রেডিং সিস্টেম তৈরি করে। যদিও কিছু ঝুঁকি রয়েছে, তবে ক্রমাগত অপ্টিমাইজেশন এবং উন্নতির মাধ্যমে এই কৌশলটি বিভিন্ন বাজার পরিবেশে স্থিতিশীল পারফরম্যান্স বজায় রাখার আশা করা হচ্ছে। এটি উচ্চ ঝুঁকি সহনশীলতা এবং কিছু ট্রেডিং অভিজ্ঞতা থাকা বিনিয়োগকারীদের জন্য উপযুক্ত।
/*backtest
start: 2024-02-19 00:00:00
end: 2025-02-17 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Ultimate fairas Oil", overlay=true)
// === Input Parameter ===
k_period = input(14, "K Period")
d_period = input(3, "D Period")
smooth_k = input(3, "Smooth K")
overbought = input(80, "Overbought Level")
oversold = input(20, "Oversold Level")
atrMult = input(1.5, "ATR Multiplier")
use_trailing_stop = input(true, "Enable Trailing Stop")
ema_length = input(50, "EMA Length")
risk_percent = input(2, "Risk per Trade (%)") / 100
account_balance = input(50000, "Account Balance")
mtf_tf = input.timeframe("D", "Higher Timeframe for Stochastic")
// === Multi-Timeframe Stochastic ===
stoch_source = request.security(syminfo.tickerid, mtf_tf, ta.stoch(close, high, low, k_period))
k = ta.sma(stoch_source, smooth_k)
// === Trend Filter (EMA) ===
ema = ta.ema(close, ema_length)
trendUp = close > ema
trendDown = close < ema
// === Entry Conditions ===
longCondition = ta.crossover(k, oversold) and trendUp
shortCondition = ta.crossunder(k, overbought) and trendDown
// === ATR-Based Stop Loss & Take Profit ===
atrValue = ta.atr(14)
stopLoss = atrMult * atrValue
takeProfit = 2 * stopLoss
// === Dynamic Lot Sizing (Risk Management) ===
risk_amount = account_balance * risk_percent
position_size = risk_amount / stopLoss
// === Trailing Stop Calculation ===
trailOffset = atrValue * 1.5
trailStopLong = use_trailing_stop ? close - trailOffset : na
trailStopShort = use_trailing_stop ? close + trailOffset : na
// === Execute Trades ===
if longCondition
strategy.entry("Long", strategy.long, qty=position_size)
strategy.exit("Exit Long", from_entry="Long", stop=close - stopLoss, limit=close + takeProfit, trail_points=use_trailing_stop ? trailOffset : na)
// // Labels & Lines
// label.new(x=bar_index, y=close, text="BUY", color=color.green, textcolor=color.white, size=size.small, style=label.style_label_down)
// label.new(x=bar_index, y=close + takeProfit, text="TP 🎯", color=color.blue, textcolor=color.white, size=size.tiny)
// label.new(x=bar_index, y=close - stopLoss, text="SL ❌", color=color.red, textcolor=color.white, size=size.tiny)
// line.new(x1=bar_index, y1=close + takeProfit, x2=bar_index + 5, y2=close + takeProfit, width=2, color=color.blue)
// line.new(x1=bar_index, y1=close - stopLoss, x2=bar_index + 5, y2=close - stopLoss, width=2, color=color.red)
// Alert
alert("BUY Signal! TP: " + str.tostring(close + takeProfit) + ", SL: " + str.tostring(close - stopLoss) + ", Lot Size: " + str.tostring(position_size), alert.freq_once_per_bar_close)
if shortCondition
strategy.entry("Short", strategy.short, qty=position_size)
strategy.exit("Exit Short", from_entry="Short", stop=close + stopLoss, limit=close - takeProfit, trail_points=use_trailing_stop ? trailOffset : na)
// // Labels & Lines
// label.new(x=bar_index, y=close, text="SELL", color=color.red, textcolor=color.white, size=size.small, style=label.style_label_up)
// label.new(x=bar_index, y=close - takeProfit, text="TP 🎯", color=color.blue, textcolor=color.white, size=size.tiny)
// label.new(x=bar_index, y=close + stopLoss, text="SL ❌", color=color.green, textcolor=color.white, size=size.tiny)
// line.new(x1=bar_index, y1=close - takeProfit, x2=bar_index + 5, y2=close - takeProfit, width=2, color=color.blue)
// line.new(x1=bar_index, y1=close + stopLoss, x2=bar_index + 5, y2=close + stopLoss, width=2, color=color.green)
// Alert
alert("SELL Signal! TP: " + str.tostring(close - takeProfit) + ", SL: " + str.tostring(close + stopLoss) + ", Lot Size: " + str.tostring(position_size), alert.freq_once_per_bar_close)