यह रणनीति विशेष रूप से सप्ताहांत के मूल्य में उतार-चढ़ाव के लिए व्यापार करती है, जो पूर्व-निर्धारित उतार-चढ़ाव की सीमा के माध्यम से बहुमुखी दिशा का आकलन करती है।
रणनीतिक सिद्धांत:
पिछले शुक्रवार के समापन मूल्य के संदर्भ में, एक ऊपरी-नीचे की सीमा निर्धारित करें, उदाहरण के लिए, समापन मूल्य में 4.5% की ऊपरी सीमा।
जब कीमत सीमा के ऊपर की सीमा से अधिक हो, तो शून्य करें; जब कीमत सीमा से नीचे हो, तो अधिक करें।
यदि आपके पास पहले से ही स्थिति है, तो एक नए स्तर से अधिक के आधार पर स्थिति को आगे बढ़ाएं, जैसे कि खाली या अतिरिक्त।
जब संचयी लाभ एक निश्चित अनुपात तक पहुंच जाता है, तो स्थिति को बंद कर दिया जाता है, उदाहरण के लिए 10%।
एक बार में दो दिशाओं में अधिकतम पदों पर कब्जा करना। सोमवार को खुले जाने से पहले सभी पदों को खाली करना।
इस रणनीति के फायदे:
स्थिर उतार-चढ़ाव की सीमा निर्धारित करें, यांत्रिक संचालन करें।
चरणबद्ध जमा बेहतर लागत मूल्य प्राप्त करता है।
आवर्तक नियम स्थिर है और मूलभूत प्रभावों से मुक्त है।
इस रणनीति के जोखिम:
एकल हानि के आकार को सीमित नहीं किया जा सकता है, एक बड़े एकल हानि का खतरा है।
निश्चित पैरामीटर विभिन्न समय अवधि के लिए बाजार में उतार-चढ़ाव के लिए अनुकूल नहीं हैं।
आवधिक नियम में परिवर्तन हो सकता है, जिससे मॉडल विफल होने का खतरा होता है।
संक्षेप में, इस रणनीति का उपयोग आवधिक नियम के लिए किया जाता है, लेकिन कुछ मुनाफे को लॉक करने में कठिनाई होती है। सावधान रहना चाहिए कि पैरामीटर विफल हो जाए और एकल हानि का अत्यधिक जोखिम हो, सावधानी से काम करना।
/*backtest
start: 2023-01-01 00:00:00
end: 2023-09-12 00:00:00
period: 2d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
//Copyright Boris Kozak
// strategy("XBT Weekend Trade Strategy", overlay=true, default_qty_type=strategy.percent_of_equity,)
strategy.initial_capital=50000
leverage = input(10,"Leverage")
profitTakingPercentThreshold = input(0.10,"Profit Taking Percent Threshold")
//****Code used for setting up backtesting.****///
testStartYear = input(2017, "Backtest Start Year")
testStartMonth = input(12, "Backtest Start Month")
testStartDay = input(10, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)
testStopYear = input(2025, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(30, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)
// A switch to control background coloring of the test period
testPeriodBackground = input(title="Color Background?", type=bool, defval=true)
testPeriodBackgroundColor = testPeriodBackground and (time >= testPeriodStart) and (time <= testPeriodStop) ? #00FFFF : na
bgcolor(testPeriodBackgroundColor, transp=50)
testPeriod() => true
//****END Code used for setting up backtesting.****///
//*** Main entry point is here***//
// Figure out how many days since the Friday close
days_since_friday = if dayofweek == 6
0
else
if dayofweek == 7
1
else
if dayofweek == 1
2
else
if dayofweek == 2
3
else
if dayofweek == 3
4
else
if dayofweek == 4
5
else
6
// Grab the Friday close price
fridaycloseprice = security(syminfo.ticker,'D',close[days_since_friday])
plot(fridaycloseprice)
// Only perform backtesting during the window specified
if testPeriod()
// If we've reached out profit threshold, exit all positions
if ((strategy.openprofit/strategy.initial_capital) > profitTakingPercentThreshold)
strategy.close_all()
// Only execute this trade on saturday and sunday (UTC)
if (dayofweek == 7.0 or dayofweek == 1.0)
// Begin - Empty position (no active trades)
if (strategy.position_size == 0)
// If current close price > threshold, go short
if ((close>fridaycloseprice*1.045))
strategy.entry("Short Entry", strategy.short, leverage)
else
// If current close price < threshold, go long
if (close<(fridaycloseprice*0.955))
strategy.entry("Long Entry",strategy.long, leverage)
// Begin - we already have a position
if (abs(strategy.position_size) > 0)
// We are short
if (strategy.position_size < 0)
if ((close>strategy.position_avg_price*1.045))
// Add to the position
strategy.entry("Adding to Short Entry", strategy.short, leverage)
else
if ((close<strategy.position_avg_price*0.955))
strategy.entry("Adding to Long Entry",strategy.long,leverage)
// On Monday, if we have any open positions, close them
if (dayofweek==2.0)
strategy.close_all()