
এই কৌশলটি মূল পয়েন্টের উপর ভিত্তি করে বাজারের বিপরীতমুখী পয়েন্টগুলি সনাক্ত করে এবং এর ভিত্তিতে লেনদেন করে। যখন বাজারটি বামদিকে 4 টি কে লাইনের মধ্যে মূল পয়েন্টের উচ্চ পয়েন্ট (পিভট হাই) দেখা দেয়, তখন কৌশলটি পজিশনটি বেশি করে; যখন বাজারটি বামদিকে 4 টি কে লাইনের মধ্যে মূল পয়েন্টের নিম্ন পয়েন্ট (পিভট লো) দেখা দেয়, তখন কৌশলটি পজিশনটি খালি করে। কৌশলটির স্টপ লসটি খোলা পজিশনের দামের পরবর্তী সর্বনিম্ন মূল্য পরিবর্তন ইউনিট (syminfo.mintick) । কৌশলটির দুটি প্রস্থান শর্ত রয়েছেঃ 1) যখন পরবর্তী বিপরীত দিকের মূল পয়েন্টটি পজিশনটি সমতল হয়; 2) যখন মুদ্রাস্ফীতি 30% পজিশনের সমতল হয়।
এই কৌশলটি মূলধারার পয়েন্ট সূচকগুলির উপর ভিত্তি করে একটি দ্বি-মুখী ব্যবসায়ের ব্যবস্থা তৈরি করে, মূলধারার উচ্চতায় অতিরিক্ত এবং নিম্ন পর্যায়ে ফাঁকা করে বাজারের বিপরীতমুখী সুযোগগুলি ক্যাপচার করে। কৌশলটির একটি নির্দিষ্ট তাত্ত্বিক ভিত্তি এবং ব্যবহারিক মূল্য রয়েছে, তবে মূলধারার সূচকগুলির নিজস্ব সীমাবদ্ধতার কারণে কৌশলটি বাস্তবায়নের ক্ষেত্রে কিছু ঝুঁকি এবং চ্যালেঞ্জের মুখোমুখি হতে পারে। মূলধারার সূচকের ধরণ, প্যারামিটার, ফিল্টারিং শর্ত, স্টপ লস ইত্যাদির অপ্টিমাইজেশনের মাধ্যমে কৌশলটির স্থিতিশীলতা এবং লাভজনকতা আরও বাড়ানোর সম্ভাবনা রয়েছে।
/*backtest
start: 2023-04-24 00:00:00
end: 2024-04-29 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Pivot Reversal Strategy with Pivot Exit", overlay=true)
leftBars = input(4)
rightBars = input(2)
var float dailyEquity = na
// Reset equity to $10,000 at the beginning of each day
isNewDay = ta.change(time("D")) != 0
if (isNewDay)
dailyEquity := 10000
// Calculate pivot highs and lows
swh = ta.pivothigh(leftBars, rightBars)
swl = ta.pivotlow(leftBars, rightBars)
// Define long entry condition
swh_cond = not na(swh)
hprice = 0.0
hprice := swh_cond ? swh : hprice[1]
le = false
le := swh_cond ? true : (le[1] and high > hprice ? false : le[1])
// Enter long position if long entry condition is met
if (le)
strategy.entry("PivRevLE", strategy.long, comment="EnterLong", stop=hprice + syminfo.mintick)
// Define short entry condition
swl_cond = not na(swl)
lprice = 0.0
lprice := swl_cond ? swl : lprice[1]
se = false
se := swl_cond ? true : (se[1] and low < lprice ? false : se[1])
// Enter short position if short entry condition is met
if (se)
strategy.entry("PivRevSE", strategy.short, comment="EnterShort", stop=lprice - syminfo.mintick)
// Exit condition: Exit at the next pivot point
exitAtNextPivot() =>
if strategy.opentrades > 0
if strategy.position_size > 0
// Exiting long position at next pivot low
if not na(swl)
strategy.exit("ExitLong", "PivRevLE", stop=swl - syminfo.mintick)
else
// Exiting short position at next pivot high
if not na(swh)
strategy.exit("ExitShort", "PivRevSE", stop=swh + syminfo.mintick)
// Call exitAtNextPivot function
exitAtNextPivot()
// Exit condition: Exit if profit is less than 30%
exitIfProfitLessThanThirtyPercent() =>
if strategy.opentrades > 0
if strategy.position_size > 0
// Calculate profit percentage for long position
profit_percentage_long = (close - strategy.position_avg_price) / strategy.position_avg_price * 100
// Exiting long position if profit is less than 30%
if profit_percentage_long < -30
strategy.close("PivRevLE")
else
// Calculate profit percentage for short position
profit_percentage_short = (strategy.position_avg_price - close) / strategy.position_avg_price * 100
// Exiting short position if profit is less than 30%
if profit_percentage_short < -30
strategy.close("PivRevSE")
// Call exitIfProfitLessThanThirtyPercent function
exitIfProfitLessThanThirtyPercent()