
यह रणनीति दो तकनीकी संकेतकों को जोड़ती है - डोंगचीआन चैनल और सरल चलती औसत। जब कीमत डोंगचीआन चैनल के नीचे की ओर और सरल चलती औसत से ऊपर होती है, तो अधिक स्थिति खोलें, और जब कीमत डोंगचीआन चैनल के ऊपर की ओर और सरल चलती औसत से नीचे होती है, तो खाली स्थिति खोलें। जब कीमत डोंगचीआन चैनल के ऊपर की ओर और नीचे की ओर होती है, तो मल्टीहेड पोजीशन फ्लैट होती है।
डायनामिक डोंग-चियान चैनल और सरल चलती औसत के संयोजन की रणनीति एक सरल और आसान उपयोग की जाने वाली मात्रात्मक व्यापार रणनीति ढांचा है। यह प्रवृत्ति ट्रैकिंग और अस्थिरता को तोड़ने के दो दृष्टिकोणों से एक प्रवृत्ति के लिए उपयुक्त है। लेकिन यह रणनीति अक्सर अस्थिर बाजारों में खराब प्रदर्शन करती है, और पैरामीटर स्थिरता सामान्य रूप से है। इस रणनीति की अनुकूलनशीलता और लचीलापन को सहायक स्थिति खोलने की स्थिति, गतिशील स्टॉप और पैरामीटर स्वैच्छिक अनुकूलन तंत्र को पेश करके बढ़ाया जा सकता है। कुल मिलाकर, यह रणनीति एक बुनियादी रणनीति ढांचे के रूप में काम कर सकती है, और इसके आधार पर आगे परिष्कृत की जा सकती है, और अधिक उन्नत मात्रात्मक रणनीति बना सकती है।
/*backtest
start: 2024-05-01 00:00:00
end: 2024-05-31 23:59:59
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("FBK Donchian Channel Strategy", overlay=true)
// Inputs
donchian_period = input.int(20, title="Donchian Channel Period")
donchian_offset = input.int(1, title="Donchian Channel Offset")
sma_period = input.int(200, title="SMA Period")
start_date = input(timestamp("2023-01-01 00:00 +0000"), title="Start Date")
end_date = input(timestamp("2023-12-31 23:59 +0000"), title="End Date")
trade_type = input.string("Both", title="Trade Type", options=["Buy Only", "Sell Only", "Both"])
// Calculate indicators
donchian_upper = ta.highest(high, donchian_period)[donchian_offset]
donchian_lower = ta.lowest(low, donchian_period)[donchian_offset]
sma = ta.sma(close, sma_period)
// Plot indicators
plot(donchian_upper, color=color.red, title="Donchian Upper")
plot(donchian_lower, color=color.green, title="Donchian Lower")
plot(sma, color=color.blue, title="SMA")
// Helper function to check if within testing period
is_in_testing_period() => true
// Entry conditions
long_condition = low <= donchian_lower and close > sma
short_condition = high >= donchian_upper and close < sma
// Exit conditions
exit_long_condition = high >= donchian_upper
exit_short_condition = low <= donchian_lower
// Open long position
if (is_in_testing_period() and (trade_type == "Buy Only" or trade_type == "Both") and long_condition)
strategy.entry("Long", strategy.long)
// Close long position
if (is_in_testing_period() and exit_long_condition)
strategy.close("Long")
// Open short position
if (is_in_testing_period() and (trade_type == "Sell Only" or trade_type == "Both") and short_condition)
strategy.entry("Short", strategy.short)
// Close short position
if (is_in_testing_period() and exit_short_condition)
strategy.close("Short")
// Close all positions at the end of the testing period
if not is_in_testing_period()
strategy.close_all()