
প্রবণতা ক্যাপচার কৌশল একটি কৌশল যা একটি প্রবণতা সনাক্ত করার জন্য একটি অনন্য পদ্ধতি ব্যবহার করে এবং প্রবণতার দিকে অবস্থান স্থাপন করে। এটি একটি নির্দিষ্ট পরিসরের মধ্যে সর্বোচ্চ এবং সর্বনিম্ন মূল্যের পার্থক্য এবং সেই পরিসরের মধ্যে সমস্ত কে লাইনের দৈর্ঘ্যের সমষ্টির সাথে একটি শতাংশের মানকে “সীমা” হিসাবে গণনা করে। এই মানটি 100 এর কাছাকাছি, প্রবণতাটি আরও শক্তিশালী। যখন এই মানটি সেট করা সীমাবদ্ধতা অতিক্রম করে এবং চলমান গড়ের উপরে চলে যায়, তখন কৌশলটি একটি মাল্টিপ্লট খোলে; যখন এটি সেট করা সীমাবদ্ধতা অতিক্রম করে এবং চলমান গড়টি নীচে চলে যায়, তখন কৌশলটি খালি পলিসি খোলে। পজিশন খোলার পরে, কৌশলটি নির্দিষ্ট স্তরের দাম পৌঁছে গেলে পজিশনের অংশটি সমতল করে এবং অবশিষ্ট অবস্থানটি প্রবণতা হিসাবে বিবেচিত শেষ পয়েন্টে স্থানান্তরিত করে।
ট্রেন্ড ক্যাপচার কৌশলটি ট্রেন্ড গঠনের জন্য একটি অনন্য পদ্ধতি ব্যবহার করে এবং ট্রেন্ডের দিকনির্দেশে পজিশন খোলে। এটি প্রবণতার শক্তি নির্ধারণের জন্য সীমাবদ্ধতার মান গণনা করে এবং চলমান গড়কে অতিক্রম করে ট্রেন্ডের সমাপ্তি নির্ধারণ করে। পজিশন খোলার পরে কৌশলটি কিছু পজিশন এবং চলমান স্টপ লস পজিশনকে সমতল করে ঝুঁকি নিয়ন্ত্রণ করে। তবে, কৌশলটি প্রবণতার শুরুতে পজিশন খোলার ক্ষেত্রে কিছু ঝুঁকি থাকতে পারে, নির্দিষ্ট স্টপ লস ব্যবহার করে স্থির স্টপ লস যথেষ্ট নমনীয় নাও হতে পারে, কেবল চলমান গড় লাইন ব্যবহার করে ট্রেন্ডের বিচার করার জন্য কিছু সুযোগ মিস হতে পারে। ভবিষ্যতে অন্যান্য সূচকগুলি, গতিশীল স্টপ লস সামঞ্জস্য এবং ট্রেন্ড নিশ্চিত হওয়ার পরে পজিশন খোলার মতো কৌশলগুলিকে অনুকূলিত করার জন্য বিবেচনা করা যেতে পারে।
/*backtest
start: 2023-04-20 00:00:00
end: 2024-04-25 00:00:00
period: 1d
basePeriod: 1h
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/
// © faytterro
//@version=5
strategy("Trend Catcher Strategy", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
len = input.int(10)
tp = input.float(2.5, step = 0.1)
sl = input.float(2.5, step = 0.1)
malen = input.int(5)
limit = input.int(50)
ma = ta.sma(close,malen)
sum = 0.0
for i = 0 to len-1
sum := sum + high[i]-low[i]
frs = 100*(ta.highest(high,len)-ta.lowest(low,len))/sum
//hline(50)
//plot(frs, color = color.white)
l = ta.crossover(frs,limit) and ma>ma[1]
s = ta.crossover(frs,limit) and ma<ma[1]
cl = ma<ma[1]
cs = ma>ma[1]
qty_balance=input.int(50, maxval = 100)
if (l)
strategy.entry("My Long Entry Id", strategy.long)
strategy.exit("exit long", "My Long Entry Id", qty_percent = qty_balance, limit = close*(100+tp)/100, stop = close*(100-sl)/100)
if (s)
strategy.entry("My Short Entry Id", strategy.short)
strategy.exit("exit short", "My Short Entry Id", qty_percent = qty_balance, limit = close*(100-tp)/100, stop = close*(100+sl)/100)
if (cl)
strategy.close("My Long Entry Id")
if (cs)
strategy.close("My Short Entry Id")
l:= l and strategy.opentrades<1
s:= s and strategy.opentrades<1
transp = strategy.opentrades>0? 0 : 100
pma=plot(ma, color = ma<ma[1]? color.rgb(255, 82, 82, transp) : color.rgb(76, 175, 79, transp))
price = open/2+close/2
pprice = plot(price, display = display.none)
fill(pma,pprice, color = ma<ma[1]? color.rgb(255, 82, 82, transp+90) : color.rgb(76, 175, 79, transp+90))
spm=plot(ta.valuewhen(s,close,0), color = (strategy.opentrades>0 and ma<ma[1] and ma[1]<ma[2])? color.white : color.rgb(1,1,1,100), offset=1)
lpm=plot(ta.valuewhen(l,close,0), color = (strategy.opentrades>0 and ma>ma[1] and ma[1]>ma[2])? color.white : color.rgb(1,1,1,100), offset=1)
ltp=plot(ta.valuewhen(l,close,0)*(100+ta.valuewhen(l,tp,0))/100, color = (strategy.opentrades>0 and ma>ma[1] and ma[1]>ma[2])? color.green : color.rgb(1,1,1,100), offset=1)
lsl=plot(ta.valuewhen(l,close,0)*(100-ta.valuewhen(l,sl,0))/100, color = (strategy.opentrades>0 and ma>ma[1] and ma[1]>ma[2])? color.red : color.rgb(1,1,1,100), offset=1)
stp=plot(ta.valuewhen(s,close,0)*(100-ta.valuewhen(s,tp,0))/100, color = (strategy.opentrades>0 and ma<ma[1] and ma[1]<ma[2])? color.green : color.rgb(1,1,1,100), offset=1)
ssl=plot(ta.valuewhen(s,close,0)*(100+ta.valuewhen(s,sl,0))/100, color = (strategy.opentrades>0 and ma<ma[1] and ma[1]<ma[2])? color.red : color.rgb(1,1,1,100), offset=1)
fill(stp,spm, color = (strategy.opentrades>0 and ma<ma[1] and ma[1]<ma[2])? color.rgb(76, 175, 79, 90) : color.rgb(1,1,1,100))
fill(ssl,spm, color = (strategy.opentrades>0 and ma<ma[1] and ma[1]<ma[2])? color.rgb(255, 82, 82, 90) : color.rgb(1,1,1,100))
fill(ltp,lpm, color = (strategy.opentrades>0 and ma>ma[1] and ma[1]>ma[2])? color.rgb(76, 175, 79, 90) : color.rgb(1,1,1,100))
fill(lsl,lpm, color = (strategy.opentrades>0 and ma>ma[1] and ma[1]>ma[2])? color.rgb(255, 82, 82, 90) : color.rgb(1,1,1,100))