এই কৌশলটির মূল ধারণাটি হ’ল সমান্তরাল ফর্কটি অতিরিক্ত, সমান্তরাল ডাই ফর্কটি খালি করা এবং পজিশনে প্রবেশের পরে ট্র্যাকিং স্টপ সেট করা। যখন দাম নির্ধারিত স্টপ লাইনে পৌঁছে যায়, তখন ট্র্যাকিং স্টপটি ট্রিগার করা হয়, ক্রমাগত স্টপ লাইনটি সামঞ্জস্য করে, সর্বাধিক লাভের জন্য।
এই কৌশলটি মূলত নিম্নলিখিত অংশে বিভক্তঃ
দ্রুত গড় এবং ধীর গড় গণনা করুন। এখানে দ্রুত গড়ের সময়কাল 20 এবং ধীর গড়ের সময়কাল 50।
প্রবেশের শর্ত নির্ধারণ করুন: দ্রুত গড়রেখার উপর ধীর গড়রেখার উপর বেশি করুন; দ্রুত গড়রেখার নীচে ধীর গড়রেখার উপর খালি করুন।
ট্রেন্ডের দিকনির্দেশনা নির্ধারণ করুন। অতিরিক্ত এবং খালি বারের সংখ্যা রেকর্ড করুন এবং বর্তমান প্রবণতাটি মাল্টি-হেড বা বায়ু-হেড প্রবণতা কিনা তা নির্ধারণ করুন।
প্রবেশের মূল্য ট্রেডিং সিগন্যাল প্রেরণের সময় মূল্য প্রবেশের মূল্য হিসাবে রেকর্ড করা হয়
সেট স্টপ লাইন অতিরিক্ত কাজ করার সময়, এটি উচ্চতর হবে(১+ স্টপ শতাংশ) স্টপ হিসাবে; যখন খালি, এটি সর্বনিম্ন হবে(১-স্টপিং শতাংশ) স্টপিং হিসাবে।
ট্র্যাকিং স্টপ। স্টপ লাইনটি ক্রমাগত সামঞ্জস্যপূর্ণ, যখন অনুকূল দিকের দিকে চলে যায়, তখন মুনাফার সর্বাধিকীকরণের জন্য অনুকূল দিকের দিকে স্থির শতাংশে চলতে থাকে।
স্টপ লাইন ট্রিগার। যখন দাম স্টপ লাইন স্পর্শ করে, তখন পজিশন স্টপ হয়।
এছাড়াও একটি অপশনাল স্টার্টআপ ফাংশন রয়েছে। এটি একটি স্টার্টআপ স্টপ লাইন সেট করে, যা কেবলমাত্র যখন দামটি প্রথমবারের মতো এই লাইনটি অতিক্রম করে তখন ট্র্যাকিং স্টপটি ট্রিগার করে।
এই কৌশলটির সবচেয়ে বড় সুবিধা হল ট্র্যাকিং স্টপ ব্যবহার করা, যা মুনাফা সর্বাধিক করতে পারে। যখন বাজারটি অনুকূল দিকে চলে, তখন স্টপ লাইনটি অনুকূল দিকের দিকে ধীরে ধীরে চলে যায়, যাতে মুনাফা নিশ্চিত হয়।
এছাড়াও, কৌশলটিতে একটি গড়-রেখাযুক্ত ট্রেন্ড ফিল্টার অন্তর্ভুক্ত করা হয়েছে, যা ট্রেন্ডিং বাজারগুলিতে অপ্রয়োজনীয় পুনরাবৃত্তিমূলক অবস্থানগুলি হ্রাস করতে পারে। স্টার্টআপ ফাংশনটি অন্তর্ভুক্ত করা হয়েছে যাতে দামের ছোট্ট ঝাঁকুনিগুলি ট্র্যাকিং স্টপগুলিকে ট্রিগার না করে।
সুতরাং, এই কৌশলটি প্রবণতা নির্ণয়, প্রবেশের শর্ত এবং স্টপ-অফ কৌশলগুলির বিভিন্ন দিককে একত্রিত করে, যা প্রবণতা চলাকালীন চলতে থাকে এবং সর্বাধিক উপার্জন করতে পারে।
এই কৌশলটির প্রধান ঝুঁকি হল যে স্টপ-আপের জন্য পর্যাপ্ত মার্কেটিং স্পেস থাকা আবশ্যক। যদি মার্কেটিং খুব তাড়াতাড়ি বিপরীত হয়, তাহলে ক্ষতি হতে পারে।
এছাড়া, ঘন ঘন ট্রিগার করা স্টপলিং লাইনের কারণে ভূমিকম্পের সময় ক্ষয়ক্ষতি হতে পারে।
অবশেষে, যদি প্যারামিটারগুলি ভুলভাবে সেট করা হয়, যেমন স্ট্যাম্পের অনুপাত খুব বেশি, তবে ঝুঁকি বাড়বে।
স্টপ-অফ-রেজোলিউশনের মাধ্যমে ঝুঁকি নিয়ন্ত্রণ করা যেতে পারে, যেমন স্টপ-অফ-রেজোলিউশনের মাধ্যমে ঝুঁকি নিয়ন্ত্রণ করা যায়।
এই কৌশলটি নিম্নলিখিত দিকগুলি থেকে অপ্টিমাইজ করা যেতে পারেঃ
গড়রেখার প্যারামিটার অপ্টিমাইজেশান. আপনি বিভিন্ন গড়রেখার প্যারামিটার পরীক্ষা করতে পারেন এবং আরও উপযুক্ত সমন্বয় খুঁজে পেতে পারেন।
স্টার্টআপ ফাংশন অপ্টিমাইজ করুন। আপনি বিভিন্ন স্টার্টআপ স্টপ আকার পরীক্ষা করতে পারেন এবং আরও উপযুক্ত সেটিংস খুঁজে পেতে পারেন।
থাম্ব অনুপাত অপ্টিমাইজেশান. আপনি ফিডব্যাক দ্বারা আরও উপযুক্ত থাম্ব অনুপাত প্যারামিটার খুঁজে পেতে পারেন।
স্টপ যোগ করুন। যুক্তিসঙ্গত স্টপ অবস্থান সেট করুন এবং ঝুঁকি নিয়ন্ত্রণ করুন।
ফিল্টারিং শর্ত অপ্টিমাইজেশান. আপনি অন্যান্য ফিল্টারিং শর্ত যেমন লেনদেনের পরিমাণ, এটিআর স্টপ লস ইত্যাদি পরীক্ষা করতে পারেন।
লোগো অপ্টিমাইজেশানঃ বিভিন্ন ট্রেডিং লোগো যেমন স্টক, ফরেক্স, ক্রিপ্টোকারেন্সি ইত্যাদির মধ্যে পরীক্ষা করা যেতে পারে।
এই কৌশলটি প্রবণতা বিচার, প্রবেশের শর্ত, স্টপ ট্র্যাকিং ইত্যাদির মতো একাধিক কৌশল মডিউলকে সংহত করে। প্রবণতার সময়, স্টপগুলিকে ক্রমাগত ট্র্যাক করা যায় এবং মুনাফা সর্বাধিক করা যায়। তবে কৌশলটির সর্বাধিক কার্যকারিতা অর্জনের জন্য ঝুঁকি নিয়ন্ত্রণ করা, ঝড়ের সময় ব্যবহার করা এড়ানো এবং প্যারামিটার অপ্টিমাইজ করা আবশ্যক। এই কৌশলটি আমাদেরকে আরও বেশি মুনাফা অর্জনের জন্য স্টপ ট্র্যাকিং ব্যবহার করার একটি ধারণা দেয়।
/*backtest
start: 2023-01-01 00:00:00
end: 2023-10-06 00:00:00
period: 2d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
//@author=Daveatt
SystemName = "BEST Trailing Profit Strategy"
// This string is to personalize the text that appears with your orders on the chart through strategy() calls and entry/exit markers, and in the alert default message.
// Although leaving it empty will not cause problems in study mode,
TradeId = "BEST"
// These values are used both in the strategy() header and in the script's relevant inputs as default values so they match.
// Unless these values match in the script's Inputs and the TV backtesting Properties, results between them cannot be compared.
InitCapital = 1000000
InitPosition = 100
InitCommission = 0.075
InitPyramidMax = 1
CalcOnorderFills = true
CalcOnTick = true
DefaultQtyType = strategy.fixed
DefaultQtyValue = strategy.fixed
Precision = 2
Overlay=true
// strategy(title=SystemName, shorttitle=SystemName, overlay=Overlay,
// pyramiding=InitPyramidMax, initial_capital=InitCapital, default_qty_type=DefaultQtyType, default_qty_value=InitPosition, commission_type=strategy.commission.percent,
// commission_value=InitCommission, calc_on_order_fills=CalcOnorderFills, calc_on_every_tick=CalcOnTick, precision=2)
// strategy(title=SystemName, shorttitle=SystemName, overlay=true,
// pyramiding=0, default_qty_value=100, precision=7, currency=currency.USD,
// commission_value=0.2,commission_type=strategy.commission.percent, initial_capital=10000)
//
// Author: Daveatt
// Revision: R0.1 Beta
// Date: 8-Dec-2019
//
// inputs
src = input(defval=close, type=input.source, title="Source")
slowLength = input(20, "Fast Length",minval=2,step=1)
fastLength = input(50, "Fast Length",minval=2,step=1)
// Calculate moving averages
fastSMA = sma(src, slowLength)
slowSMA = sma(src, fastLength)
// Calculate trading conditions
enterLong = crossover(fastSMA, slowSMA)
enterShort = crossunder(fastSMA, slowSMA)
// trend states
since_buy = barssince(enterLong)
since_sell = barssince(enterShort)
buy_trend = since_sell > since_buy
sell_trend = since_sell < since_buy
change_trend = (buy_trend and sell_trend[1]) or (sell_trend and buy_trend[1])
// get the entry price
entry_price = valuewhen(enterLong or enterShort, src, 0)
// Plot moving averages
plot(series=fastSMA, color=color.teal)
plot(series=slowSMA, color=color.orange)
// Plot the entries
plotshape(enterLong, style=shape.circle, location=location.belowbar, color=color.green, size=size.small)
plotshape(enterShort, style=shape.circle, location=location.abovebar, color=color.red, size=size.small)
///////////////////////////////
//======[ Take Profit ]======//
///////////////////////////////
// Use TP?
useTP = input(true, "Use take profit")
// TP trailing
ProfitTrailPerc = input(1.0, "Trailing Profit (%)",minval=0,step=0.5,type=input.float) * 0.01
use_TP_Trigger = input(true, "Use Take Profit Trigger")
// Will trigger the take profit trailing once reached
takeProfitTrigger = input(3.0, "Take Profit Trigger (%)",minval=0,step=0.5,type=input.float) * 0.01
// ttp := ttp>tp ? tp : ttp
takeprofitPriceTrigger = 0.0
takeprofitPriceTrigger := if (use_TP_Trigger)
if (buy_trend)
entry_price * (1 + takeProfitTrigger)
else
entry_price * (1 - takeProfitTrigger)
else
-1
//plot(entry_price, title='entry_price', transp=100)
var TP_Trigger_Long_HIT = false
TP_Trigger_Long_HIT := useTP and use_TP_Trigger and buy_trend and high >= takeprofitPriceTrigger
? true : TP_Trigger_Long_HIT[1]
var TP_Trigger_Short_HIT = false
TP_Trigger_Short_HIT := useTP and use_TP_Trigger and sell_trend and low <= takeprofitPriceTrigger
? true : TP_Trigger_Short_HIT[1]
display_long_TP_trigger = useTP and buy_trend and TP_Trigger_Long_HIT == false
and takeprofitPriceTrigger != -1
display_short_TP_trigger = useTP and sell_trend and TP_Trigger_Short_HIT == false
and takeprofitPriceTrigger != -1
display_TP_trigger = display_long_TP_trigger or display_short_TP_trigger
//🔷🔷🔷
// @hugo: Will display the TP trigger as long as not hit
// once the TP trigger is hit, the TP trailing will activate
plot(display_TP_trigger ? takeprofitPriceTrigger : na, title='takeprofitPriceTrigger', transp=0, color=color.orange,
style=plot.style_cross, linewidth=3)
longTrailTP= 0.0, shortTrailTP = 0.0
// Trailing Profit
// Start trailing once trigger is reached
longTrailTP := if useTP and buy_trend
tpValue = high * (1 + ProfitTrailPerc)
max(tpValue, longTrailTP[1])
else
0
shortTrailTP := if useTP and sell_trend
tpValue = low * (1 - ProfitTrailPerc)
min(tpValue, shortTrailTP[1])
else
999999
//plot(longTrailTP, title='debug longTrailTP', transp=100)
//plot(shortTrailTP, title='debug shortTrailTP', transp=100)
//////////////////////////////////////////////////////////////////////////////////////////
//*** TRAILING TAKE PROFIT HIT CONDITIONS TO BE USED IN ALERTS ***//
//////////////////////////////////////////////////////////////////////////////////////////
//🔷🔷🔷
// @hugo: I use crossover/crossunder for the alerts to trigger the events only once
cond_long_trail_tp_hit = useTP and buy_trend and crossover(high, longTrailTP[1])
and (TP_Trigger_Long_HIT or use_TP_Trigger == false)
cond_short_trail_tp_hit = useTP and sell_trend and crossunder(low, shortTrailTP[1])
and (TP_Trigger_Short_HIT or use_TP_Trigger == false)
// 🔷🔷🔷
// Plot take profits values for confirmation
// Display the trailing TP until not hit
plot(series= useTP and buy_trend and high <= longTrailTP and
(TP_Trigger_Long_HIT or use_TP_Trigger == false) ? longTrailTP : na,
color=color.aqua, style=plot.style_circles,
linewidth=2, title="Long Trail TP")
plot(series= useTP and sell_trend and low >= shortTrailTP and
(TP_Trigger_Short_HIT or use_TP_Trigger == false) ? shortTrailTP : na,
color=color.aqua, style=plot.style_circles,
linewidth=2, title="Short Trail TP")
close_long = cond_long_trail_tp_hit
close_short = cond_short_trail_tp_hit
// Submit entry orders
strategy.entry("EL", long=true, when=enterLong)
strategy.close("EL", when=close_long)
//if (enterShort)
strategy.entry("ES", long=false, when=enterShort)
strategy.close("ES", when=close_short)
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////// ALERTS ////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////
//* Put Entry Alerts below *//
//////////////////////////////
// IN STUDY MODE ONLY
// ⚠️⚠️⚠️ For alerts on the signal itself ⚠️⚠️⚠️
//alertcondition(buy_event, "Open Long", "LONG")
//alertcondition(sell_event, "Open Short", "SHORT")
// For the closes you will want to trigger these alerts on condition with alert
// option "Once Per Bar" for TP and SL
if change_trend
TP_Trigger_Long_HIT := false
TP_Trigger_Short_HIT := false