
এই কৌশলটি একটি প্রস্থান কৌশল যা একটি স্তরবিন্যাস স্টপ ব্যবহার করে যা একটি স্লাইডিং স্টপ-এর সাথে মিলিত হয়। প্রথম স্টপ-পয়েন্টটি পৌঁছানোর পরে, এটি স্টপ-লসকে লাভজনক সমতুল্য স্থানে স্থানান্তরিত করে এবং দ্বিতীয় স্টপ-পয়েন্টটি পৌঁছানোর পরে স্টপ-লসকে প্রথম স্টপ-পয়েন্টে স্থানান্তরিত করে, যার ফলে একটি স্তরবিন্যাস স্টপ-লস স্লাইডিং প্রক্রিয়া উপলব্ধ হয়। এটি আংশিক মুনাফা লক করতে পারে এবং একই সাথে একটি বড় মুনাফা স্থান বজায় রাখতে পারে।
এই কৌশলটি প্রধানত নিম্নলিখিত অংশগুলির মাধ্যমে ধাপে ধাপে স্টপ-স্লিপিং পয়েন্টগুলিকে বাস্তবায়ন করেঃ
বিশেষত, এটি প্রথমে 100 পয়েন্টের স্টপ লস এবং 100/200/300 পয়েন্টের 3 টি স্টপ লস সেট করে। তারপরে বর্তমান মূল্য এবং খোলার মূল্যের ভিত্তিতে লাভের সংখ্যা গণনা করার জন্য একটি ফাংশন সংজ্ঞায়িত করেcurProfitInPts, এবং একটি ফাংশন যা বিন্দু দূরত্বের উপর ভিত্তি করে স্টপ লস মূল্য গণনা করেcalcStopLossPrice。
এর মূল যুক্তি হচ্ছে,getCurrentStageফাংশন, যা নির্ধারণ করে যে বর্তমানে কোন অবস্থান আছে কিনা, এবং লাভের সংখ্যা কোন স্টপপয়েন্ট অতিক্রম করেছে কিনা, যদি অতিক্রম করা হয় তবে পরবর্তী পর্যায়ে চলে যায়। উদাহরণস্বরূপ, 100 স্টপপয়েন্ট পৌঁছে গেলে দ্বিতীয় পর্যায়ে চলে যায়, 200 স্টপপয়েন্ট পৌঁছে গেলে তৃতীয় পর্যায়ে চলে যায়।
অবশেষে, স্টেজ অনুযায়ী স্টপ লস মূল্য পরিবর্তন করে, যার ফলে স্লাইডিং পয়েন্ট স্টপ অর্জন করা যায়। প্রথম স্টেজ স্টপ লস মূল সেটিংটি বজায় রাখে, দ্বিতীয় স্টেজটি লাভ-ক্ষতি ভারসাম্যতে চলে যায়, তৃতীয় স্টেজটি প্রথম স্টপ পয়েন্টে চলে যায়।
এই ধাপে ধাপে স্টপস্লাইড পয়েন্ট কৌশলটির কিছু সুবিধা রয়েছেঃ
এই কৌশলটির কিছু ঝুঁকিও রয়েছেঃ
এই কৌশলটি নিম্নলিখিত দিকগুলি থেকে অপ্টিমাইজ করা যেতে পারেঃ
/*backtest
start: 2023-11-20 00:00:00
end: 2023-11-27 00:00:00
period: 3m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © adolgov
// @description
// when tp1 is reached, sl is moved to break-even
// when tp2 is reached, sl is moved to tp1
// when tp3 is reached - exit
//@version=4
strategy("Stepped trailing strategy example", overlay=true)
// random entry condition
longCondition = crossover(sma(close, 14), sma(close, 28))
if (longCondition)
strategy.entry("My Long Entry Id", strategy.long)
// sl & tp in points
sl = input(100)
tp1 = input(100)
tp2 = input(200)
tp3 = input(300)
curProfitInPts() =>
if strategy.position_size > 0
(high - strategy.position_avg_price) / syminfo.mintick
else if strategy.position_size < 0
(strategy.position_avg_price - low) / syminfo.mintick
else
0
calcStopLossPrice(OffsetPts) =>
if strategy.position_size > 0
strategy.position_avg_price - OffsetPts * syminfo.mintick
else if strategy.position_size < 0
strategy.position_avg_price + OffsetPts * syminfo.mintick
else
0
calcProfitTrgtPrice(OffsetPts) =>
calcStopLossPrice(-OffsetPts)
getCurrentStage() =>
var stage = 0
if strategy.position_size == 0
stage := 0
if stage == 0 and strategy.position_size != 0
stage := 1
else if stage == 1 and curProfitInPts() >= tp1
stage := 2
else if stage == 2 and curProfitInPts() >= tp2
stage := 3
stage
stopLevel = -1.
profitLevel = calcProfitTrgtPrice(tp3)
// based on current stage set up exit
// note: we use same exit ids ("x") consciously, for MODIFY the exit's parameters
curStage = getCurrentStage()
if curStage == 1
stopLevel := calcStopLossPrice(sl)
strategy.exit("x", loss = sl, profit = tp3, comment = "sl or tp3")
else if curStage == 2
stopLevel := calcStopLossPrice(0)
strategy.exit("x", stop = stopLevel, profit = tp3, comment = "breakeven or tp3")
else if curStage == 3
stopLevel := calcStopLossPrice(-tp1)
strategy.exit("x", stop = stopLevel, profit = tp3, comment = "tp1 or tp3")
else
strategy.cancel("x")
// this is debug plots for visulalize TP & SL levels
plot(stopLevel > 0 ? stopLevel : na, style = plot.style_linebr)
plot(profitLevel > 0 ? profitLevel : na, style = plot.style_linebr)