
اس حکمت عملی میں دو تکنیکی اشارے شامل ہیں: ڈونگ چیان چینل اور سادہ منتقل اوسط۔ جب قیمت ڈونگ چیان چینل کے نیچے کی ٹریک کو توڑتی ہے اور سادہ منتقل اوسط سے زیادہ ہوتی ہے تو زیادہ پوزیشن کھولی جاتی ہے۔ جب قیمت ڈونگ چیان چینل کے اوپر کی ٹریک کو توڑتی ہے اور سادہ منتقل اوسط سے کم ہوتی ہے تو خالی پوزیشن کھولی جاتی ہے۔ جب قیمت ڈونگ چیان چینل کے اوپر کی ٹریک کو چھوتی ہے تو خالی پوزیشن کھولی جاتی ہے۔ جب قیمت ڈونگ چیان چینل کے نیچے کی ٹریک کو چھوتی ہے تو خالی پوزیشن۔ یہ حکمت عملی رجحان سازی کے لئے موزوں ہے۔
متحرک ٹونچین چینل اور سادہ حرکت پذیر اوسط کے ساتھ مل کر حکمت عملی ایک سادہ اور آسان استعمال کرنے والا مقداری تجارتی حکمت عملی کا فریم ورک ہے۔ یہ رجحان کی پیروی اور اتار چڑھاؤ کے توڑنے کے دو زاویوں سے کھلنے والی پوزیشن کی منطق تیار کرتا ہے ، جو مضبوط رجحان سازی والی اقسام کے لئے موزوں ہے۔ تاہم ، یہ حکمت عملی اکثر اتار چڑھاؤ والی مارکیٹوں میں خراب کارکردگی کا مظاہرہ کرتی ہے ، اور عام طور پر اس کی پیرامیٹرز مستحکم ہیں۔ اس حکمت عملی کی موافقت اور لچک کو بڑھانے کے لئے معاون پوزیشن کھولنے کی شرائط ، متحرک اسٹاپ اور پیرامیٹر خود کار طریقے سے موافقت کے طریقہ کار کو متعارف کرایا جاسکتا ہے۔ مجموعی طور پر ، یہ حکمت عملی بنیادی حکمت عملی کے فریم ورک کی حیثیت سے کام کرتی ہے ، جس کی بنیاد پر مزید اعلی درجے کی مقداری حکمت عملی کی تشکیل کے لئے مزید ترمیم کی جاسکتی ہے۔
/*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()