
এই কৌশলটি প্রচলিত ট্রেন্ড ট্র্যাকিং পদ্ধতি ব্যবহার করে যা দ্বি-সমান-রেখা অতিক্রম করে এবং স্টপ লস, স্টপ-অফ, স্টপ-অফ-ট্র্যাকিং এবং অন্যান্য ঝুঁকি ব্যবস্থাপনার সাথে মিলিত হয় যা প্রবণতা পরিস্থিতির দ্বারা সৃষ্ট ঝুঁকি ক্যাপচার করে।
নিম্নলিখিত উপায়ে ঝুঁকি কমাতে পারেনঃ
এই কৌশলটি নিম্নলিখিত দিকগুলি থেকে উন্নত করা যেতে পারেঃ
এই কৌশলটি সামগ্রিকভাবে একটি আদর্শ দ্বি-ইএমএ সমান্তরাল প্রবণতা অনুসরণ কৌশল। ট্রেন্ড ট্রেন্ডিংয়ের সুবিধা রয়েছে, তবে স্টপ লস, স্টপ স্টপ, ট্র্যাকিং স্টপ লস ইত্যাদির মতো ঝুঁকি ব্যবস্থাপনার ব্যবস্থা রয়েছে। তবে কিছু সাধারণ সমস্যা রয়েছে, যেমন শব্দ এবং কম্পন ট্রেন্ডের উচ্চ সংবেদনশীলতা, সহজেই আটকা পড়ে। অন্যান্য সহায়ক সূচক, প্যারামিটার অপ্টিমাইজেশন, গতিশীল সামঞ্জস্য এবং সমন্বিত অপারেশন প্রবর্তন করে এই কৌশলটির কার্যকারিতা আরও বাড়ানো যেতে পারে। সামগ্রিকভাবে, যদি প্যারামিটারগুলি সঠিকভাবে সেট করা হয় এবং জাতের আচরণের সাথে সামঞ্জস্যপূর্ণ হয় তবে এই কৌশলটি ভাল ফলাফল অর্জন করতে পারে।
/*backtest
start: 2023-11-20 00:00:00
end: 2023-12-20 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy(title = "Strategy Code Example", shorttitle = "Strategy Code Example", overlay = true)
// Revision: 1
// Author: @JayRogers
//
// *** THIS IS JUST AN EXAMPLE OF STRATEGY RISK MANAGEMENT CODE IMPLEMENTATION ***
// === GENERAL INPUTS ===
// short ma
maFastSource = input(defval = open, title = "Fast MA Source")
maFastLength = input(defval = 14, title = "Fast MA Period", minval = 1)
// long ma
maSlowSource = input(defval = open, title = "Slow MA Source")
maSlowLength = input(defval = 21, title = "Slow MA Period", minval = 1)
// === STRATEGY RELATED INPUTS ===
tradeInvert = input(defval = false, title = "Invert Trade Direction?")
// the risk management inputs
inpTakeProfit = input(defval = 1000, title = "Take Profit", minval = 0)
inpStopLoss = input(defval = 200, title = "Stop Loss", minval = 0)
inpTrailStop = input(defval = 200, title = "Trailing Stop Loss", minval = 0)
inpTrailOffset = input(defval = 0, title = "Trailing Stop Loss Offset", minval = 0)
// === RISK MANAGEMENT VALUE PREP ===
// if an input is less than 1, assuming not wanted so we assign 'na' value to disable it.
useTakeProfit = inpTakeProfit >= 1 ? inpTakeProfit : na
useStopLoss = inpStopLoss >= 1 ? inpStopLoss : na
useTrailStop = inpTrailStop >= 1 ? inpTrailStop : na
useTrailOffset = inpTrailOffset >= 1 ? inpTrailOffset : na
// === SERIES SETUP ===
/// a couple of ma's..
maFast = ema(maFastSource, maFastLength)
maSlow = ema(maSlowSource, maSlowLength)
// === PLOTTING ===
fast = plot(maFast, title = "Fast MA", color = green, linewidth = 2, style = line, transp = 50)
slow = plot(maSlow, title = "Slow MA", color = red, linewidth = 2, style = line, transp = 50)
// === LOGIC ===
// is fast ma above slow ma?
aboveBelow = maFast >= maSlow ? true : false
// are we inverting our trade direction?
tradeDirection = tradeInvert ? aboveBelow ? false : true : aboveBelow ? true : false
// === STRATEGY - LONG POSITION EXECUTION ===
enterLong() => not tradeDirection[1] and tradeDirection // functions can be used to wrap up and work out complex conditions
exitLong() => tradeDirection[1] and not tradeDirection
strategy.entry(id = "Long", long = true, when = enterLong()) // use function or simple condition to decide when to get in
strategy.close(id = "Long", when = exitLong()) // ...and when to get out
// === STRATEGY - SHORT POSITION EXECUTION ===
enterShort() => tradeDirection[1] and not tradeDirection
exitShort() => not tradeDirection[1] and tradeDirection
strategy.entry(id = "Short", long = false, when = enterShort())
strategy.close(id = "Short", when = exitShort())
// === STRATEGY RISK MANAGEMENT EXECUTION ===
// finally, make use of all the earlier values we got prepped
strategy.exit("Exit Long", from_entry = "Long", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)
strategy.exit("Exit Short", from_entry = "Short", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)